Skip to content

Commit 89c2af8

Browse files
authored
Cancel that submit the DataPartitionTableIntegrityCheckProcedure when ConfigNode start up. (#17506)
1 parent 14c27bb commit 89c2af8

File tree

1 file changed

+1
-64
lines changed
  • iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service

1 file changed

+1
-64
lines changed

iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import org.apache.iotdb.common.rpc.thrift.TSStatus;
2525
import org.apache.iotdb.commons.ServerCommandLine;
2626
import org.apache.iotdb.commons.client.ClientManagerMetrics;
27-
import org.apache.iotdb.commons.cluster.NodeStatus;
28-
import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
2927
import org.apache.iotdb.commons.concurrent.ThreadModule;
3028
import org.apache.iotdb.commons.concurrent.ThreadName;
3129
import org.apache.iotdb.commons.concurrent.ThreadPoolMetrics;
@@ -55,7 +53,6 @@
5553
import org.apache.iotdb.confignode.manager.consensus.ConsensusManager;
5654
import org.apache.iotdb.confignode.manager.pipe.agent.PipeConfigNodeAgent;
5755
import org.apache.iotdb.confignode.manager.pipe.metric.PipeConfigNodeMetrics;
58-
import org.apache.iotdb.confignode.procedure.impl.partition.DataPartitionTableIntegrityCheckProcedure;
5956
import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterReq;
6057
import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeRegisterResp;
6158
import org.apache.iotdb.confignode.rpc.thrift.TNodeVersionInfo;
@@ -82,9 +79,6 @@
8279
import java.util.Arrays;
8380
import java.util.List;
8481
import java.util.Set;
85-
import java.util.concurrent.ExecutionException;
86-
import java.util.concurrent.ExecutorService;
87-
import java.util.concurrent.Future;
8882
import java.util.concurrent.TimeUnit;
8983

9084
public class ConfigNode extends ServerCommandLine implements ConfigNodeMBean {
@@ -116,11 +110,6 @@ public class ConfigNode extends ServerCommandLine implements ConfigNodeMBean {
116110

117111
private int exitStatusCode = 0;
118112

119-
private Future<Void> dataPartitionTableCheckFuture;
120-
121-
private ExecutorService dataPartitionTableCheckExecutor =
122-
IoTDBThreadPoolFactory.newSingleThreadExecutor("DATA_PARTITION_TABLE_CHECK");
123-
124113
public ConfigNode() {
125114
super("ConfigNode");
126115
// We do not init anything here, so that we can re-initialize the instance in IT.
@@ -158,15 +147,6 @@ protected void start() throws IoTDBException {
158147
}
159148
active();
160149
LOGGER.info("IoTDB started");
161-
if (dataPartitionTableCheckFuture != null) {
162-
try {
163-
dataPartitionTableCheckFuture.get();
164-
} catch (ExecutionException | InterruptedException e) {
165-
LOGGER.error("Data partition table check task execute failed", e);
166-
} finally {
167-
dataPartitionTableCheckExecutor.shutdownNow();
168-
}
169-
}
170150
}
171151

172152
@Override
@@ -195,10 +175,7 @@ public void active() {
195175
int configNodeId = CONF.getConfigNodeId();
196176
configManager.initConsensusManager();
197177
upgrade();
198-
TConfigNodeLocation leaderNodeLocation = waitForLeaderElected();
199-
if (leaderNodeLocation == null) {
200-
leaderNodeLocation = configManager.getConsensusManager().getNotNullLeaderLocation();
201-
}
178+
waitForLeaderElected();
202179
setUpMetricService();
203180
// Notice: We always set up Seed-ConfigNode's RPC service lastly to ensure
204181
// that the external service is not provided until ConfigNode is fully available
@@ -226,46 +203,6 @@ public void active() {
226203
}
227204
loadSecretKey();
228205
loadHardwareCode();
229-
230-
/* After the ConfigNode leader election, a leader switch may occur, which could cause the procedure not to be created. This can happen if the original leader has not yet executed the procedure creation, while the other followers have already finished starting up. Therefore, having the original leader (before the leader switch) initiate the process ensures that only one procedure will be created. */
231-
if (leaderNodeLocation.getConfigNodeId() == configNodeId) {
232-
if (!configManager
233-
.getProcedureManager()
234-
.isExistUnfinishedProcedure(DataPartitionTableIntegrityCheckProcedure.class)) {
235-
dataPartitionTableCheckFuture =
236-
dataPartitionTableCheckExecutor.submit(
237-
() -> {
238-
LOGGER.info(
239-
"[DataPartitionIntegrity] Prepare to start dataPartitionTableIntegrityCheck after all datanodes started up");
240-
Thread.sleep(CONF.getPartitionTableRecoverWaitAllDnUpTimeoutInMs());
241-
242-
while (true) {
243-
List<Integer> dnList =
244-
configManager
245-
.getLoadManager()
246-
.filterDataNodeThroughStatus(NodeStatus.Running);
247-
if (dnList != null && !dnList.isEmpty()) {
248-
LOGGER.info("Starting dataPartitionTableIntegrityCheck...");
249-
TSStatus status =
250-
configManager
251-
.getProcedureManager()
252-
.dataPartitionTableIntegrityCheck();
253-
if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
254-
LOGGER.error(
255-
"Data partition table integrity check failed! Current status code is {}, status message is {}",
256-
status.getCode(),
257-
status.getMessage());
258-
}
259-
break;
260-
} else {
261-
LOGGER.info("No running datanodes found, waiting...");
262-
Thread.sleep(5000);
263-
}
264-
}
265-
return null;
266-
});
267-
}
268-
}
269206
return;
270207
} else {
271208
saveSecretKey();

0 commit comments

Comments
 (0)