nicktelford commented on code in PR #23999:
URL: https://github.com/apache/kafka/pull/23999#discussion_r4427957248


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBTransactionBuffer.java:
##########
@@ -135,16 +139,24 @@ void stageAll(final Runnable stagingOperations) {
     /**
      * Stages a range deletion for an explicit column family. Updates the 
shared
      * {@code pendingWrites} and {@code rangeTombstones} so iterators opened 
before
-     * commit hide the deleted range, and appends the range delete to the 
shared
-     * {@link WriteBatch} under {@code cf}.
+     * commit hide the deleted range, and records the range delete for {@code 
cf} so
+     * {@link #prepareFlush()} adds it to the {@link WriteBatch}.
      */
     void stageDeleteRange(final ColumnFamilyHandle cf, final Bytes from, final 
Bytes to) {
         snapshotLock.writeLock().lock();
         try {
             // Multi-node subMap().clear() on the (non-thread-safe) TreeMap 
staging buffer must hold
             // the write lock; doing it together with the rangeTombstones swap 
also makes the two
             // updates atomic with respect to a non-owner snapshot scan.
-            pendingWrites.subMap(from, true, to, false).clear();
+            final NavigableMap<Bytes, Optional<byte[]>> staged =
+                cf == cfHandle ? pendingWrites : otherCfWrites.get(cf);
+            if (staged != null) {

Review Comment:
   I believe `staged` can be `null` if no other writes have yet been staged for 
this `ColumnFamilyHandle`. The `otherCfWrites` maps are lazily initialized (see 
`stage`, line 109). This branch appears to wipe any "pending writes" in the 
range of the range delete. If no writes to this CF have been staged, then 
there's nothing to wipe, so it can be skipped.



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

Reply via email to