smiklosovic commented on code in PR #2793:
URL: https://github.com/apache/cassandra/pull/2793#discussion_r1356655850


##########
src/java/org/apache/cassandra/schema/Schema.java:
##########
@@ -496,25 +496,43 @@ public Optional<Function> findFunction(FunctionName name, 
List<AbstractType<?>>
     /* Version control */
 
     /**
-     * @return current schema version
+     * Returns the current schema version. Although, if the schema is being 
updated while the method was called, it
+     * can return a stale version which does not correspond to the current 
keyspaces metadata. It is because the schema
+     * version is unknown for the partially applied changes and is updated 
after the entire schema change is applied.
+     * @see #getVersionSync()
      */
     public UUID getVersion()
     {
         return version;
     }
 
+    /**
+     * Returns the current schema version. If the schema is in the middle of 
the update, the method will wait until
+     * the update is completed and return the new version.
+     */
+    public synchronized UUID getVersionSync()
+    {
+        return version;
+    }
+
     /**
      * Checks whether the given schema version is the same as the current 
local schema.
+     * <p>
+     * @deprecated please use {@link #getVersionSync()} or {@link 
#getVersion()} depending on the use case
      */
-    public boolean isSameVersion(UUID schemaVersion)
+    @Deprecated(since = "4.1", forRemoval = true)

Review Comment:
   :1st_place_medal: 



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