Skip to content

Commit 54a6d81

Browse files
authored
Region Migration: Set default it to IoTV2 (apache#14294)
1 parent 790bc26 commit 54a6d81

21 files changed

+630
-45
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.iotdb.confignode.it.regionmigration;
21+
22+
import org.apache.iotdb.commons.utils.KillPoint.KillNode;
23+
import org.apache.iotdb.consensus.ConsensusFactory;
24+
import org.apache.iotdb.it.env.EnvFactory;
25+
26+
import org.junit.Before;
27+
28+
public class IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV1
29+
extends IoTDBRegionMigrateReliabilityITFramework {
30+
31+
@Override
32+
@Before
33+
public void setUp() throws Exception {
34+
super.setUp();
35+
EnvFactory.getEnv()
36+
.getConfig()
37+
.getCommonConfig()
38+
.setDataRegionConsensusProtocolClass(ConsensusFactory.IOT_CONSENSUS);
39+
}
40+
41+
@SafeVarargs
42+
public final <T extends Enum<T>> void success(T... dataNodeKillPoints) throws Exception {
43+
successTest(1, 1, 1, 2, noKillPoints(), buildSet(dataNodeKillPoints), KillNode.ALL_NODES);
44+
}
45+
}

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionMigrateDataNodeCrashITFramework.java renamed to integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV2.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121

2222
import org.apache.iotdb.commons.utils.KillPoint.KillNode;
2323

24-
public class IoTDBRegionMigrateDataNodeCrashITFramework
24+
public class IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV2
2525
extends IoTDBRegionMigrateReliabilityITFramework {
26+
2627
@SafeVarargs
2728
public final <T extends Enum<T>> void success(T... dataNodeKillPoints) throws Exception {
2829
successTest(1, 1, 1, 2, noKillPoints(), buildSet(dataNodeKillPoints), KillNode.ALL_NODES);

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/IoTDBRegionMigrateReliabilityITFramework.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ public class IoTDBRegionMigrateReliabilityITFramework {
9090
private static final String COUNT_TIMESERIES = "select count(*) from root.sg.**";
9191
private static final String REGION_MIGRATE_COMMAND_FORMAT = "migrate region %d from %d to %d";
9292
private static final String CONFIGURATION_FILE_NAME = "configuration.dat";
93-
protected final boolean isIoTV1 = true;
9493
ExecutorService executorService = IoTDBThreadPoolFactory.newCachedThreadPool("regionMigrateIT");
9594

9695
public static Consumer<KillPointContext> actionOfKillNode =
@@ -119,7 +118,7 @@ public void setUp() throws Exception {
119118
EnvFactory.getEnv()
120119
.getConfig()
121120
.getCommonConfig()
122-
.setDataRegionConsensusProtocolClass(ConsensusFactory.IOT_CONSENSUS)
121+
.setDataRegionConsensusProtocolClass(ConsensusFactory.IOT_CONSENSUS_V2)
123122
.setSchemaRegionConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS)
124123
.setConfigNodeConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
125124
}

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/IoTDBRegionMigrateNormalIT.java renamed to integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionMigrateNormalIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
package org.apache.iotdb.confignode.it.regionmigration.pass;
20+
package org.apache.iotdb.confignode.it.regionmigration.pass.commit;
2121

2222
import org.apache.iotdb.commons.utils.KillPoint.KillNode;
2323
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateReliabilityITFramework;

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/IoTDBRegionMigrateOtherIT.java renamed to integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionMigrateOtherIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
package org.apache.iotdb.confignode.it.regionmigration.pass;
20+
package org.apache.iotdb.confignode.it.regionmigration.pass.commit;
2121

2222
import org.apache.iotdb.commons.utils.KillPoint.KillNode;
2323
import org.apache.iotdb.commons.utils.KillPoint.NeverTriggeredKillPoint;

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/datanodecrash/IoTDBRegionMigrateCoordinatorCrashWhenRemoveRemotePeerIT.java renamed to integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/daily/datanodecrash/iotv1/IoTDBRegionMigrateCoordinatorCrashWhenRemoveRemotePeerForIoTV1IT.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
* under the License.
1818
*/
1919

20-
package org.apache.iotdb.confignode.it.regionmigration.pass.datanodecrash;
20+
package org.apache.iotdb.confignode.it.regionmigration.pass.daily.datanodecrash.iotv1;
2121

2222
import org.apache.iotdb.commons.utils.KillPoint.IoTConsensusRemovePeerCoordinatorKillPoints;
23-
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateDataNodeCrashITFramework;
23+
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV1;
2424
import org.apache.iotdb.it.framework.IoTDBTestRunner;
2525
import org.apache.iotdb.itbase.category.DailyIT;
2626

@@ -30,8 +30,8 @@
3030

3131
@Category({DailyIT.class})
3232
@RunWith(IoTDBTestRunner.class)
33-
public class IoTDBRegionMigrateCoordinatorCrashWhenRemoveRemotePeerIT
34-
extends IoTDBRegionMigrateDataNodeCrashITFramework {
33+
public class IoTDBRegionMigrateCoordinatorCrashWhenRemoveRemotePeerForIoTV1IT
34+
extends IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV1 {
3535

3636
@Test
3737
public void initCrash() throws Exception {
@@ -40,11 +40,8 @@ public void initCrash() throws Exception {
4040

4141
@Test
4242
public void crashAfterNotifyPeersToRemoveSyncLogChannel() throws Exception {
43-
if (isIoTV1) {
44-
success(
45-
IoTConsensusRemovePeerCoordinatorKillPoints
46-
.AFTER_NOTIFY_PEERS_TO_REMOVE_REPLICATE_CHANNEL);
47-
}
43+
success(
44+
IoTConsensusRemovePeerCoordinatorKillPoints.AFTER_NOTIFY_PEERS_TO_REMOVE_REPLICATE_CHANNEL);
4845
}
4946

5047
@Test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.iotdb.confignode.it.regionmigration.pass.daily.datanodecrash.iotv1;
21+
22+
import org.apache.iotdb.commons.utils.KillPoint.DataNodeKillPoints;
23+
import org.apache.iotdb.commons.utils.KillPoint.KillNode;
24+
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateReliabilityITFramework;
25+
import org.apache.iotdb.consensus.ConsensusFactory;
26+
import org.apache.iotdb.it.env.EnvFactory;
27+
import org.apache.iotdb.it.framework.IoTDBTestRunner;
28+
import org.apache.iotdb.itbase.category.DailyIT;
29+
30+
import org.junit.Before;
31+
import org.junit.Test;
32+
import org.junit.experimental.categories.Category;
33+
import org.junit.runner.RunWith;
34+
35+
@Category({DailyIT.class})
36+
@RunWith(IoTDBTestRunner.class)
37+
public class IoTDBRegionMigrateDataNodeCrashForIoTV1IT
38+
extends IoTDBRegionMigrateReliabilityITFramework {
39+
// region Coordinator DataNode crash tests
40+
41+
private final int dataReplicateFactor = 2;
42+
private final int schemaReplicationFactor = 2;
43+
private final int configNodeNum = 1;
44+
private final int dataNodeNum = 3;
45+
46+
@Override
47+
@Before
48+
public void setUp() throws Exception {
49+
super.setUp();
50+
EnvFactory.getEnv()
51+
.getConfig()
52+
.getCommonConfig()
53+
.setDataRegionConsensusProtocolClass(ConsensusFactory.IOT_CONSENSUS);
54+
}
55+
56+
@Test
57+
public void coordinatorCrashDuringAddPeerTransition() throws Exception {
58+
failTest(
59+
2,
60+
2,
61+
1,
62+
3,
63+
noKillPoints(),
64+
buildSet(DataNodeKillPoints.COORDINATOR_ADD_PEER_TRANSITION),
65+
KillNode.COORDINATOR_DATANODE);
66+
}
67+
68+
@Test
69+
public void coordinatorCrashDuringAddPeerDone() throws Exception {
70+
failTest(
71+
2,
72+
2,
73+
1,
74+
3,
75+
noKillPoints(),
76+
buildSet(DataNodeKillPoints.COORDINATOR_ADD_PEER_DONE),
77+
KillNode.COORDINATOR_DATANODE);
78+
}
79+
80+
// endregion ----------------------------------------------
81+
82+
// region Original DataNode crash tests
83+
84+
@Test
85+
public void originalCrashDuringAddPeerDone() throws Exception {
86+
failTest(
87+
2,
88+
2,
89+
1,
90+
3,
91+
noKillPoints(),
92+
buildSet(DataNodeKillPoints.ORIGINAL_ADD_PEER_DONE),
93+
KillNode.ORIGINAL_DATANODE);
94+
}
95+
96+
// endregion ----------------------------------------------
97+
98+
// region Destination DataNode crash tests
99+
100+
@Test
101+
public void destinationCrashDuringCreateLocalPeer() throws Exception {
102+
failTest(
103+
2,
104+
2,
105+
1,
106+
3,
107+
noKillPoints(),
108+
buildSet(DataNodeKillPoints.DESTINATION_CREATE_LOCAL_PEER),
109+
KillNode.DESTINATION_DATANODE);
110+
}
111+
112+
@Test
113+
public void destinationCrashDuringAddPeerTransition() throws Exception {
114+
failTest(
115+
2,
116+
2,
117+
1,
118+
3,
119+
noKillPoints(),
120+
buildSet(DataNodeKillPoints.DESTINATION_ADD_PEER_TRANSITION),
121+
KillNode.DESTINATION_DATANODE);
122+
}
123+
124+
@Test
125+
public void destinationCrashDuringAddPeerDone() throws Exception {
126+
failTest(
127+
2,
128+
2,
129+
1,
130+
3,
131+
noKillPoints(),
132+
buildSet(DataNodeKillPoints.DESTINATION_ADD_PEER_DONE),
133+
KillNode.DESTINATION_DATANODE);
134+
}
135+
136+
// endregion ----------------------------------------------
137+
}

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/datanodecrash/IoTDBRegionMigrateOriginalCrashWhenDeleteLocalPeerIT.java renamed to integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/daily/datanodecrash/iotv1/IoTDBRegionMigrateOriginalCrashWhenDeleteLocalPeerForIoTV1IT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
* under the License.
1818
*/
1919

20-
package org.apache.iotdb.confignode.it.regionmigration.pass.datanodecrash;
20+
package org.apache.iotdb.confignode.it.regionmigration.pass.daily.datanodecrash.iotv1;
2121

2222
import org.apache.iotdb.commons.utils.KillPoint.IoTConsensusDeleteLocalPeerKillPoints;
23-
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateDataNodeCrashITFramework;
23+
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV1;
2424
import org.apache.iotdb.it.framework.IoTDBTestRunner;
2525
import org.apache.iotdb.itbase.category.DailyIT;
2626

@@ -30,8 +30,8 @@
3030

3131
@Category({DailyIT.class})
3232
@RunWith(IoTDBTestRunner.class)
33-
public class IoTDBRegionMigrateOriginalCrashWhenDeleteLocalPeerIT
34-
extends IoTDBRegionMigrateDataNodeCrashITFramework {
33+
public class IoTDBRegionMigrateOriginalCrashWhenDeleteLocalPeerForIoTV1IT
34+
extends IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV1 {
3535
@Test
3636
public void crashBeforeDelete() throws Exception {
3737
success(IoTConsensusDeleteLocalPeerKillPoints.BEFORE_DELETE);

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/datanodecrash/IoTDBRegionMigrateOriginalCrashWhenRemoveRemotePeerIT.java renamed to integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/daily/datanodecrash/iotv1/IoTDBRegionMigrateOriginalCrashWhenRemoveRemotePeerForIoTV1IT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
* under the License.
1818
*/
1919

20-
package org.apache.iotdb.confignode.it.regionmigration.pass.datanodecrash;
20+
package org.apache.iotdb.confignode.it.regionmigration.pass.daily.datanodecrash.iotv1;
2121

2222
import org.apache.iotdb.commons.utils.KillPoint.IoTConsensusInactivatePeerKillPoints;
23-
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateDataNodeCrashITFramework;
23+
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV1;
2424
import org.apache.iotdb.it.framework.IoTDBTestRunner;
2525
import org.apache.iotdb.itbase.category.DailyIT;
2626

@@ -30,8 +30,8 @@
3030

3131
@Category({DailyIT.class})
3232
@RunWith(IoTDBTestRunner.class)
33-
public class IoTDBRegionMigrateOriginalCrashWhenRemoveRemotePeerIT
34-
extends IoTDBRegionMigrateDataNodeCrashITFramework {
33+
public class IoTDBRegionMigrateOriginalCrashWhenRemoveRemotePeerForIoTV1IT
34+
extends IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV1 {
3535
@Test
3636
public void crashBeforeInactivate() throws Exception {
3737
success(IoTConsensusInactivatePeerKillPoints.BEFORE_INACTIVATE);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.iotdb.confignode.it.regionmigration.pass.daily.datanodecrash.iotv2;
21+
22+
import org.apache.iotdb.commons.utils.KillPoint.IoTConsensusRemovePeerCoordinatorKillPoints;
23+
import org.apache.iotdb.confignode.it.regionmigration.IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV2;
24+
import org.apache.iotdb.it.framework.IoTDBTestRunner;
25+
import org.apache.iotdb.itbase.category.DailyIT;
26+
27+
import org.junit.Test;
28+
import org.junit.experimental.categories.Category;
29+
import org.junit.runner.RunWith;
30+
31+
@Category({DailyIT.class})
32+
@RunWith(IoTDBTestRunner.class)
33+
public class IoTDBRegionMigrateCoordinatorCrashWhenRemoveRemotePeerForIoTV2IT
34+
extends IoTDBRegionMigrateDataNodeCrashITFrameworkForIoTV2 {
35+
36+
@Test
37+
public void initCrash() throws Exception {
38+
success(IoTConsensusRemovePeerCoordinatorKillPoints.INIT);
39+
}
40+
41+
@Test
42+
public void crashAfterNotifyPeersToRemoveSyncLogChannel() throws Exception {
43+
success(
44+
IoTConsensusRemovePeerCoordinatorKillPoints.AFTER_NOTIFY_PEERS_TO_REMOVE_REPLICATE_CHANNEL);
45+
}
46+
47+
@Test
48+
public void crashAfterInactivePeer() throws Exception {
49+
success(IoTConsensusRemovePeerCoordinatorKillPoints.AFTER_INACTIVE_PEER);
50+
}
51+
52+
@Test
53+
public void crashAfterFinish() throws Exception {
54+
success(IoTConsensusRemovePeerCoordinatorKillPoints.FINISH);
55+
}
56+
}

0 commit comments

Comments
 (0)