What type of enhancement is this?
Tech debt reduction, Refactor
What does the enhancement do?
Currently, flush requests triggered via FlushRegion end up as a generic Manual reason on the datanode side. This makes it impossible to distinguish the source of a flush.
Examples:
- Flush triggered by metasrv WAL prune
- Flush triggered by region migration (pre-flush before downgrade leader)
- Flush triggered by repartition path
Relevant code today:
src/store-api/src/region_request.rs: RegionFlushRequest has no reason field
src/mito2/src/worker/handle_flush.rs: defaults to FlushReason::Manual for requests
Problem
- Logs/metrics cannot identify the actual flush source
- Future optimizations (timeouts, retry policy, priority) lack semantic input
Desired outcome
Introduce more granular flush reasons and carry them through the request pipeline:
- Flush triggered by metasrv WAL prune
- Flush triggered by region migration pre-flush (downgrade leader)
- Flush triggered by repartition path
- Preserve manual/user-triggered flush
Proposed approach
- Add a reason field to flush requests:
api::v1::region::FlushRequest
store_api::region_request::RegionFlushRequest
- Extend or map to a richer flush reason enum (reuse
mito2::FlushReason or add a mapping layer)
- Set the reason at metasrv or caller when sending flush:
- region migration pre-flush (
src/meta-srv/src/procedure/region_migration/flush_leader_region.rs)
- metasrv WAL prune (entry point TBD)
- repartition flow (entry point TBD)
- Use the incoming reason in datanode handling (
src/mito2/src/worker/handle_flush.rs)
- Update logs/metrics/tests accordingly
Acceptance criteria
- Flush logs show distinct reasons (not all Manual)
- region migration pre-flush, metasrv WAL prune, and repartition are distinguishable
- Manual/user-triggered flush behavior remains unchanged
- Relevant tests updated and passing
Implementation challenges
No response
What type of enhancement is this?
Tech debt reduction, Refactor
What does the enhancement do?
Currently, flush requests triggered via
FlushRegionend up as a genericManualreason on the datanode side. This makes it impossible to distinguish the source of a flush.Examples:
Relevant code today:
src/store-api/src/region_request.rs:RegionFlushRequesthas no reason fieldsrc/mito2/src/worker/handle_flush.rs: defaults toFlushReason::Manualfor requestsProblem
Desired outcome
Introduce more granular flush reasons and carry them through the request pipeline:
Proposed approach
api::v1::region::FlushRequeststore_api::region_request::RegionFlushRequestmito2::FlushReasonor add a mapping layer)src/meta-srv/src/procedure/region_migration/flush_leader_region.rs)src/mito2/src/worker/handle_flush.rs)Acceptance criteria
Implementation challenges
No response