Cassandra
  1. Cassandra
  2. CASSANDRA-4917

Optimize tombstone creation for ExpiringColumns

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Fix Version/s: 2.0 beta 1
    • Component/s: Core
    • Labels:
      None

      Description

      The goal of this ticket is to reduce the amount of tombstones created from ExpiringColumns.

      Currently tombstones will always stay a full gc_grace time, which is not neccessary for ExpiringColumns. We only need to ensure that ExpiringColumn and tombstone together live as long as gc_grace. If the ExpiringColumn's TTL>=gc_grace then we can create an already gcable tombstone and drop that instantly.

      My initial proposal was to use the ExpiringColumns creation-timestamp as deletiontime for the tombstone, but Sylvain pointed out that we should not mix local and client timestamps. So I changed it to this:

      public static Column create(ByteBuffer name, ByteBuffer value, long timestamp, int timeToLive, int localExpirationTime, int expireBefore, IColumnSerializer.Flag flag)
      {
          if (localExpirationTime >= expireBefore || flag == IColumnSerializer.Flag.PRESERVE_SIZE)
              return new ExpiringColumn(name, value, timestamp, timeToLive, localExpirationTime);
          // the column is now expired, we can safely return a simple tombstone
          return new DeletedColumn(name, localExpirationTime-timeToLive, timestamp);
          // return new DeletedColumn(name, localExpirationTime, timestamp); // old code
      }
      

      This was discussed on the mailinglist: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/repair-compaction-and-tombstone-rows-td7583481.html

        Issue Links

          Activity

          Christian Spriegel created issue -
          Christian Spriegel made changes -
          Field Original Value New Value
          Description
          The goal of this ticket is to reduce the amount of tombstones created from ExpiringColumns.

          Currently tombstones will always stay a full gc_grace time, which is not neccessary for ExpiringColumns. We only need to ensure that ExpiringColumn and tombstone together live as long as gc_grace. If the ExpiringColumn's TTL>=gc_grace then we can create an already gcable tombstone and drop that instantly.

          My initial proposal was to use the ExpiringColumns creation-timestamp as deletiontime for the tombstone, but Sylvain pointed out that we should not mix local and client timestamps. So I changed it to this:
          {code}
          public static Column create(ByteBuffer name, ByteBuffer value, long timestamp, int timeToLive, int localExpirationTime, int expireBefore, IColumnSerializer.Flag flag)
          {
              if (localExpirationTime >= expireBefore || flag == IColumnSerializer.Flag.PRESERVE_SIZE)
                  return new ExpiringColumn(name, value, timestamp, timeToLive, localExpirationTime);
              // the column is now expired, we can safely return a simple tombstone
              return new DeletedColumn(name, *localExpirationTime-timeToLive*, timestamp);
              // return new DeletedColumn(name, localExpirationTime, timestamp); // old code
          }
          {code}


          This was discussed on the mailinglist: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/repair-compaction-and-tombstone-rows-td7583481.html
          The goal of this ticket is to reduce the amount of tombstones created from ExpiringColumns.

          Currently tombstones will always stay a full gc_grace time, which is not neccessary for ExpiringColumns. We only need to ensure that ExpiringColumn and tombstone together live as long as gc_grace. If the ExpiringColumn's TTL>=gc_grace then we can create an already gcable tombstone and drop that instantly.

          My initial proposal was to use the ExpiringColumns creation-timestamp as deletiontime for the tombstone, but Sylvain pointed out that we should not mix local and client timestamps. So I changed it to this:
          {code}
          public static Column create(ByteBuffer name, ByteBuffer value, long timestamp, int timeToLive, int localExpirationTime, int expireBefore, IColumnSerializer.Flag flag)
          {
              if (localExpirationTime >= expireBefore || flag == IColumnSerializer.Flag.PRESERVE_SIZE)
                  return new ExpiringColumn(name, value, timestamp, timeToLive, localExpirationTime);
              // the column is now expired, we can safely return a simple tombstone
              return new DeletedColumn(name, localExpirationTime-timeToLive, timestamp);
              // return new DeletedColumn(name, localExpirationTime, timestamp); // old code
          }
          {code}


          This was discussed on the mailinglist: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/repair-compaction-and-tombstone-rows-td7583481.html
          Christian Spriegel made changes -
          Link This issue is related to CASSANDRA-4905 [ CASSANDRA-4905 ]
          Gavin made changes -
          Workflow no-reopen-closed, patch-avail [ 12732795 ] patch-available, re-open possible [ 12753661 ]
          Gavin made changes -
          Workflow patch-available, re-open possible [ 12753661 ] reopen-resolved, no closed status, patch-avail, testing [ 12758859 ]
          Jonathan Ellis made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Christian Spriegel [ christianmovi ]
          Reviewer slebresne
          Fix Version/s 2.0 [ 12322954 ]
          Resolution Fixed [ 1 ]
          Christian Spriegel made changes -
          Link This issue is related to CASSANDRA-5398 [ CASSANDRA-5398 ]
          Christian Spriegel made changes -
          Link This issue is related to CASSANDRA-2698 [ CASSANDRA-2698 ]

            People

            • Assignee:
              Christian Spriegel
              Reporter:
              Christian Spriegel
              Reviewer:
              Sylvain Lebresne
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development