cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Add sanity checks
Date Wed, 24 Jul 2013 12:19:05 GMT
Updated Branches:
  refs/heads/cassandra-1.2 25a46eae5 -> 9ae960a1a


Add sanity checks


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

Branch: refs/heads/cassandra-1.2
Commit: 9ae960a1a4f57e3c9ec018f3cbb32fd3312d7a6e
Parents: 25a46ea
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Jul 24 14:18:57 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Jul 24 14:18:57 2013 +0200

----------------------------------------------------------------------
 .../db/index/AbstractSimplePerColumnSecondaryIndex.java         | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/9ae960a1/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
b/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
index 63af51b..2ff2d27 100644
--- a/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
+++ b/src/java/org/apache/cassandra/db/index/AbstractSimplePerColumnSecondaryIndex.java
@@ -94,7 +94,9 @@ public abstract class AbstractSimplePerColumnSecondaryIndex extends PerColumnSec
         DecoratedKey valueKey = getIndexKeyFor(column.value());
         int localDeletionTime = (int) (System.currentTimeMillis() / 1000);
         ColumnFamily cfi = ColumnFamily.create(indexCfs.metadata);
-        cfi.addTombstone(makeIndexColumnName(rowKey, column), localDeletionTime, column.timestamp());
+        ByteBuffer name = makeIndexColumnName(rowKey, column);
+        assert name.remaining() > 0 && name.remaining() <= IColumn.MAX_NAME_LENGTH
: name.remaining();
+        cfi.addTombstone(name, localDeletionTime, column.timestamp());
         indexCfs.apply(valueKey, cfi, SecondaryIndexManager.nullUpdater);
         if (logger.isDebugEnabled())
             logger.debug("removed index entry for cleaned-up value {}:{}", valueKey, cfi);
@@ -105,6 +107,7 @@ public abstract class AbstractSimplePerColumnSecondaryIndex extends PerColumnSec
         DecoratedKey valueKey = getIndexKeyFor(column.value());
         ColumnFamily cfi = ColumnFamily.create(indexCfs.metadata);
         ByteBuffer name = makeIndexColumnName(rowKey, column);
+        assert name.remaining() > 0 && name.remaining() <= IColumn.MAX_NAME_LENGTH
: name.remaining();
         if (column instanceof ExpiringColumn)
         {
             ExpiringColumn ec = (ExpiringColumn)column;


Mime
View raw message