jacek-lewandowski commented on code in PR #2713:
URL: https://github.com/apache/cassandra/pull/2713#discussion_r1336214126


##########
src/java/org/apache/cassandra/cql3/statements/DescribeStatement.java:
##########
@@ -132,8 +132,13 @@ public final ResultMessage execute(QueryState state, 
QueryOptions options, long
     @Override
     public ResultMessage executeLocally(QueryState state, QueryOptions options)
     {
-        Keyspaces keyspaces = Schema.instance.distributedAndLocalKeyspaces();
-        UUID schemaVersion = Schema.instance.getVersion();
+        UUID schemaVersion;
+        Keyspaces keyspaces;
+        do
+        {
+            schemaVersion = Schema.instance.getVersion();

Review Comment:
   The error was not coming from this place - this is a bug I discovered while 
inspecting the code. Although the update of version and list of keyspaces is 
synchronized, they are not updated atomically. In particular, while the list of 
keyspaces is updated incrementally with each added/modified/dropped keyspace, 
the version is updated at the of the entire schema transformation. It is 
because we do not know the intermediate schema versions, and also for the 
performance reasons.
   
   Therefore, this simple loop ensures that the schema did not change while we 
requested list of keyspaces. In other words, schema version and the keyspaces 
match.
   



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