Merge branch 'cassandra-3.0' into cassandra-3.11

Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6d0e95af
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6d0e95af
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6d0e95af

Branch: refs/heads/cassandra-3.11
Commit: 6d0e95af7d68547bf07bf8961d5e8c1594acbf56
Parents: 7df942b a033f51
Author: Blake Eggleston <bdeggles...@gmail.com>
Authored: Fri Jul 14 10:37:01 2017 -0700
Committer: Blake Eggleston <bdeggles...@gmail.com>
Committed: Fri Jul 14 10:46:27 2017 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/cassandra/db/rows/AbstractCell.java  |  2 +-
 test/unit/org/apache/cassandra/db/CellTest.java | 78 +++++++++++++++++++-
 3 files changed, 79 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6d0e95af/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 87b058e,9962f4b..8abf1f4
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,8 -1,5 +1,9 @@@
 +3.11.1
 + * Duplicate the buffer before passing it to analyser in SASI operation 
(CASSANDRA-13512)
 + * Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
 +Merged from 3.0:
  3.0.15
+  * Purge tombstones created by expired cells (CASSANDRA-13643)
   * Make concat work with iterators that have different subsets of columns 
(CASSANDRA-13482)
   * Set test.runners based on cores and memory size (CASSANDRA-13078)
   * Allow different NUMACTL_ARGS to be passed in (CASSANDRA-13557)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6d0e95af/src/java/org/apache/cassandra/db/rows/AbstractCell.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/rows/AbstractCell.java
index ca83783,7e93c2e..54bd9e8
--- a/src/java/org/apache/cassandra/db/rows/AbstractCell.java
+++ b/src/java/org/apache/cassandra/db/rows/AbstractCell.java
@@@ -44,81 -40,6 +44,81 @@@ public abstract class AbstractCell exte
          super(column);
      }
  
 +    public boolean isCounterCell()
 +    {
 +        return !isTombstone() && column.cellValueType().isCounter();
 +    }
 +
 +    public boolean isLive(int nowInSec)
 +    {
 +        return localDeletionTime() == NO_DELETION_TIME || (ttl() != NO_TTL && 
nowInSec < localDeletionTime());
 +    }
 +
 +    public boolean isTombstone()
 +    {
 +        return localDeletionTime() != NO_DELETION_TIME && ttl() == NO_TTL;
 +    }
 +
 +    public boolean isExpiring()
 +    {
 +        return ttl() != NO_TTL;
 +    }
 +
 +    public Cell markCounterLocalToBeCleared()
 +    {
 +        if (!isCounterCell())
 +            return this;
 +
 +        ByteBuffer value = value();
 +        ByteBuffer marked = 
CounterContext.instance().markLocalToBeCleared(value);
 +        return marked == value ? this : new BufferCell(column, timestamp(), 
ttl(), localDeletionTime(), marked, path());
 +    }
 +
 +    public Cell purge(DeletionPurger purger, int nowInSec)
 +    {
 +        if (!isLive(nowInSec))
 +        {
 +            if (purger.shouldPurge(timestamp(), localDeletionTime()))
 +                return null;
 +
 +            // We slightly hijack purging to convert expired but not 
purgeable columns to tombstones. The reason we do that is
 +            // that once a column has expired it is equivalent to a tombstone 
but actually using a tombstone is more compact since
 +            // we don't keep the column value. The reason we do it here is 
that 1) it's somewhat related to dealing with tombstones
 +            // so hopefully not too surprising and 2) we want to this and 
purging at the same places, so it's simpler/more efficient
 +            // to do both here.
 +            if (isExpiring())
 +            {
 +                // Note that as long as the expiring column and the tombstone 
put together live longer than GC grace seconds,
 +                // we'll fulfil our responsibility to repair. See discussion 
at
 +                // 
http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/repair-compaction-and-tombstone-rows-td7583481.html
-                 return BufferCell.tombstone(column, timestamp(), 
localDeletionTime() - ttl(), path());
++                return BufferCell.tombstone(column, timestamp(), 
localDeletionTime() - ttl(), path()).purge(purger, nowInSec);
 +            }
 +        }
 +        return this;
 +    }
 +
 +    public Cell copy(AbstractAllocator allocator)
 +    {
 +        CellPath path = path();
 +        return new BufferCell(column, timestamp(), ttl(), 
localDeletionTime(), allocator.clone(value()), path == null ? null : 
path.copy(allocator));
 +    }
 +
 +    // note: while the cell returned may be different, the value is the same, 
so if the value is offheap it must be referenced inside a guarded context (or 
copied)
 +    public Cell updateAllTimestamp(long newTimestamp)
 +    {
 +        return new BufferCell(column, isTombstone() ? newTimestamp - 1 : 
newTimestamp, ttl(), localDeletionTime(), value(), path());
 +    }
 +
 +    public int dataSize()
 +    {
 +        CellPath path = path();
 +        return TypeSizes.sizeof(timestamp())
 +               + TypeSizes.sizeof(ttl())
 +               + TypeSizes.sizeof(localDeletionTime())
 +               + value().remaining()
 +               + (path == null ? 0 : path.dataSize());
 +    }
 +
      public void digest(MessageDigest digest)
      {
          digest.update(value().duplicate());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6d0e95af/test/unit/org/apache/cassandra/db/CellTest.java
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to