Skip to content

Commit 6349515

Browse files
authored
[ConfigNode] Revert procedure-based RegionGroup cleanup and fix RegionMaintainer retries (#18404) (#18528)
1 parent 7267873 commit 6349515

28 files changed

Lines changed: 458 additions & 833 deletions

File tree

‎iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TSStatusCode.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ public enum TSStatusCode {
197197
RECONSTRUCT_REGION_ERROR(908),
198198
EXTEND_REGION_ERROR(909),
199199
REMOVE_REGION_PEER_ERROR(910),
200+
REGION_ALREADY_EXISTS(911),
201+
REGION_NOT_EXIST(912),
200202

201203
// Cluster Manager
202204
ADD_CONFIGNODE_ERROR(1000),

‎iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ConfigNodeMessages.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,6 @@ private ConfigNodeMessages() {}
634634
"Unexpected interruption while waiting for ConfigNode leader load warm-up.";
635635
public static final String EXCEPTION_PROCEDURE_FILE_ARG_EXCEEDS_THE_LOAD_BUFFER_LIMIT_ARG_ACTUAL_SIZE_ARG_62375B4C =
636636
"Procedure file %s exceeds the load buffer limit %s, actual size %s";
637-
public static final String MESSAGE_DROPPING_LEGACY_REGION_DELETE_TASK_FOR_ARG_WHILE_REPLAYING_OFFER_PLAN_REGION_DELETION_IS_NOW_HANDLED_BY_REMOVEREGIONGROUPPROCEDURE_2A81A649 =
638-
"Dropping legacy region-delete task for {} while replaying offer plan; region deletion is now handled by RemoveRegionGroupProcedure.";
639-
public static final String MESSAGE_DROPPING_LEGACY_REGION_DELETE_TASK_FOR_ARG_WHILE_LOADING_SNAPSHOT_REGION_DELETION_IS_NOW_HANDLED_BY_REMOVEREGIONGROUPPROCEDURE_A9D409A0 =
640-
"Dropping legacy region-delete task for {} while loading snapshot; region deletion is now handled by RemoveRegionGroupProcedure.";
641637
public static final String MESSAGE_CONFIGNODE_LEADER_IS_WARMING_UP_BEFORE_SERVING_THE_REGISTERING_CONFIGNODE_WILL_WAIT_2E051639 =
642638
"ConfigNode leader is warming up before serving the registering ConfigNode, will wait";
643639
public static final String MESSAGE_CONFIGNODE_LEADER_IS_WARMING_UP_BEFORE_SERVING_THE_REGISTERING_CONFIGNODE_WILL_WAIT_AND_RETRY_STATUS_ARG_RETRY_ARG_3C924873 =

‎iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ManagerMessages.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public final class ManagerMessages {
7373
"DataRegionGroupExtensionPolicy %s doesn't exist.";
7474
public static final String DECREASE_REFERENCE_COUNT_FOR_SNAPSHOT_ERROR =
7575
"Decrease reference count for snapshot {} error.";
76+
public static final String DELETING_REGIONS_COSTS_MS = "Deleting regions costs {}ms";
7677
public static final String DETECTED_HISTORICAL_PIPE_COMPLETION_REPORT_FROM_DATANODE =
7778
"Detected historical pipe completion report from DataNode {} for pipe {}. remainingEventCount: {}, remainingTime: {}, completedDataNodes: {}";
7879
public static final String DETECTED_COMPLETION_OF_PIPE_STATIC_META_REMOVE_IT =
@@ -440,6 +441,8 @@ public final class ManagerMessages {
440441
"Start to create Region: {} on DataNode: {}";
441442
public static final String START_TO_CREATE_UDF_ON_DATA_NODES_NEEDTOSAVEJAR =
442443
"Start to create UDF [{}] on Data Nodes, needToSaveJar[{}]";
444+
public static final String START_TO_DELETE_REGION_ON_DATANODE =
445+
"Start to delete Region: {} on DataNode: {}";
443446
public static final String START_TRANSFER_OF = "Start transfer of {}";
444447
public static final String STOP_SUBMITTING_CQ_BECAUSE = "Stop submitting CQ {} because {}";
445448
public static final String STOP_SUBMITTING_CQ_BECAUSE_CURRENT_NODE_IS_NOT_LEADER_OR =
@@ -522,8 +525,6 @@ public final class ManagerMessages {
522525
"Unexpected interruption during waiting for configNode leader ready.";
523526
public static final String UNEXPECTED_INTERRUPTION_DURING_WAITING_FOR_GET_CLUSTER_ID =
524527
"Unexpected interruption during waiting for get cluster id.";
525-
public static final String UNEXPECTED_NON_CREATE_REGION_MAINTAIN_TASK_SKIPPED =
526-
"Unexpected non-create task in the RegionMaintainer queue; skipping it (the queue only recreates region replicas now, and region deletion is handled by RemoveRegionGroupProcedure).";
527528
public static final String UNEXPECTED_NULL_PROCEDURE_PARAMETERS_FOR_WAITINGPROCEDUREFINISHED =
528529
"Unexpected null procedure parameters for waitingProcedureFinished";
529530
public static final String UNKNOWN_DATAPARTITION_ALLOCATION_STRATEGY_USING_INHERIT_STRATEGY_BY_DEFAULT =

‎iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -632,16 +632,6 @@ public final class ProcedureMessages {
632632
public static final String PID_ADDREGION_STATE_FAILED = "[pid{}][AddRegion] state {} failed";
633633
public static final String PID_ADDREGION_SUCCESS_HAS_BEEN_ADDED_TO_DATANODE_PROCEDURE_TOOK =
634634
"[pid{}][AddRegion] success, {} has been added to DataNode {}. Procedure took {} (start at {}).";
635-
public static final String PID_REMOVEREGIONGROUP_STARTED_WILL_BE_DELETED =
636-
"[pid{}][RemoveRegionGroup] started, region group {} will be deleted from DataNodes {}.";
637-
public static final String PID_REMOVEREGIONGROUP_STARTED_REPLICA_WILL_BE_DELETED_FROM_DATANODE =
638-
"[pid{}][RemoveRegionGroup] region {} will be deleted from DataNode {}.";
639-
public static final String PID_REMOVEREGIONGROUP_STATE_FAILED =
640-
"[pid{}][RemoveRegionGroup] state {} failed";
641-
public static final String PID_REMOVEREGIONGROUP_DELETE_REPLICA_FAILED =
642-
"[pid{}][RemoveRegionGroup] failed to delete a replica of region {} (attempt {}), will keep retrying until it is deleted. reason: {}";
643-
public static final String PID_REMOVEREGIONGROUP_SUCCESS_PROCEDURE_TOOK =
644-
"[pid{}][RemoveRegionGroup] success, region group {} has been deleted. Procedure took {} (started at {}).";
645635
public static final String PID_MIGRATEREGION_STARTED_WILL_BE_MIGRATED_FROM_DATANODE_TO =
646636
"[pid{}][MigrateRegion] started, {} will be migrated from DataNode {} to {}.";
647637
public static final String PID_MIGRATEREGION_STATE_COMPLETE =
@@ -1399,10 +1389,6 @@ private ProcedureMessages() {}
13991389
public static final String LOG_ARG_8393DD4A = "{}";
14001390
public static final String MESSAGE_HALT_PID_ARG_ACTIVECOUNT_ARG_411F3EBF = "Halt pid={}, activeCount={}";
14011391
public static final String MESSAGE_EXCEPTION_HAPPENED_WHEN_WORKER_ARG_EXECUTE_PROCEDURE_ARG_6E3AD27D = "Exception happened when worker {} execute procedure {}";
1402-
public static final String EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_71B7046A =
1403-
"cannot derive a collision-free delete taskId: procId=%d, deleteTaskSeq=%d exceed the ";
1404-
public static final String EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_ARG_ARG_BIT_BUDGET_015C598D =
1405-
"cannot derive a collision-free delete taskId: procId=%d, deleteTaskSeq=%d exceed the %d/%d-bit budget";
14061392
public static final String MESSAGE_FAILED_TO_SHOW_DATAPARTITIONTABLE_INTEGRITY_CHECK_PROGRESS_5EE98694 = "Failed to show DataPartitionTable integrity check progress";
14071393
public static final String MESSAGE_ENCOUNTERED_UNEXPECTED_DATAPARTITIONTABLEINTEGRITYCHECKPROCEDURESTATE_ARG_WHEN_SHOWING_PROGRESS_5FA2739F =
14081394
"Encountered unexpected DataPartitionTableIntegrityCheckProcedureState {} when showing progress";

‎iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ConfigNodeMessages.java‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,6 @@ private ConfigNodeMessages() {}
671671
public static final String
672672
EXCEPTION_PROCEDURE_FILE_ARG_EXCEEDS_THE_LOAD_BUFFER_LIMIT_ARG_ACTUAL_SIZE_ARG_62375B4C =
673673
"Procedure 文件 %s 超过了加载缓冲区限制 %s,实际大小为 %s";
674-
public static final String
675-
MESSAGE_DROPPING_LEGACY_REGION_DELETE_TASK_FOR_ARG_WHILE_REPLAYING_OFFER_PLAN_REGION_DELETION_IS_NOW_HANDLED_BY_REMOVEREGIONGROUPPROCEDURE_2A81A649 =
676-
"重放 offer plan 时丢弃 {} 的遗留 region-delete 任务;region 删除现已由 RemoveRegionGroupProcedure 处理。";
677-
public static final String
678-
MESSAGE_DROPPING_LEGACY_REGION_DELETE_TASK_FOR_ARG_WHILE_LOADING_SNAPSHOT_REGION_DELETION_IS_NOW_HANDLED_BY_REMOVEREGIONGROUPPROCEDURE_A9D409A0 =
679-
"加载快照时丢弃 {} 的遗留 region-delete 任务;region 删除现已由 RemoveRegionGroupProcedure 处理。";
680674
public static final String
681675
MESSAGE_CONFIGNODE_LEADER_IS_WARMING_UP_BEFORE_SERVING_THE_REGISTERING_CONFIGNODE_WILL_WAIT_2E051639 =
682676
"ConfigNode leader 在服务注册中的 ConfigNode 前正在进行预热,将等待";

‎iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ManagerMessages.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public final class ManagerMessages {
7373
"DataRegionGroupExtensionPolicy %s 不存在。";
7474
public static final String DECREASE_REFERENCE_COUNT_FOR_SNAPSHOT_ERROR =
7575
"减少快照 {} 的引用计数失败。";
76+
public static final String DELETING_REGIONS_COSTS_MS = "删除 region 耗时 {}ms";
7677
public static final String DETECTED_HISTORICAL_PIPE_COMPLETION_REPORT_FROM_DATANODE =
7778
"检测到来自 DataNode {} 的历史 pipe 完成上报,pipe {}。remainingEventCount: {}, remainingTime: {}, completedDataNodes: {}";
7879
public static final String DETECTED_COMPLETION_OF_PIPE_STATIC_META_REMOVE_IT =
@@ -435,6 +436,8 @@ public final class ManagerMessages {
435436
"开始在 DataNode: {} 上创建 Region:{}";
436437
public static final String START_TO_CREATE_UDF_ON_DATA_NODES_NEEDTOSAVEJAR =
437438
"开始在 Data Nodes 上创建 UDF [{}],needToSaveJar[{}]";
439+
public static final String START_TO_DELETE_REGION_ON_DATANODE =
440+
"开始在 DataNode: {} 上删除 Region:{}";
438441
public static final String START_TRANSFER_OF = "开始传输 {}";
439442
public static final String STOP_SUBMITTING_CQ_BECAUSE = "停止提交 CQ {},原因:{}";
440443
public static final String STOP_SUBMITTING_CQ_BECAUSE_CURRENT_NODE_IS_NOT_LEADER_OR =
@@ -517,8 +520,6 @@ public final class ManagerMessages {
517520
"等待 configNode leader 就绪过程中发生意外中断。";
518521
public static final String UNEXPECTED_INTERRUPTION_DURING_WAITING_FOR_GET_CLUSTER_ID =
519522
"等待获取 cluster id 过程中发生意外中断。";
520-
public static final String UNEXPECTED_NON_CREATE_REGION_MAINTAIN_TASK_SKIPPED =
521-
"RegionMaintainer 队列中出现意外的非 create 任务;跳过处理(该队列目前仅用于重建 region 副本,region 删除由 RemoveRegionGroupProcedure 处理)。";
522523
public static final String UNEXPECTED_NULL_PROCEDURE_PARAMETERS_FOR_WAITINGPROCEDUREFINISHED =
523524
"waitingProcedureFinished 的 procedure 参数为空";
524525
public static final String UNKNOWN_DATAPARTITION_ALLOCATION_STRATEGY_USING_INHERIT_STRATEGY_BY_DEFAULT =

‎iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -598,16 +598,6 @@ public final class ProcedureMessages {
598598
public static final String PID_ADDREGION_STATE_FAILED = "[pid{}][AddRegion] 状态 {} 失败";
599599
public static final String PID_ADDREGION_SUCCESS_HAS_BEEN_ADDED_TO_DATANODE_PROCEDURE_TOOK =
600600
"[pid{}][AddRegion] 成功,{} 已添加到 DataNode {}。Procedure 耗时 {}(开始于 {})。";
601-
public static final String PID_REMOVEREGIONGROUP_STARTED_WILL_BE_DELETED =
602-
"[pid{}][RemoveRegionGroup] 开始,region group {} 将从 DataNode {} 上删除。";
603-
public static final String PID_REMOVEREGIONGROUP_STARTED_REPLICA_WILL_BE_DELETED_FROM_DATANODE =
604-
"[pid{}][RemoveRegionGroup] region {} 将从 DataNode {} 上删除。";
605-
public static final String PID_REMOVEREGIONGROUP_STATE_FAILED =
606-
"[pid{}][RemoveRegionGroup] 状态 {} 失败";
607-
public static final String PID_REMOVEREGIONGROUP_DELETE_REPLICA_FAILED =
608-
"[pid{}][RemoveRegionGroup] 删除 region {} 的一个副本失败(第 {} 次尝试),将持续重试直到删除成功。原因:{}";
609-
public static final String PID_REMOVEREGIONGROUP_SUCCESS_PROCEDURE_TOOK =
610-
"[pid{}][RemoveRegionGroup] 成功,region group {} 已删除。过程耗时 {}(开始于 {})。";
611601
public static final String PID_MIGRATEREGION_STARTED_WILL_BE_MIGRATED_FROM_DATANODE_TO =
612602
"[pid{}][MigrateRegion] 开始,{} 将从 DataNode {} 迁移到 {}。";
613603
public static final String PID_MIGRATEREGION_STATE_COMPLETE = "[pid{}][MigrateRegion] 状态 {} 完成";
@@ -1466,12 +1456,6 @@ private ProcedureMessages() {}
14661456
public static final String
14671457
MESSAGE_EXCEPTION_HAPPENED_WHEN_WORKER_ARG_EXECUTE_PROCEDURE_ARG_6E3AD27D =
14681458
"worker {} 执行 procedure {} 时发生异常";
1469-
public static final String
1470-
EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_71B7046A =
1471-
"无法推导出无冲突的 delete taskId:procId=%d,deleteTaskSeq=%d 超出了 ";
1472-
public static final String
1473-
EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_ARG_ARG_BIT_BUDGET_015C598D =
1474-
"无法推导出无冲突的 delete taskId:procId=%d,deleteTaskSeq=%d 超出了 %d/%d 位的预算";
14751459
public static final String
14761460
MESSAGE_FAILED_TO_SHOW_DATAPARTITIONTABLE_INTEGRITY_CHECK_PROGRESS_5EE98694 =
14771461
"显示 DataPartitionTable 完整性检查进度失败";

‎iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnAsyncRequestType.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public enum CnToDnAsyncRequestType {
3939
// Region Maintenance
4040
CREATE_DATA_REGION,
4141
CREATE_SCHEMA_REGION,
42+
DELETE_REGION,
4243
RESET_PEER_LIST,
4344
NOTIFY_REGION_MIGRATION,
4445
UPDATE_REGION_ROUTE_MAP,

‎iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnInternalServiceAsyncRequestManager.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.apache.iotdb.confignode.client.async;
2121

22+
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
2223
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
2324
import org.apache.iotdb.common.rpc.thrift.TFlushReq;
2425
import org.apache.iotdb.common.rpc.thrift.TNodeLocations;
@@ -142,6 +143,10 @@ protected void initActionMapBuilder() {
142143
(req, client, handler) ->
143144
client.createDataRegion(
144145
(TCreateDataRegionReq) req, (DataNodeTSStatusRPCHandler) handler));
146+
actionMapBuilder.put(
147+
CnToDnAsyncRequestType.DELETE_REGION,
148+
(req, client, handler) ->
149+
client.deleteRegion((TConsensusGroupId) req, (DataNodeTSStatusRPCHandler) handler));
145150
actionMapBuilder.put(
146151
CnToDnAsyncRequestType.CREATE_SCHEMA_REGION,
147152
(req, client, handler) ->

‎iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.apache.iotdb.confignode.consensus.request.write.procedure.UpdateProcedurePlan;
6060
import org.apache.iotdb.confignode.consensus.request.write.region.CreateRegionGroupsPlan;
6161
import org.apache.iotdb.confignode.i18n.ManagerMessages;
62+
import org.apache.iotdb.confignode.manager.partition.PartitionManager;
6263
import org.apache.iotdb.confignode.persistence.ProcedureInfo;
6364
import org.apache.iotdb.confignode.procedure.PartitionTableAutoCleaner;
6465
import org.apache.iotdb.confignode.procedure.Procedure;
@@ -337,6 +338,9 @@ public TSStatus deleteDatabases(
337338
}
338339
List<TSStatus> results = new ArrayList<>(procedures.size());
339340
procedures.forEach(procedure -> results.add(waitingProcedureFinished(procedure)));
341+
// Clear the previously deleted regions
342+
final PartitionManager partitionManager = getConfigManager().getPartitionManager();
343+
partitionManager.getRegionMaintainer().submit(partitionManager::maintainRegionReplicas);
340344
if (results.stream()
341345
.allMatch(result -> result.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode())) {
342346
return StatusUtils.OK;

0 commit comments

Comments
 (0)