mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-12-04 00:15:29 +00:00
* feat: read the object store WAL release bound of a region from its manifest A node may keep object store WAL entries of a region it no longer writes, for example after the region closed before its release record was written. Releasing them needs the latest manifest of the region: entries in a pending tail of the node are still needed. - `MitoEngine::wal_release_bound` reads the latest manifest of a region from the object store, the way an open with the given request would, and caps the given entry id at the pending tails of this node. It returns `None` when no manifest exists there. - `MetricEngine::wal_release_bound` picks the data or the metadata region of a physical region, and `RegionServer::wal_release_bound` builds the open request from the table metadata for the region's id in group 0 and dispatches on the engine. - `RegionServer::has_initializing_regions` tells whether the start-up open in the background still has a region that is neither registered nor failed to register. - Under conditional publication, recovering a manifest fails with a retryable error when the deltas after the replay start are not consecutive: another writer can save a checkpoint and delete the deltas it covers between the two listings, which leaves a suffix. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: tighten the WAL release bound checks and tests - Assert in debug builds that the region is not writable here, and refuse a region info without the region's WAL options. - State the caller obligation: the bound keeps only this node's pending tails, so a takeover by another node must have recorded the entries the region still needs. - Describe in the gap check why recovery requires consecutive deltas under conditional publication only, and record it in mito2/AGENTS.md. - Cover the mito arm, the group checks, the option sanitizing, a gap in the middle of the deltas and the in-progress start-up open in tests, and share the manifest delta writer and the `tail` helper through `mito2::test_util`. Nothing in this repository calls these methods yet. A caller releases the returned bound with `LogStore::release_entries`, and uses `has_initializing_regions` to wait until the start-up open has settled. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: dispatch the WAL release bound through RegionEngine - Add `RegionEngine::wal_release_bound`, whose default reports that the engine has no such bound, and implement it for the mito and metric engines. `RegionServer::wal_release_bound` now calls the engine registered under the table's engine name instead of downcasting. - Rename `region_open_request` to `build_region_open_request`, and fill the start-up checkpoints and follower flags in the existing vectors. - State that callers bound how many bound reads run concurrently. - Cover a legacy history that skips a version, nonzero region sequences, an engine without a bound and the metric group check by its status code, and run the writable-region panic test only with debug assertions. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: state the caller conditions of the WAL release bound contract - Say on `RegionEngine::wal_release_bound` that the bound keeps only what the persisted state records as still needed, so the caller uses it only after this node stopped writing the region, and bounds how many calls run concurrently. - Test that an unreadable manifest fails the bound, derive the skipped version of the legacy history test from the region, and stop normalizing the table dir twice. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: keep one public entry point for the WAL release bound - Make `MitoEngine::wal_release_bound` crate-private, so the metric engine reaches it through `RegionEngine::wal_release_bound` like every other caller. - Describe the trait's `request` and `region_id` and the bound in the store-api layer's terms, point the datanode and metric docs at the trait, and state when the gap check's reasoning holds. - Match the exact error of an unreadable manifest in its test. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: retry conditional manifest opens when the checkpoint advances Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: propagate checkpoint list errors after observing a manifest Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: distinguish absent manifests from interrupted conditional scans Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: recover legacy manifest gaps and require a node ID for WAL bounds Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com>