kaisun2000 commented on a change in pull request #789: Add FederatedZkClient
URL: https://github.com/apache/helix/pull/789#discussion_r385424428
##########
File path:
zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/FederatedZkClient.java
##########
@@ -20,344 +20,508 @@
*/
import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
+import org.apache.helix.msdcommon.datamodel.MetadataStoreRoutingData;
import org.apache.helix.zookeeper.api.client.RealmAwareZkClient;
+import org.apache.helix.zookeeper.impl.factory.DedicatedZkClientFactory;
import org.apache.helix.zookeeper.zkclient.DataUpdater;
import org.apache.helix.zookeeper.zkclient.IZkChildListener;
import org.apache.helix.zookeeper.zkclient.IZkDataListener;
+import org.apache.helix.zookeeper.zkclient.ZkConnection;
import org.apache.helix.zookeeper.zkclient.callback.ZkAsyncCallbacks;
-import org.apache.helix.zookeeper.zkclient.deprecated.IZkStateListener;
+import org.apache.helix.zookeeper.zkclient.IZkStateListener;
+import org.apache.helix.zookeeper.zkclient.serialize.BasicZkSerializer;
import org.apache.helix.zookeeper.zkclient.serialize.PathBasedZkSerializer;
import org.apache.helix.zookeeper.zkclient.serialize.ZkSerializer;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.Op;
import org.apache.zookeeper.OpResult;
+import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Implements and supports all ZK operations defined in interface {@link
RealmAwareZkClient},
+ * except for session-aware operations such as creating ephemeral nodes, for
which
+ * an {@link UnsupportedOperationException} will be thrown.
+ * <p>
+ * It acts as a single ZK client but will automatically route
read/write/change subscription
+ * requests to the corresponding ZkClient with the help of metadata store
directory service.
+ * It could connect to multiple ZK addresses and maintain a {@link ZkClient}
for each ZK address.
+ * <p>
+ * Note: while the ordering of handling data/child changes listeners in one
single ZK realm is
Review comment:
This has nothing to do with "order" or sequential consistency in Zookeeper
term. Let us don't confuse user with this consistency guarantee.
From the user's perspective, they need to be aware their callback listerner
can be invoked concurrently and should prepare to handle this concurrency
accordingly, which is not the case before. Something like:
Federated ZKClient is designed to perform CRUD operation across different
zookeeper realms. It would handle data and node change notification. It does
not support ephemeral node operation.
From concurrency point of view, the callback notification can be invoked
concurrently for ZK path in different zookeeper realm. This is different from
other ZkClient which will invoke the callback in one thread. Thus, it is the
user's responsibility to take care this concurrency.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]