CRZbulabula commented on PR #18033: URL: https://github.com/apache/iotdb/pull/18033#issuecomment-4798321194
Follow-up (6306e96): simplified the DataNode side. Instead of adding a new `deleteRegionAsync` RPC + `DeleteRegionTask`, `DeleteRegionProcedure` now **reuses the existing `deleteOldRegionPeer` plumbing** (`submitDeleteOldRegionPeerTask` → `DeleteOldRegionPeerTask`), which already does `deleteLocalPeer` + delete-region-data on a background thread keyed by `taskId` and is polled via `getRegionMaintainResult` — exactly what region-replica deletion needs. This removes the duplicated `deleteRegionAsync` RPC, `DeleteRegionTask`, `submitDeleteRegionTask` (service + handler), the `DELETE_REGION_ASYNC` request type and its i18n constant (net −254 lines on the DataNode side). It also fixes a latent bug in `DeleteOldRegionPeerTask.run()` that the reuse exposes: on a `deletePeer`/`deleteRegion` failure it called `taskFail` but did **not** `return`, then fell through to `taskSucceed`, so a failed deletion was reported as success. It now returns after `taskFail`, and `deletePeer` treats `ConsensusGroupNotExistException` as success so a retry converges cleanly. This also hardens the existing RemoveRegionPeer/migration path that already uses this task. The ConfigNode-side `CreateRegionProcedure`/`DeleteRegionProcedure` remain separate procedures: `Add`/`RemoveRegionPeerProcedure` model peer-membership changes (coordinator, consensus pipes, transfer-leader, resetPeerList rollback, partition-table edits), which is a different concern from region-group create/delete, so reusing them there would drag in irrelevant/harmful steps. -- 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]
