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



##########
File path: test/unit/org/apache/cassandra/schema/SchemaKeyspaceTest.java
##########
@@ -183,8 +269,32 @@ public void testSchemaNoColumn()
                                     KeyspaceParams.simple(1),
                                     SchemaLoader.standardCFMD(testKS, 
testTable));
         // Delete all colmns in the schema
-        String query = String.format("DELETE FROM %s.%s WHERE keyspace_name=? 
and table_name=?", SchemaConstants.SCHEMA_KEYSPACE_NAME, 
SchemaKeyspace.COLUMNS);
+        String query = String.format("DELETE FROM %s.%s WHERE keyspace_name=? 
and table_name=?", SchemaConstants.SCHEMA_KEYSPACE_NAME, 
SystemKeyspaceConstants.COLUMNS);
         executeOnceInternal(query, testKS, testTable);
         SchemaKeyspace.fetchNonSystemKeyspaces();
     }
+
+    private void testMethodSynchronicity(Runnable method) throws Exception
+    {
+        ExecutorService pool = Executors.newFixedThreadPool(2);
+        CountDownLatch pendingStarts = new CountDownLatch(2);
+
+        threadBlock = new CountDownLatch(2);
+        pool.execute(() -> {
+            pendingStarts.countDown();
+            method.run();
+        });
+        pool.execute(() -> {
+            pendingStarts.countDown();
+            method.run();
+        });
+
+        // We have started 2 threads. 1 thread should be held by the latch 
threadBlock, the other should be held as
+        // proof of thread safety.
+        pendingStarts.await(10, TimeUnit.SECONDS);
+        Util.spinAssertEquals(1L, () -> threadBlock.getCount(), 10);
+
+        // Do not execute the tasks. Just kill it.
+        pool.shutdownNow();
+    }

Review comment:
       Outside the tests, everything LGTM




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