mgao0 commented on code in PR #2328:
URL: https://github.com/apache/helix/pull/2328#discussion_r1056688265
##########
helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiZkHelixJavaApis.java:
##########
@@ -72,7 +78,7 @@
* cluster-Zk realm routing information.
* This test verifies that all Helix Java APIs work as expected.
*/
-public class TestMultiZkHelixJavaApis extends TestMultiZkConnectionConfig {
+public abstract class TestMultiZkHelixJavaApis extends
TestMultiZkConnectionConfig {
Review Comment:
Could you please explain what is the purpose of making this class abstract?
##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/FederatedZkClient.java:
##########
@@ -477,10 +477,31 @@ public long getCreationTime(String path) {
return getZkClient(path).getCreationTime(path);
}
+ /**
+ * Executes ZkMulti on operations that are connected to the same Zk server.
+ * Will throw exception if any operation's server connection is different.
+ * @param ops
+ * @return
+ * @throws IllegalArgumentException
+ */
@Override
public List<OpResult> multi(Iterable<Op> ops) {
- throwUnsupportedOperationException();
- return null;
+ if (ops == null) {
+ throw new NullPointerException("ops must not be null.");
+ }
+ String opPath = null;
+ String opPathRealm = null;
+ for (Op op : ops) {
Review Comment:
I'll suggest to implement this logic like this
`realms = ops.stream()
.map(op -> getZkRealm(op.getPath()))
.distinct()
.collect(toList());`
`if (realms.size() == 1) {
....
} else {
....
}`
This might be a cleaner solution from the code aspect, but your
implementation maybe able to fail early if there are different realms. Just a
thought, you can think about the trade-offs.
--
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]