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


##########
src/java/org/apache/cassandra/index/sai/memory/VectorMemoryIndex.java:
##########
@@ -98,11 +97,11 @@ public synchronized long add(DecoratedKey key, 
Clustering<?> clustering, ByteBuf
 
     private long index(PrimaryKey primaryKey, ByteBuffer value)
     {
-        updateKeyBounds(primaryKey);
-
         writeCount.increment();
         primaryKeys.add(primaryKey);
-        return graph.add(value, primaryKey, 
OnHeapGraph.InvalidVectorBehavior.FAIL);
+        long bytesUsed = graph.add(value, primaryKey, 
OnHeapGraph.InvalidVectorBehavior.FAIL);

Review Comment:
   feel that its best to do `graph.add` *before* `primaryKeys.add`; the reason 
is for `orderBy()`, it tries to score a key not yet in the graph, if we update 
the graph first this race goes away?  It also keeps the publishing order 
consistent with key bounds?



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