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

Fix AbstractCell#toString throws MarshalException for cell in collection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.1-beta1, 4.1
    • Legacy/Core
    • None
    • Degradation - Other Exception
    • Low
    • Low Hanging Fruit
    • Unit Test
    • All
    • None
    • Hide

      Added test verifying that MarshalException no longer occurs when calling AbstractCell#toString after the fix.

      Show
      Added test verifying that MarshalException no longer occurs when calling AbstractCell#toString after the fix.

    Description

      AbstractCell#toString is broken when calling on some cells in multi-cell collections.

      With the following types are unmarshallable: [date, duration, smallint, time, tinyint].

      The test to discover the unmarshallable types is

      @Test
      public void testUnmarshallableInMulticellCollection()
      {
          List<CQL3Type.Native> unmarshallableTypes = new ArrayList<>();
          for (CQL3Type.Native nativeType : CQL3Type.Native.values())
          {
              ColumnMetadata c = fakeColumn("c", MapType.getInstance(Int32Type.instance, nativeType.getType(), true));
              BufferCell cell = BufferCell.tombstone(c, 0, 4, CellPath.create(ByteBufferUtil.bytes(4)));
              try
              {
                  cell.toString();
              }
              catch (MarshalException m)
              {
                  unmarshallableTypes.add(nativeType);
              }
          }
          System.out.println("Unmarshallable types: " + unmarshallableTypes);
      }
      

      At the first sight, the error is caused by trying to deserialize the values of the tombstone cells. The values are empty, hence the failure.

      Attachments

        Activity

          People

            frankgh Francisco Guerrero
            yifanc Yifan Cai
            Francisco Guerrero
            Caleb Rackliffe, Yifan Cai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h