maedhroz commented on a change in pull request #1221:
URL: https://github.com/apache/cassandra/pull/1221#discussion_r727686236



##########
File path: src/java/org/apache/cassandra/schema/Schema.java
##########
@@ -85,25 +85,34 @@ private Schema()
      * 
      * See CASSANDRA-16856/16996. Make sure schema pulls are synchronized to 
prevent concurrent schema pull/writes
      */
-    public static synchronized void saveSystemKeyspace()
+    public static void saveSystemKeyspace()
     {
-        SchemaKeyspace.saveSystemKeyspacesSchema();
+        synchronized(instance)
+        {
+            SchemaKeyspace.saveSystemKeyspacesSchema();
+        }
     }
 
     /**
      * See CASSANDRA-16856/16996. Make sure schema pulls are synchronized to 
prevent concurrent schema pull/writes
      */
-    public static synchronized void truncateSystemKeyspace()
+    public static void truncateSystemKeyspace()
     {
-        SchemaKeyspace.truncate();
+        synchronized(instance)
+        {
+            SchemaKeyspace.truncate();
+        }
     }
 
     /**
      * See CASSANDRA-16856/16996. Make sure schema pulls are synchronized to 
prevent concurrent schema pull/writes
      */
-    public static synchronized Collection<Mutation> schemaKeyspaceAsMutations()
+    public static Collection<Mutation> schemaKeyspaceAsMutations()
     {
-        return SchemaKeyspace.convertSchemaToMutations();
+        synchronized(instance)
+        {
+            return SchemaKeyspace.convertSchemaToMutations();
+        }

Review comment:
       nit: It seems like it would be much less invasive to leave the 
`synchronized` keyword in the method signatures and make them instance methods 
(then access via `Schema.instance` like the existing synchronized methods)?




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