xiangfu0 commented on code in PR #18380:
URL: https://github.com/apache/pinot/pull/18380#discussion_r3216770473
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -2081,6 +2098,57 @@ public boolean setZKData(String path, ZNRecord record,
int expectedVersion, int
return _helixDataAccessor.getBaseDataAccessor().set(path, record,
expectedVersion, accessOption);
}
+ /**
+ * Returns a fresh {@link ZkMultiWriteBuilder} for submitting an atomic
ZooKeeper {@code multi()}
+ * transaction over Helix property-store paths (set / create / delete /
version-check ops on any
+ * combination of property-store znodes). Either every op commits or none do.
+ * <p>Op paths are property-store-relative (e.g. {@code
/SEGMENTS/{table}/{segment}}); the builder
+ * prepends {@code /{cluster}/PROPERTYSTORE} before submitting to ZK.
Multi-path writes outside
+ * the property store are intentionally not supported.
+ * <p>Requires {@link #start} to have been called (so the ZK address is
reachable via the Helix
+ * manager); throws {@link IllegalStateException} otherwise.
+ * <p>The builder's {@code execute()} throws {@link
org.apache.zookeeper.KeeperException} on atomic
+ * rollback (the subtype identifies the cause: {@code BadVersionException},
{@code NoNodeException},
+ * {@code NodeExistsException}, ...). Connectivity / session failures
propagate as the original
+ * {@link org.apache.helix.zookeeper.zkclient.exception.ZkException}.
+ */
+ public ZkMultiWriteBuilder multiWriteZK() {
+ return new ZkMultiWriteBuilder(getOrBuildMultiWriteZkClient(),
+ PropertyPathBuilder.propertyStore(_helixClusterName));
+ }
+
+ private ZkClient getOrBuildMultiWriteZkClient() {
+ ZkClient c = _zkClient;
+ if (c != null) {
+ return c;
+ }
+ synchronized (this) {
+ if (_zkClient == null) {
+ Preconditions.checkState(_helixZkManager != null,
+ "multiWriteZK unavailable: PinotHelixResourceManager has not been
started");
+ String zkAddress = _helixZkManager.getMetadataStoreConnectionString();
+ int sessionTimeoutMs =
CommonConstants.Helix.ZkClient.DEFAULT_SESSION_TIMEOUT_MS;
Review Comment:
can sessionTimeoutMs and connectTimeoutMs configurable from the current zk
configure way, e.g. through system properties ?
--
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]