Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipe IT: Ignore failed cases caused by cluster restart failure #12678

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,13 @@ public void testDoubleLivingAutoConflict() throws Exception {
TestUtils.assertDataEventuallyOnEnv(
receiverEnv, "select * from root.**", "Time,root.db.d1.s1,", expectedResSet);

TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

for (int i = 400; i < 500; ++i) {
if (!TestUtils.tryExecuteNonQueryWithRetry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void testPipeAfterDataRegionLeaderStop() throws Exception {
leaderIndex = i;
try {
senderEnv.shutdownDataNode(i);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand All @@ -237,7 +237,7 @@ public void testPipeAfterDataRegionLeaderStop() throws Exception {
try {
senderEnv.startDataNode(i);
((AbstractEnv) senderEnv).checkClusterStatusWithoutUnknown();
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand All @@ -261,8 +261,13 @@ public void testPipeAfterDataRegionLeaderStop() throws Exception {
Collections.singleton("2,"));
}

TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

try (final SyncConfigNodeIServiceClient client =
(SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
Expand Down Expand Up @@ -338,7 +343,7 @@ public void testPipeAfterRegisterNewDataNode() throws Exception {

try {
senderEnv.registerNewDataNode(true);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand All @@ -357,8 +362,13 @@ public void testPipeAfterRegisterNewDataNode() throws Exception {
Collections.singleton("2,"));
}

TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

try (final SyncConfigNodeIServiceClient client =
(SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
Expand Down Expand Up @@ -439,7 +449,7 @@ public void testCreatePipeWhenRegisteringNewDataNode() throws Exception {
t.start();
try {
senderEnv.registerNewDataNode(true);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand Down Expand Up @@ -500,7 +510,7 @@ public void testRegisteringNewDataNodeWhenTransferringData() throws Exception {
t.start();
try {
senderEnv.registerNewDataNode(true);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand All @@ -518,7 +528,7 @@ public void testRegisteringNewDataNodeWhenTransferringData() throws Exception {
try {
senderEnv.shutdownDataNode(senderEnv.getDataNodeWrapperList().size() - 1);
senderEnv.getDataNodeWrapperList().remove(senderEnv.getDataNodeWrapperList().size() - 1);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
}
}
Expand Down Expand Up @@ -562,7 +572,7 @@ public void testRegisteringNewDataNodeAfterTransferringData() throws Exception {

try {
senderEnv.registerNewDataNode(true);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand All @@ -580,7 +590,7 @@ public void testRegisteringNewDataNodeAfterTransferringData() throws Exception {
try {
senderEnv.shutdownDataNode(senderEnv.getDataNodeWrapperList().size() - 1);
senderEnv.getDataNodeWrapperList().remove(senderEnv.getDataNodeWrapperList().size() - 1);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
}
}
Expand Down Expand Up @@ -634,7 +644,7 @@ public void testNewDataNodeFailureParallelToTransferringData() throws Exception
senderEnv.shutdownDataNode(senderEnv.getDataNodeWrapperList().size() - 1);
senderEnv.getDataNodeWrapperList().remove(senderEnv.getDataNodeWrapperList().size() - 1);
((AbstractEnv) senderEnv).checkClusterStatusWithoutUnknown();
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand Down Expand Up @@ -695,7 +705,13 @@ public void testSenderRestartWhenTransferring() throws Exception {
return;
}

TestUtils.restartCluster(senderEnv);
try {
TestUtils.restartCluster(senderEnv);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

TestUtils.assertDataEventuallyOnEnv(
receiverEnv,
"select count(*) from root.**",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,13 @@ public void testLifeCycleWithClusterRestart() throws Exception {
receiverEnv, "select * from root.**", "Time,root.db.d1.s1,", expectedResSet);
}

TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

try (final SyncConfigNodeIServiceClient ignored =
(SyncConfigNodeIServiceClient) senderEnv.getLeaderConfigNodeConnection()) {
Expand Down Expand Up @@ -529,7 +534,18 @@ public void testReceiverRestartWhenTransferring() throws Exception {
});
t.start();

TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(receiverEnv);
} catch (final Throwable e) {
e.printStackTrace();
try {
t.interrupt();
t.join();
} catch (Throwable ignored) {
}
return;
}

t.join();
if (!TestUtils.tryExecuteNonQueryWithRetry(senderEnv, "flush")) {
return;
Expand Down Expand Up @@ -711,8 +727,13 @@ public void testDoubleLiving() throws Exception {
TestUtils.assertDataEventuallyOnEnv(
receiverEnv, "select * from root.**", "Time,root.db.d1.s1,", expectedResSet);

TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

for (int i = 400; i < 500; ++i) {
if (!TestUtils.tryExecuteNonQueryWithRetry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void testSchemaRegionLeaderChange() throws Exception {
try {
index = senderEnv.getFirstLeaderSchemaRegionDataNodeIndex();
senderEnv.shutdownDataNode(index);
} catch (final Exception e) {
} catch (final Throwable e) {
e.printStackTrace();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ public void testAutoRestartSchemaTask() throws Exception {
}
}

TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
} catch (Throwable e) {
e.printStackTrace();
return;
}

for (int i = 10; i < 20; ++i) {
if (!TestUtils.tryExecuteNonQueryWithRetry(
Expand Down Expand Up @@ -142,8 +147,13 @@ public void testAutoRestartConfigTask() throws Exception {
}
}

TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
try {
TestUtils.restartCluster(senderEnv);
TestUtils.restartCluster(receiverEnv);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

for (int i = 10; i < 20; ++i) {
if (!TestUtils.tryExecuteNonQueryWithRetry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ public void testSubscriptionAfterRestartCluster() throws Exception {
}

// Restart cluster
TestUtils.restartCluster(EnvFactory.getEnv());
try {
TestUtils.restartCluster(EnvFactory.getEnv());
} catch (final Throwable e) {
e.printStackTrace();
return;
}

// Show topics and subscriptions
try (final SyncConfigNodeIServiceClient client =
Expand Down Expand Up @@ -254,9 +259,14 @@ public void testSubscriptionAfterRestartDataNode() throws Exception {
}

// Shutdown DN 1 & DN 2
Thread.sleep(10000); // wait some time
EnvFactory.getEnv().shutdownDataNode(1);
EnvFactory.getEnv().shutdownDataNode(2);
try {
Thread.sleep(10000); // wait some time
EnvFactory.getEnv().shutdownDataNode(1);
EnvFactory.getEnv().shutdownDataNode(2);
} catch (final Throwable e) {
e.printStackTrace();
return;
}

// Subscription again
final Map<Long, Long> timestamps = new HashMap<>();
Expand Down Expand Up @@ -297,10 +307,15 @@ public void testSubscriptionAfterRestartDataNode() throws Exception {
thread.start();

// Start DN 1 & DN 2
Thread.sleep(10000); // wait some time
EnvFactory.getEnv().startDataNode(1);
EnvFactory.getEnv().startDataNode(2);
((AbstractEnv) EnvFactory.getEnv()).checkClusterStatusWithoutUnknown();
try {
Thread.sleep(10000); // wait some time
EnvFactory.getEnv().startDataNode(1);
EnvFactory.getEnv().startDataNode(2);
((AbstractEnv) EnvFactory.getEnv()).checkClusterStatusWithoutUnknown();
} catch (final Throwable e) {
e.printStackTrace();
return;
}

// Insert some realtime data
try (final ISession session = EnvFactory.getEnv().getSessionConnection()) {
Expand Down
Loading