Files
greptimedb/src/common
Weny Xu 279908984d fix: fix topic region mapping sync and handle region_not_found in migration (#7552)
* fix(meta): update topic region mapping during table route updates

Fix a bug in `build_create_txn` where the parameter order was incorrect
(`(topic, region_id)` -> `(region_id, topic)`), and add support for updating
topic region mappings during repartition operations.

- Add `build_update_txn` method to handle topic region mapping updates
- Integrate topic region update into `update_table_route` transaction
- Add WAL options merging and validation logic for repartition
- Update allocate/deallocate procedures to pass WAL options
- Add comprehensive tests for all scenarios

This ensures topic region mappings stay in sync with table routes during
repartition, preventing data inconsistencies.

Signed-off-by: WenyXu <wenymedia@gmail.com>

* feat(meta): handle region_not_found in region migration

Add support for detecting and handling regions that exist in migration
tasks but are no longer present in table routes (e.g., removed after
repartition). This prevents unnecessary retries and cleans up related
resources.

Changes:
- Add `region_not_found` field to `SubmitRegionMigrationTaskResult` and
  `RegionMigrationAnalysis` structs
- Update `analyze_region_migration_task` to detect regions missing from
  current table routes
- Deregister failure detectors for `region_not_found` regions in supervisor
- Change `table_regions()` return type from `HashMap<TableId, Vec<RegionId>>`
  to `HashMap<TableId, HashSet<RegionId>>` for better performance
- Add test cases for `region_not_found` handling

This fixes the issue where migration tasks would continue retrying on
regions that have been removed after repartition operations.

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix: fix clippy

Signed-off-by: WenyXu <wenymedia@gmail.com>

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
2026-01-13 04:10:45 +00:00
..
2025-12-18 09:39:10 +00:00