This is an automated email from the ASF dual-hosted git repository.

slebresne pushed a commit to branch cassandra-3.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-3.0 by this push:
     new f106ef0  Fix invalid cell value skipping when reading from disk
f106ef0 is described below

commit f106ef0697e172492b0343462c593edb703f2ac8
Author: jacek-lewandowski <[email protected]>
AuthorDate: Thu Oct 22 22:36:24 2020 +0200

    Fix invalid cell value skipping when reading from disk
    
    patch by Jacek Lewandowski; reviewed by Sylvain Lebresne for CASSANDRA-16223
---
 CHANGES.txt                                                 |  1 +
 .../apache/cassandra/cql3/statements/SelectStatement.java   | 13 ++++++++++---
 .../cassandra/cql3/validation/ThriftIntegrationTest.java    |  4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index bfc0a81..80f5d58 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.23:
+ * Fix invalid cell value skipping when reading from disk (CASSANDRA-16223)
  * Prevent invoking enable/disable gossip when not in NORMAL (CASSANDRA-16146)
  * Fix OOM when terminating repair session (CASSANDRA-15902)
  * Avoid marking shutting down nodes as up after receiving gossip shutdown 
message (CASSANDRA-16094)
diff --git a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java 
b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 30c4458..046cc93 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -514,12 +514,12 @@ public class SelectStatement implements CQLStatement
         // Note that we use the total limit for every key, which is 
potentially inefficient.
         // However, IN + LIMIT is not a very sensible choice.
         List<SinglePartitionReadCommand> commands = new 
ArrayList<>(keys.size());
+        ColumnFilter columnFilter = createColumnFilter(options);
         for (ByteBuffer key : keys)
         {
             QueryProcessor.validateKey(key);
             DecoratedKey dk = cfm.decorateKey(ByteBufferUtil.clone(key));
-            ColumnFilter cf = (cfm.isSuper() && cfm.isDense()) ? 
SuperColumnCompatibility.getColumnFilter(cfm, options, 
restrictions.getSuperColumnRestrictions()) : queriedColumns;
-            commands.add(SinglePartitionReadCommand.create(cfm, nowInSec, cf, 
rowFilter, limit, dk, filter));
+            commands.add(SinglePartitionReadCommand.create(cfm, nowInSec, 
columnFilter, rowFilter, limit, dk, filter));
         }
 
         return new SinglePartitionReadCommand.Group(commands, limit);
@@ -581,7 +581,7 @@ public class SelectStatement implements CQLStatement
             return ReadQuery.EMPTY;
 
         PartitionRangeReadCommand command =
-            PartitionRangeReadCommand.create(false, cfm, nowInSec, 
queriedColumns, rowFilter, limit, new DataRange(keyBounds, 
clusteringIndexFilter));
+            PartitionRangeReadCommand.create(false, cfm, nowInSec, 
createColumnFilter(options), rowFilter, limit, new DataRange(keyBounds, 
clusteringIndexFilter));
 
         // If there's a secondary index that the command can use, have it 
validate the request parameters.
         command.maybeValidateIndex();
@@ -870,6 +870,13 @@ public class SelectStatement implements CQLStatement
         Collections.sort(cqlRows.rows, orderingComparator);
     }
 
+    private ColumnFilter createColumnFilter(QueryOptions options)
+    {
+        return (cfm.isSuper() && cfm.isDense())
+               ? SuperColumnCompatibility.getColumnFilter(cfm, options, 
restrictions.getSuperColumnRestrictions())
+               : queriedColumns;
+    }
+
     public static class RawStatement extends CFStatement
     {
         public final Parameters parameters;
diff --git 
a/test/unit/org/apache/cassandra/cql3/validation/ThriftIntegrationTest.java 
b/test/unit/org/apache/cassandra/cql3/validation/ThriftIntegrationTest.java
index def489e..7741b80 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/ThriftIntegrationTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/ThriftIntegrationTest.java
@@ -936,7 +936,7 @@ public class ThriftIntegrationTest extends ThriftCQLTester
 
     private void flushAll()
     {
-        for (String cfName : new String[]{ currentTable(), 
currentSparseTable(), currentCounterTable() })
-            Keyspace.open(KEYSPACE).getColumnFamilyStore(cfName);
+        for (String cfName : new String[]{ currentTable(), 
currentSparseTable(), currentCounterTable(), currentDenseTable() })
+            
Keyspace.open(KEYSPACE).getColumnFamilyStore(cfName).forceBlockingFlush();
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to