|
@@ -22,13 +22,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
import static org.junit.jupiter.api.Assertions.fail;
|
|
import static org.junit.jupiter.api.Assertions.fail;
|
|
-import java.util.concurrent.CompletableFuture;
|
|
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
import org.apache.zookeeper.CreateMode;
|
|
import org.apache.zookeeper.CreateMode;
|
|
import org.apache.zookeeper.KeeperException;
|
|
import org.apache.zookeeper.KeeperException;
|
|
import org.apache.zookeeper.TestableZooKeeper;
|
|
import org.apache.zookeeper.TestableZooKeeper;
|
|
import org.apache.zookeeper.ZooDefs.Ids;
|
|
import org.apache.zookeeper.ZooDefs.Ids;
|
|
-import org.apache.zookeeper.ZooKeeper;
|
|
|
|
import org.apache.zookeeper.server.ZooKeeperServer;
|
|
import org.apache.zookeeper.server.ZooKeeperServer;
|
|
import org.apache.zookeeper.server.quorum.QuorumPeer.ServerState;
|
|
import org.apache.zookeeper.server.quorum.QuorumPeer.ServerState;
|
|
import org.apache.zookeeper.test.QuorumBase;
|
|
import org.apache.zookeeper.test.QuorumBase;
|
|
@@ -95,18 +93,6 @@ public class EagerACLFilterTest extends QuorumBase {
|
|
clientWatchB.waitForConnected(CONNECTION_TIMEOUT);
|
|
clientWatchB.waitForConnected(CONNECTION_TIMEOUT);
|
|
}
|
|
}
|
|
|
|
|
|
- void syncClient(ZooKeeper zk) {
|
|
|
|
- CompletableFuture<Void> synced = new CompletableFuture<>();
|
|
|
|
- zk.sync("/", (rc, path, ctx) -> {
|
|
|
|
- if (rc == 0) {
|
|
|
|
- synced.complete(null);
|
|
|
|
- } else {
|
|
|
|
- synced.completeExceptionally(KeeperException.create(KeeperException.Code.get(rc)));
|
|
|
|
- }
|
|
|
|
- }, null);
|
|
|
|
- synced.join();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@AfterEach
|
|
@AfterEach
|
|
public void tearDown() throws Exception {
|
|
public void tearDown() throws Exception {
|
|
if (zkClient != null) {
|
|
if (zkClient != null) {
|
|
@@ -124,7 +110,7 @@ public class EagerACLFilterTest extends QuorumBase {
|
|
ZooKeeperServer.setEnableEagerACLCheck(enabled);
|
|
ZooKeeperServer.setEnableEagerACLCheck(enabled);
|
|
}
|
|
}
|
|
|
|
|
|
- private void assertTransactionState(String operation, QuorumPeer peer, long lastxid) {
|
|
|
|
|
|
+ private void assertTransactionState(String operation, QuorumPeer peer, long lastxid) throws Exception {
|
|
if (peer == zkLeader && peer != zkConnected) {
|
|
if (peer == zkLeader && peer != zkConnected) {
|
|
// The operation is performed on no leader, but we are asserting on leader.
|
|
// The operation is performed on no leader, but we are asserting on leader.
|
|
// There is no happen-before between `zkLeader.getLastLoggedZxid()` and
|
|
// There is no happen-before between `zkLeader.getLastLoggedZxid()` and
|
|
@@ -133,7 +119,7 @@ public class EagerACLFilterTest extends QuorumBase {
|
|
// to sync leader client to go through commit and response path in leader to
|
|
// to sync leader client to go through commit and response path in leader to
|
|
// build happen-before between `zkLeader.getLastLoggedZxid()` and side effect
|
|
// build happen-before between `zkLeader.getLastLoggedZxid()` and side effect
|
|
// of previous operation.
|
|
// of previous operation.
|
|
- syncClient(zkLeaderClient);
|
|
|
|
|
|
+ syncClient(zkLeaderClient, false);
|
|
}
|
|
}
|
|
assertTrue(peer == zkLeader || peer == zkConnected);
|
|
assertTrue(peer == zkLeader || peer == zkConnected);
|
|
boolean eagerACL = ZooKeeperServer.isEnableEagerACLCheck();
|
|
boolean eagerACL = ZooKeeperServer.isEnableEagerACLCheck();
|