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


##########
src/java/org/apache/cassandra/service/accord/CommandsForRanges.java:
##########
@@ -122,15 +130,54 @@ public NavigableMap<Timestamp, CommandSummaries.Summary> 
byTxnId()
         return this;
     }
 
-    public static class Manager implements AccordCache.Listener<TxnId, Command>
+    public static class Manager implements AccordCache.Listener<TxnId, 
Command>, Runnable
     {
+        static class IntervalTreeEdit extends IntrusiveStack<IntervalTreeEdit>
+        {
+            final TxnId txnId;
+            final @Nullable Object[] update, remove;
+
+            IntervalTreeEdit(TxnId txnId, Object[] update, Object[] remove)
+            {
+                this.txnId = txnId;
+                this.update = update;
+                this.remove = remove;
+            }
+
+            public static boolean push(IntervalTreeEdit edit, Manager manager)
+            {
+                return null == IntrusiveStack.getAndPush(pendingEditsUpdater, 
manager, edit);
+            }
+
+            public IntervalTreeEdit reverse()
+            {
+                return reverse(this);
+            }
+
+            boolean isSize(int size)
+            {
+                return IntrusiveStack.isSize(size, this);
+            }
+
+            IntervalTreeEdit merge(IntervalTreeEdit next)
+            {
+                Invariants.require(this.txnId.equals(next.txnId));
+                Object[] remove = this.remove == null ? next.remove : 
next.remove == null ? this.remove : IntervalBTree.update(this.remove, 
next.remove, COMPARATORS);
+                return new IntervalTreeEdit(txnId, next.update, remove);

Review Comment:
   don't merge `update` as the assumption this is the side effect of a txn, so 
another update coming after the fact doesn't make sense?



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