blambov commented on code in PR #4748:
URL: https://github.com/apache/cassandra/pull/4748#discussion_r3110835506


##########
src/java/org/apache/cassandra/io/sstable/SSTableCursorWriter.java:
##########
@@ -596,8 +600,10 @@ private void addIndexBlock(long endOfRowPosition, long 
indexBlockSize) throws IO
         /** {@link 
org.apache.cassandra.io.sstable.IndexInfo.Serializer#serialize(org.apache.cassandra.io.sstable.IndexInfo,
 org.apache.cassandra.io.util.DataOutputPlus)}*/
         rowIndexEntriesOffsets.addInt(rowIndexEntryOffset);
 
-        // first clustering is already in, write last entry
-        if (rowIndexEntryLastClustering.clusteringLength() == 0) {
+        // First clustering is already in, so write last entry, but 
differentiate between only one clustering being
+        // written and a clustering with no bytes being written.
+        if (!lastClusteringEmpty && 
rowIndexEntryLastClustering.clusteringLength() == 0)

Review Comment:
   If the condition here is to not have added a last entry, why not simplify 
things by making a boolean that tracks that? One that is set to true 
unconditionally on L572, which will also remove the need to check 
`clusteringLength` in both places.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to