You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/04/23 03:55:26 UTC

[GitHub] [druid] licl2014 commented on a change in pull request #5001: Fix removeDataSource() and removeSegment() of SQLMetadataSegmentManager

licl2014 commented on a change in pull request #5001:
URL: https://github.com/apache/druid/pull/5001#discussion_r413489633



##########
File path: server/src/main/java/io/druid/metadata/SQLMetadataSegmentManager.java
##########
@@ -144,26 +142,35 @@ public void run()
           delay.getMillis(),
           TimeUnit.MILLISECONDS
       );
-      started = true;
+      lifecycleLock.started();
+    }
+    finally {
+      lifecycleLock.exitStart();
     }
   }
 
   @Override
   @LifecycleStop
   public void stop()
   {
-    synchronized (lock) {
-      if (!started) {
-        return;
-      }
+    if (!lifecycleLock.canStop()) {
+      return;
+    }
+    try {
+      final ConcurrentHashMap<String, DruidDataSource> emptyMap = new ConcurrentHashMap<>();
+      ConcurrentHashMap<String, DruidDataSource> current;
+      do {
+        current = dataSourcesRef.get();

Review comment:
       `current=dataSourcesRef.get()` could be called as soon as the `poll`  function is entered?here, there is no guarantee that `dataSourcesRef`  is safe. it may be updated in `for loop` above. @jihoonson @gianm @jon-wei 




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org