zerolbsony commented on code in PR #17279:
URL: https://github.com/apache/iotdb/pull/17279#discussion_r2944671138
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java:
##########
@@ -1346,4 +1349,56 @@ private TTLManager getTTLManager() {
private ExternalServiceManager getServiceManager() {
return configManager.getExternalServiceManager();
}
+
+ /**
+ * Check if all DataNodes are registered and running, then trigger integrity
check. This method
+ * should be called after each DataNode registration.
+ */
+ private void checkAndTriggerIntegrityCheck() {
+ // Only trigger integrity check if this ConfigNode is the leader
+ if (!configManager.getConsensusManager().isLeader()) {
+ return;
+ }
+
+ // Get all registered DataNodes
+ List<TDataNodeConfiguration> registeredDataNodes =
getRegisteredDataNodes();
+
+ // Check if all registered DataNodes are running
+ boolean allDataNodesRunning =
+ registeredDataNodes.stream()
+ .allMatch(
+ dataNode -> {
+ Integer dataNodeId = dataNode.getLocation().getDataNodeId();
+ NodeStatus status =
getLoadManager().getLoadCache().getNodeStatus(dataNodeId);
+ return status == NodeStatus.Running;
+ });
+
+ if (allDataNodesRunning && !registeredDataNodes.isEmpty()) {
+ LOGGER.info(
+ "All {} DataNodes are registered and running, triggering data
partition table integrity check",
+ registeredDataNodes.size());
+
+ // Trigger integrity check asynchronously
+ try {
+ configManager.getProcedureManager().dataPartitionTableIntegrityCheck();
+ LOGGER.info("Data partition table integrity check procedure submitted
successfully");
Review Comment:
These codes have some problems, can't pass tests.
--
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]