helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [2/2] helix git commit: Make map in NotificationContext synchronized
Date Mon, 15 May 2017 18:38:45 GMT
Make map in NotificationContext synchronized

One issue we observed is that when batch messages enabled, it will have NPE in ZNRecord merge
record.
Race condition could be the root cause. The only place can have race condition is the current
state update map in NotificationContext, which is passed as input for multiple sub tasks in
BatchMessageHandler.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/173065e3
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/173065e3
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/173065e3

Branch: refs/heads/helix-0.6.x
Commit: 173065e3a4e5af6f6d0d9b2cf5112ff61b980adb
Parents: 7fc4a8a
Author: Junkai Xue <jxue@linkedin.com>
Authored: Fri May 12 11:49:01 2017 -0700
Committer: Junkai Xue <jxue@linkedin.com>
Committed: Fri May 12 11:49:01 2017 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/helix/NotificationContext.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/173065e3/helix-core/src/main/java/org/apache/helix/NotificationContext.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/NotificationContext.java b/helix-core/src/main/java/org/apache/helix/NotificationContext.java
index a67cae9..ae1e965 100644
--- a/helix-core/src/main/java/org/apache/helix/NotificationContext.java
+++ b/helix-core/src/main/java/org/apache/helix/NotificationContext.java
@@ -21,6 +21,7 @@ package org.apache.helix;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * Metadata associated with a notification event and the current state of the cluster
@@ -64,7 +65,7 @@ public class NotificationContext {
    */
   public NotificationContext(HelixManager manager) {
     _manager = manager;
-    _map = new HashMap<String, Object>();
+    _map = new ConcurrentHashMap<String, Object>();
   }
 
   /**


Mime
View raw message