dcapwell commented on code in PR #3798:
URL: https://github.com/apache/cassandra/pull/3798#discussion_r1919363924


##########
src/java/org/apache/cassandra/service/accord/AccordSegmentCompactor.java:
##########
@@ -144,11 +145,24 @@ public Collection<StaticSegment<JournalKey, V>> 
compact(Collection<StaticSegment
         }
     }
 
+    private JournalKey prevKey;
+    private DecoratedKey prevDecoratedKey;
+
     private void maybeWritePartition(SSTableTxnWriter writer, JournalKey key, 
Object builder, FlyweightSerializer<Object, Object> serializer, long 
descriptor, int offset) throws IOException
     {
         if (builder != null)
         {
-            SimpleBuilder partitionBuilder = 
PartitionUpdate.simpleBuilder(cfs.metadata(), 
AccordKeyspace.JournalColumns.decorate(key));
+            DecoratedKey decoratedKey = 
AccordKeyspace.JournalColumns.decorate(key);
+
+            if (prevKey != null)
+            {
+                
Invariants.checkArgument((decoratedKey.compareTo(prevDecoratedKey) >= 0 ? 1 : 
-1) == (JournalKey.SUPPORT.compare(key, prevKey) >= 0 ? 1 : -1),
+                                         String.format("Sort mismatch for\n%s 
(%s) \n%s (%s) ", key, decoratedKey, prevKey, prevDecoratedKey));

Review Comment:
   we spoke about this in slack, but the error msg doesn't seem to reflect what 
its doing...  sort mismatch could imply that the input data was written in the 
wrong order... but what this is saying is that the partition column and the 
journal key differ, which is a big correctness issue if this ever happens... 
maybe something like
   
   > partition key and journal key didn't have matching order, this implies a 
serialization issue



-- 
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: pr-unsubscr...@cassandra.apache.org

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


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

Reply via email to