Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-4468

Temporally unreachable Dynamic Composite column names.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Low
    • Resolution: Duplicate
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      linux,

    • Severity:
      Low

      Description

      I was working on a Column family with a DynamicComposite column sorter when I noticed that sometimes, after the insertion of a column with a column name composed by a single string (eg 's@step'),it was possible to be reach the column only by slice query but not by direct access. For example using the cassandra-cli it is possible to query:
      get frame[int(26)];
      RowKey: 0000001a
      ....
      (column=i@19, value=00000013, timestamp=1343495134729000)
      => (column=s@step, value=746573742076616c7565, timestamp=1343495134680000)

      but typing 'get frame[int(26)]['s@step']' I got no result.

      I tested this behavior using also other clients such as Hector, Astyanax, Pycassa and directly Thrift.

      I wrote this java code with hector-core-1.1.0 to reproduce this bug.

      public static void main(String[] args) {
      String kname = "testspace3";
      Cluster myCluster = HFactory.getOrCreateCluster("Test-cluster", System.getProperty("location", "localhost:9160"));
      //creating the keyspace and Column family
      if (myCluster.describeKeyspace(kname) != null)

      { myCluster.dropKeyspace(kname, true); }


      ColumnFamilyDefinition cfd = HFactory.createColumnFamilyDefinition(kname, "frame", ComparatorType.DYNAMICCOMPOSITETYPE);
      cfd.setComparatorTypeAlias(DynamicComposite.DEFAULT_DYNAMIC_COMPOSITE_ALIASES);
      KeyspaceDefinition kdf = HFactory.createKeyspaceDefinition(kname, "SimpleStrategy", 1, Arrays.asList(cfd));
      myCluster.addKeyspace(kdf, true);
      Keyspace ksp = HFactory.createKeyspace(kname, myCluster);
      //Hector template definition
      ColumnFamilyTemplate<Integer, DynamicComposite> template =
      new ThriftColumnFamilyTemplate<Integer, DynamicComposite>(
      ksp,
      "frame",
      IntegerSerializer.get(),
      DynamicCompositeSerializer.get());

      DynamicComposite dc = new DynamicComposite();
      dc.addComponent("step", StringSerializer.get());
      DynamicComposite numdc = new DynamicComposite();
      numdc.addComponent(BigInteger.valueOf(62), BigIntegerSerializer.get());
      ColumnFamilyUpdater<Integer, DynamicComposite> cf = template.createUpdater(26);
      cf.setString(dc, "test value");
      cf.setString(numdc, "altro valore");
      template.update(cf);
      //without this parts it works. It works also with less then 4 insertions
      cf = template.createUpdater(26);
      for (int i = 0; i < 4; i++)

      { DynamicComposite num = new DynamicComposite(); num.addComponent(BigInteger.valueOf(i), BigIntegerSerializer.get()); cf.setInteger(num, i); }

      template.update(cf);
      // end part
      HColumn<DynamicComposite, String> res = template.querySingleColumn(26, dc, StringSerializer.get());
      if (res == null)

      { System.out.println("[FAIL] Row not found"); }

      else

      { System.out.println("[SUCCESS] Returned name " + res.getName().get(0).toString() + " - with value: " + res.getValue()); }

      }

      The code acts three tasks: configure keyspace an CF, insert the data and try to retrieve it. After running the code the data are visible (by list for example) but not reachable directly. Restarting Cassandra the row is again reachable.

      Furthermore, after running that code, if I run on the cassandra-cli
      set frame[int(26)]['s@step']=utf8(test);

      with a "list frame[int(26)]'
      RowKey: 0000001a
      => (column=s@step, value=test value, timestamp=1343499335791000)
      => (column=i@0, value=00000000, timestamp=1343499335816000)
      => (column=i@1, value=00000001, timestamp=1343499335816000)
      => (column=i@2, value=00000002, timestamp=1343499335816000)
      => (column=i@3, value=00000003, timestamp=1343499335816000)
      => (column=s@step, value=test, timestamp=1343499384630000)

      I found 2 column with the apparently the same column name.

      How is it possible?

      Best regards,

      Cesare

        Attachments

        1. BugFinder.java
          3 kB
          Cesare Cugnasco

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cugni Cesare Cugnasco
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: