You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/05/18 09:26:53 UTC

[GitHub] [cassandra] blerer commented on a change in pull request #559: CASSANDRA-13666 Avoid rendering static 2i entries as stales and removing them

blerer commented on a change in pull request #559:
URL: https://github.com/apache/cassandra/pull/559#discussion_r426489932



##########
File path: src/java/org/apache/cassandra/index/internal/composites/CompositesSearcher.java
##########
@@ -231,16 +231,27 @@ private IndexEntry findEntry(Clustering clustering)
                 while (entriesIdx < entries.size())
                 {
                     IndexEntry entry = entries.get(entriesIdx++);
+                    Clustering indexedEntryClustering = entry.indexedEntryClustering;
                     // The entries are in clustering order. So that the requested entry should be the
                     // next entry, the one at 'entriesIdx'. However, we can have stale entries, entries
                     // that have no corresponding row in the base table typically because of a range
                     // tombstone or partition level deletion. Delete such stale entries.
-                    int cmp = comparator.compare(entry.indexedEntryClustering, clustering);
+                    int cmp = comparator.compare(indexedEntryClustering, clustering);
                     assert cmp <= 0; // this would means entries are not in clustering order, which shouldn't happen
                     if (cmp == 0)
                         return entry;
                     else
-                        staleEntries.add(entry);
+                    {
+                        boolean isStaticClustering = dataIter.metadata().hasStaticColumns();

Review comment:
       It is effectively a bit hard to read. I would have done something like:
   boolean hasStaticColumns = dataIter.metadata().hasStaticColumns();
   ```
   
   			// COMPACT COMPOSITE tables support null values in there clustering key but
                           // those tables do not support static columns. By consequence if a table
                           // has some static columns and all its clustering key elements are null
                           // it means that the partition exists and contains only static data 
                           if (!hasStaticColumns() || !containsOnlyNullValues(indexedEntryClustering) 
                                staleEntries.add(entry);
   ```
   What do you think?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org