mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-26 12:44:10 +00:00
2effff48d5fbea48ddae79c28b36aec2a31094de
14
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5dec7b1986 |
feat(meta-srv): check pending WAL tails before a repartition starts (#10504)
* feat(meta-srv): check pending WAL tails of source regions before a repartition starts Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(common-meta): freeze the region statistic encodings before the pending tails flag Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(meta-srv): clarify the repartition pending tails errors and pin the flag encoding Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(meta-srv): retry repartitions over pending WAL tails and pass sources without a report Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(meta-srv): note the retained leader report in the repartition pre-check Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(meta-srv): report pending repartition tails as region not ready and share is_false Signed-off-by: jeremyhi <fengjiachun@gmail.com> * style(meta-srv): order the repartition pre-check test imports Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
0ae7c1826b |
feat: add an admin function to discard pending WAL tails (#10477)
* feat: add an admin function that discards a datanode's pending WAL tails Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: refuse a tail discard over an unconfirmed manifest update and address review Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test: drop the integration test that repeats the admin function's region form Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: refuse a tail discard while a tail replay's update is uncertain Signed-off-by: jeremyhi <fengjiachun@gmail.com> * build: pin greptime-proto to the branch that adds the pending tails truncate kind Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test: record the region id case of the discard_pending_tails sqlness test Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: track the uncertain replay update only without conditional publication and pin the truncate wire format Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test: simplify the truncate wire test Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test: cover the discard requests sent to regions and the metric data region Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(mito2): pin the WAL history a discard relies on after a crash Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(common-function): describe the mock pending tails discard Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(operator): report discard failures per region and clarify pending tails docs Log each failed region of a by-table pending tails discard with its region id and the tails the other regions discarded, derive the unsupported message from the truncate kind, drop the unused feature parameter, document that a discard raises the flushed entry id to the tail bound, and test discarding a kept tail after a replay commit with an uncertain result. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(operator): warn with the partial discard count and state the WAL history check precisely Format request.rs, log the tails discarded by the regions that succeeded at warn level when another region fails, state in the docs that an open checks WAL history through the flushed entry id where the log store checks history and that whoever adds a tail ensures it for every node that may lead the region, and rename two tests after the outcomes they assert. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(mito2): note that accepting missing WAL history opens a region past a discarded bound Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(mito2): rewrap the pending tails discard handler doc Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor(store-api): discard pending WAL tails with a dedicated region request Carry the discard as RegionRequest::DiscardPendingTails, decoded from the DiscardPendingTailsRequest body, instead of a truncate kind. Mito handles it as a worker control request, so the truncate path no longer special-cases it; the Metric Engine forwards it to a physical region's data region; the frontend builds it for a region or for every region of a table, sharing the table lookup with the discard of unflushed data. The wire fixture now pins the new request body. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor(metric-engine): give the pending tails discard its own error context Report a failed discard as a pending tails discard rather than a truncate in the Metric Engine, pin that Mito handles the discard as a worker control request, state that physical_region_ids returns a logical table's physical regions, and drop leftovers from the truncate kind in the tests. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * build: pin greptime-proto to the dedicated pending tails discard request Signed-off-by: jeremyhi <fengjiachun@gmail.com> * build: pin greptime-proto to the merged pending tails discard request Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
c6962802a9 |
feat(meta-srv): bind candidate region leases to the migration's registration (#10440)
* feat(meta-srv): bind candidate region leases to the migration's registration A region migration now gives its candidate region registration a random non-zero candidate lease id. Leases granted because of that registration carry it, but only while the table route exists, and the upgrade instruction carries the same id. The datanode passes the id of each lease to the engine, and Mito records the lease of the latest heartbeat per region outside the region instance, so it survives a reopen during catchup. The migration also drops the candidate registration before it restores the route on rollback, and before the procedure leaves the migration tracker when it ends without a rollback. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): record a lease only while the region stays open Record a granted lease under the same lock that removes it after the region closes, so a lease recorded during a close does not outlive the region. The metric engine records the data region's lease when the metadata region ignores it. Remove the roles-only extraction of operating regions, and cover a present candidate lease id in the upgrade JSON. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * build: point greptime-proto at the candidate lease id change Use the greptime-proto commit that adds GrantedRegion.candidate_lease_id (greptime-proto#357), which also brings in the RawSeriesSource Substrait payload message. Rely on the declaration order of RegionMigrationProcedure to drop the candidate registration before the tracker entry, and document it. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): drop lease records when workers stop Remove the lease records of the regions a stopping worker closes. Check under the removal lock deterministically in tests, cover a lease that arrives after a region is removed, assert the candidate lease id on the migration's real registration and its retry, and match ids per region in a batched upgrade. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(mito2): drop a redundant helper comment Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(store-api): pin the candidate lease id wire bytes Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: document candidate registration and lease record lifecycles Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix: keep candidate lease ids through customized lease renewers The heartbeat handler now sets the candidate lease id of each lease a customized renewer returns from the renewed region with the same id. The metric engine records a lease for the data region only when the metadata region ignored it, since the data region records its own leases. The countdown reset command carries a named struct instead of a tuple. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(metric-engine): cover a lease the data region ignores Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: tighten lease id lookups and lease test assertions Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: align lease naming and share the txn-observing kv backend Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: tidy lease naming, docs and shared test helpers Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: drop field comments that restate their names Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: drop method comments that restate their names Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: say which heartbeat a lease's send time refers to Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: drop the reset deadline field comment Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs: state when an operating region's role and id reach a lease Signed-off-by: jeremyhi <fengjiachun@gmail.com> * chore: pin greptime-proto to the merged candidate lease id change Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test: add the candidate lease id argument to the direct demotion test Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor: order new keeper helpers after public items and test equal send times Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
0a93810c23 |
fix: improve exemplar handling and batch memory admission (#10363)
* chore: update README Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix(ingest): reserve memory for table batches Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix(exemplar): prefix the labels column Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix(prometheus): hide exemplar table from metadata Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix(exemplar): reconcile source tags before writes Signed-off-by: shuiyisong <xixing.sys@gmail.com> * perf(exemplar): prune tags and retain source IDs Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix(exemplar): record slow queries Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix(otlp): skip exemplars when source writes fail Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix(prometheus): skip exemplars when source writes fail Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: account for held memory in batch admission Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: config comments Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test: simplify exemplar and memory tests Signed-off-by: shuiyisong <xixing.sys@gmail.com> * test: deduplicate exemplar setup Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
77cb39b5d1 |
feat(mito2): record pending WAL tails in region manifests (#10308)
* feat(mito2): record pending WAL tails in the region manifest Adds `pending_tails` and `handoff_floors` to the region manifest and its checkpoint, and an optional `pending_tails` / `handoff_floor` pair to `RegionEdit`. An edit without them leaves the records unchanged. A floor is dropped once the flushed entry id reaches it; a tail stays until a commit removes it. Neither is written when empty, so manifests without them encode as before. Opening a region replays its WAL after this node's tails and floor, and WAL releases at open and after a flush stay below this node's tails. Nothing writes these records yet, so every region behaves as before. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * feat(mito2): hold back reads and region changes while WAL tails are pending A region with pending WAL tails is missing data that only those tails hold. Until they are recovered, scans and memtable and SST stats fail with the retryable `RegionPendingTails` error. Truncate, entering staging, a repartition flush, a close-time flush on request, and ALTERs other than adding nullable columns without a default or changing options are rejected before they change any region state. Compaction pauses. A full-listing GC pass skips the region while it has pending tails, or while a newer manifest may exist or the manifest listing fails. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(mito2): name the WAL releases that keep pending tails Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): reject no-op ALTERs of restricted kinds while WAL tails are pending Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(mito2): check that reopening restores the pending-tail read gate Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(mito2): pin what the pending-tail fixtures and rejections promise Signed-off-by: jeremyhi <fengjiachun@gmail.com> * refactor(mito2): name the replay start in the open log and share the pending-tail check Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(mito2): state the per-node order of pending tails and who keeps later writes out of them Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(mito2): check that a cancelled compaction starts nothing while WAL tails are pending When a compaction cancelled by task id finishes, the queued manual request goes through handle_pending_compaction_request, whose pending-tails check replies Ok(0). The reply is read with try_recv so that a dispatched request fails the test at once instead of hanging it. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): drop the pending compaction task state when WAL tails skip it Skipping a pending manual compaction while WAL tails are pending replied Ok(0) but left its task state in place, so task inspection kept listing it as queued and cancelling it by id still succeeded. Clear the pending task state and publish before replying. Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
e2e980fe39 |
feat(mito2): add column sketch options and index metadata (#10295)
Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
f5c1020f5f |
feat(mito2): add shared SST storage and reclamation foundations (#10256)
* feat(mito2): add shared SST storage and reclamation foundations Add shared-level isolation, receipt replay and recovery, migration support, and fail-closed file protection. Keep coordinator submission and verified publication in the next stack layer. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * refactor(mito2): isolate table compaction manifest semantics Keep atomic manifest extension envelopes and lifecycle safety in the common engine. Gate table-specific receipts and remap admission with enterprise, preserving their wire format and rejecting unsupported state before replay or GC. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * refactor(mito2): remove manifest-backed compaction task state Keep file-only edits, shared-reference admission and GC safety. Task retries no longer require persisted receipts or task epochs; reject unpublished prototype task-state records rather than silently dropping them. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * fix(mito2): guard staging manifests and reclaim shared range indexes Reject prototype task state when decoding staging blobs, matching checkpoint and delta decoding. Delete the region-scoped range index when a shared SST reference is retired, while leaving the shared object to global GC. Document the level-2 merge-split rationale and bind the delta guard's action tag with a test. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * refactor(mito2): simplify GC deletion and lingering rules Require unknown files in a directory without a manifest to pass the lingering window before deletion, so an unpublished table-compaction output cannot be reclaimed out from under an active attempt. Replace the per-batch deletion loop with a single publication recheck taken before remote deletion, and drop the batching constant, the deferred-deletion accounting, and their test. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * fix(mito2): keep regions open after manifest validation rejection Classify InvalidRequest from pre-write applicability checks as definitely not persisted. Cover both shared-removal and unsupported-level rejections without stopping the manifest manager, while keeping ambiguous storage errors conservative. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * fix(mito2): reject ambiguous shared SST reclassification Reject edits that both add a shared SST and remove the same file ID before admission and under the manifest lock. Keep ordinary edit semantics and verify add-only L0 reclassification survives reopen without diverging from the live Version. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * test(mito2): define truncate semantics for shared SST references Keep explicit truncation applicable to shared references and document the distinction from physical reclamation. Exercise full and time-range truncation with real shared SSTs, an old query, another referencing region, and reopen. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * fix(mito2): define shared copy results and reject metadata imports Document copied_file_ids as installed logical references, including no-op retries. Reject shared SSTs in metadata-region copies before copying any objects or changing the target, and cover shared, mixed and repeated copy behavior. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * style(mito2): unify shared SST level references and bounds docs Use module-qualified shared-level constants consistently and document MAX_LEVEL as an exclusive bound for SST version operations. No runtime behavior changes. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * refactor(mito2): move the shared SST level to a max sentinel Use the u8 maximum as the shared classification so future ordinary levels can never collide with it, and map wire levels to fixed storage slots instead of indexing by value. Shared metadata, admission and filters keep their semantics; unallocated levels stay rejected. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * fix(mito2): keep dropped-region tombstones while files are deferred Young unknown objects and hook-protected candidates on a dropped region must report needs_retry so the meta tombstone survives until they are actually reclaimed; reporting success would let the procedure drop the tombstone and orphan the retained objects. Cover both deferral paths plus the eventual clear. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> * fix(mito2): reject adopting an existing L1 SST as shared Adopting a shared reference is L0-only: the manifest would replace an existing L1 entry while the live version keeps both handles, duplicating rows until reopen. Reject the edit at admission before any state change and cover the rejection with a real SST. Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> --------- Signed-off-by: Lei, HUANG <ratuthomm@gmail.com> |
||
|
|
5e9bb3c689 |
feat: support native histograms in sampled remote read (#9971)
* feat: support native histograms in sampled remote read Signed-off-by: shuiyisong <xixing.sys@gmail.com> * fix: align native histogram ingestion with remote read validation Signed-off-by: shuiyisong <xixing.sys@gmail.com> --------- Signed-off-by: shuiyisong <xixing.sys@gmail.com> |
||
|
|
60655a933b |
fix(log-store): persist object store WAL region releases (#9579)
* fix(log-store): persist object store WAL region releases A region's release lived only in memory: a restart after DROP TABLE and before the next object never re-established the dropped region's watermark, so its segments counted as live and pinned garbage collection of the whole prefix. A release now writes a release record (region id and the entry id the region is released through) into an object sealed at once, and returns once that object is durable and indexed, in both acknowledgement modes. Recovery seeds the obsolete watermarks from the release records of the indexed objects before it computes any reclaim boundary. obsolete_all releases in full; the new LogStore::release_region, a no-op by default, releases a dropped region through the largest entry id the store handed out for it, and Mito calls it after obsolete when it drops a region. Objects with release records use format version 2, the version 1 layout with the records at the end of the footer; every other object is still written as version 1. A counter of release records made durable is added. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): describe persisted object store WAL region releases Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(log-store): carry a failed region release into the next object A release whose batch failed left its record only in an orphan object, so a drop that failed there could still leave the region unreleased after a restart. The store now keeps the release records of failed batches and seals them with its next batch, on a timer tick when no entry is admitted, so the release becomes durable once a create succeeds again. The version 1 and version 2 object fixtures are frozen under tests/compatibility/wal/object_store and loaded by the format tests, and the RFC no longer says that state is persisted only in headers. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): complete a region drop whose WAL release fails A drop request is not sent again once the region was removed, so a drop whose WAL release failed used to leave the region half dropped. The drop now completes, cleaning up the region's runtime state and scheduling its files for deletion, and reports the release failure. In the durable mode the object store WAL now creates one more object at stop with the release records of failed and dropped batches, so a graceful stop does not lose a release that failed. The release record counter is described as counting the records of indexed objects. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(log-store): describe the stop-time release create of the WAL actor Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): state the accepted window of unreleased dropped regions Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(log-store): describe release waiters in the WAL actor's outcome table Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(log-store): fail region releases while the object store WAL is failing A failing store keeps its backlog and rejects appends until a create succeeds, so a release would otherwise wait for an upload that is not coming. A release that arrives in that state now fails at once with the retryable error, and one whose batch is still pending when the store enters it fails as well. Neither poisons the store: the record of the first waits for the next sealed batch, like that of a batch that failed, and the record of the second stays in the backlog, so both become durable once a create succeeds. Rejected releases count in rejected_appends_total. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): describe region releases while the object store WAL is failing Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): place the drop crash window in the drop procedure The crash window between the deletion of a table's metadata and a durable release record is a gap of the drop procedure, not of the WAL. Describe it as far as the code shows, name the remedy that belongs in the procedure, cleaning up offline a region a resumed region drop finds not open, and list it under future work. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(log-store): keep rejected release records coalesced while failing A release rejected while the store is failing kept its record for the next sealed batch, but every timer tick then sealed that record alone behind the refused backlog, so a release repeated across ticks grew the backlog without bound. A failing store now keeps such records coalesced and seals them on the first tick after a create succeeds. The fault-matrix case of a release while the backlog is refused now runs with a 10 ms flush interval, repeats the release, and checks that the backlog does not grow and that recovery reads the record back. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): keep rejected release records unsealed while failing Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): cite the drop procedure issue for the crash window Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(log-store): let a stop seal rejected release records of a failing store Keeping the records of rejected releases out of sealed batches while the store is failing also kept them out of the seal a stop requests, so a stop whose last attempt of the backlog succeeded dropped them and the released region pinned collection after the restart. A stop now seals them with the backlog. A fault-matrix case rejects a release while the store is failing, stops, lets both creates succeed, and checks the record after a reopen. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): describe the stop of a failing store with rejected releases Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(log-store): keep release records readable by older object store WAL readers Release records were written as a version 2 footer, which a build without it refuses to read, so rolling a node back after a drop failed to open the whole WAL prefix. They are now the single entry of a segment of the reserved region u64::MAX at the first position of a version 1 object: an older reader indexes that segment as a region it never opens, and recovery reads the segment back with one range read per object that holds one. The segment never holds the reclaim boundary and names no namespace. A durable stop whose last create of release records fails now reports the error instead of returning Ok and losing the records silently. The tests are trimmed: the release unit tests and fault-matrix cases that repeated each other are merged, and the Mito drop tests share one parameterized case. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): describe release records as a segment of a reserved region Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(log-store): report release records a poisoning stop drops A durable stop whose last create of release records met a conflict poisoned the store and returned Ok, losing the records silently. Stop now reports the error whenever release records are dropped after it began, by a rollback or by poisoning. The test of a failed release covers that conflict, and seals its record on a tick after a one-shot create failure, so the next tick cannot fail too. The documentation now says that recovery reads the segments of release records, and that one that does not decode fails recovery. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): describe how recovery reads segments of release records Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): say that stop reports release records a conflict drops Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(log-store): restore the transiently failing release create in enqueued mode The fault matrix again covers a release whose create fails transiently in the enqueued mode: the release waits for the repeat under the same sequence and returns once it succeeds. The encode_batch doc now says the release segment is the last segment of the object. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): place the release segment and count the restored case Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): do not fail a region drop on a failed WAL release Returning the release error from the drop left a metric physical region half dropped: the metric engine stops after the data region and never drops the metadata region or forgets the physical region, and a retried drop finds the data region gone and counts it as done. The release error gave the caller nothing to retry, since the region is already removed and the log store keeps the record for its next object. The drop now logs the error and succeeds. A metric engine test drops a physical region while the WAL releases of both mito regions fail, and checks that both regions and the physical region state are gone. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): a failed release no longer fails the drop Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): do not fail a region drop on a failed WAL obsolete A store that the release of another region poisoned fails obsolete as well, which left the metric engine with its metadata region undropped. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * test(metric-engine): drop a physical region whose WAL obsolete or release fails Cover a failed data release, two failed releases and a conflicting release that poisons the store, after the regions wrote to the WAL, and check that a store opened later keeps no segment of either region. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): a failed obsolete does not fail the drop either Signed-off-by: jeremyhi <fengjiachun@gmail.com> * fix(mito2): fail the drop on an obsolete error of other WAL providers Only the object store WAL is shared by the regions of a store that the release of one can poison; Raft Engine and Kafka keep failing the drop when obsolete fails. Signed-off-by: jeremyhi <fengjiachun@gmail.com> * docs(rfc): a stopped or poisoned store keeps no failed release Signed-off-by: jeremyhi <fengjiachun@gmail.com> --------- Signed-off-by: jeremyhi <fengjiachun@gmail.com> |
||
|
|
28697c9e55 |
feat(datanode): execute nested MergeScan plans on the datanode (#9206)
* feat(datanode): execute nested MergeScan plans on the datanode Give a datanode the ability to decode and execute a plan whose MergeScan carries a nested plan (e.g. an inner MergeScan over a build table), so a distributed sub-plan pushed to a datanode can itself fan out to other datanodes. This is the execution/codec capability only; it is not wired to any user-facing switch and produces no plan by itself. Codec (src/query/src/query_engine/default_serializer.rs): - MergeScanAwareSerializer keeps the request's SessionState and the engine catalog manager, and decodes a MergeScan payload's tables by (catalog, schema, table) name through the engine catalog rather than the region-aware request catalog list (which binds every table to the request's region and breaks on mismatched columns). Datanode (src/datanode): - New DatanodeRegionQueryHandler (region_query.rs) serves region queries for the MergeScan nodes of a received plan, resolving region leaders via PartitionRuleManager and dispatching to peer datanodes. - Wire KvBackendCatalogManager + PartitionRuleManager + NodeClients into the datanode's catalog/cache registry (with_dist_planner stays false: a datanode never rewrites its own plan). Bug fixes uncovered while wiring this up: - cache registry: register the table/table_info/table_name/table_route/ partition_info caches the datanode's catalog manager and partition rule manager require (previously missing -> panic on lookup). - default_serializer: decode_sub_plan bridge no longer drives a future on a current-thread runtime from within another executor (spawn a dedicated thread + runtime when not on a multi-thread runtime). Tested by query_engine::default_serializer unit tests: nested MergeScan round-trip and engine-catalog resolution with mismatched column names. No user-facing behavior change. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(query): keep GreptimeDB function bindings after rebuilding decode state SessionStateBuilder::new_from_existing collects the function registry (HashMap) into a Vec and build() re-registers each entry; register_udf registers aliases before the function's own name and the Vec order is unstable. Rebuilding the session state to install MergeScanAwareSerializer after the GreptimeDB functions were registered could therefore rebind a name/alias (e.g. date_format, an alias of DataFusion's to_char) back to the built-in function. This path runs for every decoded plan, not only nested MergeScan ones. Extract the GreptimeDB function registration into register_greptime_functions and re-apply it after the final build of both the top-level decode state and the MergeScan payload state. Add regression tests asserting date_format stays bound to the GreptimeDB implementation on both paths. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(datanode): address review on nested MergeScan capability Three follow-ups from review of the nested MergeScan execution capability: 1. Layer the datanode caches (P2b). table_cache derives from table_info_cache + table_name_cache, and partition_info_cache derives from table_route_cache, but they were all registered in a single flat CacheRegistry whose invalidate() runs concurrently with no ordering. A derived cache could be invalidated and refilled from a base cache that had not been invalidated yet, leaving stale metadata. Build the base caches and the derived caches as separate layers of a LayeredCacheRegistry (reusing the existing layering mechanism) so base caches finish invalidating before derived ones. Both the production path (cmd) and the test scaffolding now build the same layered registry; the flat build_datanode_cache_registry is removed. 2. Don't let a nested MergeScan's internal region query compete for the concurrency permit (P2a). An outer query holds its permit until its stream is fully consumed, and a nested MergeScan makes the datanode issue region queries to peer datanodes as execution stages of that same query. If such an inner stage also took a permit, the outer query waiting on it would deadlock against its own held permit (or time out when max_concurrent_queries > 0). Mark inner DN->DN region queries as internal stages: QueryRequest gains an flag carried over the wire in the request header's query_context extensions (reserved key, not injectable via hints), and the region server skips acquiring a concurrency permit for internal-stage requests on both acquire sites. Outer queries still acquire normally. 3. Add an end-to-end capability test (tests-integration/.../nested_merge_scan_capability_test.rs): hand-build Join(<local probe region>, MergeScan(build regions on both datanodes)) with mismatched column names and duplicate build keys, ship it to a datanode over a real TCP Flight endpoint, consume the stream fully and compare the row multiset against the frontend's reference join result, assert a real cross-datanode DoGet via an RPC counter, and assert an inner region failure fails the whole query. Also migrate the with_real_datanode_grpc_addr + DatanodeRpcStats test scaffolding. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(query): adapt date_format regression test to the updated DataFusion fork ScalarUDFImpl's trait bounds changed so its impl can no longer be downcast via as_any(); assert the function equals the GreptimeDB implementation instead, which to_char can never satisfy. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(datanode): cover the internal stage under the concurrency limit Add an end-to-end regression test for the nested MergeScan capability under max_concurrent_queries = 1: both datanodes' only permit is held by the outer queries' streams while their inner MergeScans fetch the build regions from the same datanodes over real Flight connections. The result consumption is bounded by a timeout, so a broken link anywhere in the chain (marking the inner request internal, carrying the marker in the request header, honoring it at the receiving acquire sites) fails the test instead of deadlocking. Also add a minimal with_datanode_options_override hook to the cluster builder, and fix the test module doc: the outer request is handed to RegionServer::handle_remote_read in process; only the inner region queries go over the wire. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(datanode): cover cold route loads under unrelated invalidations The table route cache uses InitStrategy::VersionChecked, whose version counter belongs to the whole CacheContainer rather than to a single table: any TableId invalidation bumps the shared version, so a cold load of one table's route retries when an unrelated table is invalidated concurrently. Document this as a known limitation on the region query handler, and pin the behavior with an integration test: run the nested plans while a background task invalidates an unrelated table id on every datanode, assert the results still match the expected multiset (retries only add work, they never return a stale route), and report the observed load amplification via the cache miss counter (2 loads without invalidations, 8 over three runs with 24 unrelated invalidations in this run). Also expose the datanode cache registries on the test cluster so a test can drive the local invalidation path that the heartbeat handler drives after a metasrv broadcast. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * docs(query): trim nested plan decoder commentary Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * refactor: remove redundant nested scan support plumbing Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(query): decode nested MergeScan payloads asynchronously Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(query): avoid unnecessary extension name allocation Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(query): retain extension decoding for manual session states Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * refactor(datanode): keep nested scan query admission unchanged Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(datanode): honor query handler factories and trim nested scan fixtures Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(datanode): retain required cache error import Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * refactor(query): reuse registered state for nested scan decoding Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(query): verify payload information schema table functions Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(query): retain nested scan runtime and cold-route guards Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * refactor(query): address nested scan review feedback Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * fix(session): preserve read preference across region query hops Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(session): verify strict context rejection at Flow ingress Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(query): remove redundant serializer error case Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --------- Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> |
||
|
|
bb6d55a99f |
feat: support old-stage datanode config overlays (#8647)
* feat: support old-stage datanode config overlays Signed-off-by: discord9 <discord9@163.com> * fix: derive compat overlay policy from WAL config Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
ad2c1bfc59 |
fix(meta): preserve legacy WAL options compatibility (#8707)
* fix: preserve legacy region WAL options format Signed-off-by: WenyXu <wenymedia@gmail.com> * test: add downgrade compatibility coverage Signed-off-by: WenyXu <wenymedia@gmail.com> * refactor: deduplicate compat restart Signed-off-by: WenyXu <wenymedia@gmail.com> * test: harden downgrade compatibility check Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com> |
||
|
|
16b60fe847 |
ci: add sqlness compat smoke (#8370)
* ci: add sqlness compat smoke Signed-off-by: discord9 <discord9@163.com> * ci: limit compat smoke pull request trigger Signed-off-by: discord9 <discord9@163.com> * ci: run compat smoke in merge queue Signed-off-by: discord9 <discord9@163.com> * ci: configure compat version window Signed-off-by: discord9 <discord9@163.com> * ci: move compat smoke logic into script Signed-off-by: discord9 <discord9@163.com> * ci: expand compat version window Signed-off-by: discord9 <discord9@163.com> * ci: rename compat job for recent releases Signed-off-by: discord9 <discord9@163.com> * ci: report compat test failures Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |
||
|
|
16a2b18c2b |
test: add sqlness compatibility runner (#8334)
* test: add sqlness compatibility runner Signed-off-by: discord9 <discord9@163.com> * fix: update remote dyn filter request Signed-off-by: discord9 <discord9@163.com> * fix: satisfy compat runner clippy Signed-off-by: discord9 <discord9@163.com> * test: add legacy jsonb compatibility case Signed-off-by: discord9 <discord9@163.com> * test: align legacy jsonb compat assertion Signed-off-by: discord9 <discord9@163.com> * fix: align remote dyn filter proto fields Signed-off-by: discord9 <discord9@163.com> * test: simplify compat topology and SQL handling Signed-off-by: discord9 <discord9@163.com> * fix: switch compat runner to target binary Signed-off-by: discord9 <discord9@163.com> * test: drop compat SQLNESS comment handling Signed-off-by: discord9 <discord9@163.com> * test: support sqlness commands in compat Signed-off-by: discord9 <discord9@163.com> * test: fix compat protocol reconnect Signed-off-by: discord9 <discord9@163.com> * test: filter compat cases by version Signed-off-by: discord9 <discord9@163.com> * test: add merge mode compat case Signed-off-by: discord9 <discord9@163.com> * test: harden compat runner setup Signed-off-by: discord9 <discord9@163.com> * test: address compat review follow-ups Signed-off-by: discord9 <discord9@163.com> * test: tighten compat case validation Signed-off-by: discord9 <discord9@163.com> * test: require explicit compat expectations Signed-off-by: discord9 <discord9@163.com> * test: generate missing compat snapshots Signed-off-by: discord9 <discord9@163.com> * test: add compat dry run Signed-off-by: discord9 <discord9@163.com> --------- Signed-off-by: discord9 <discord9@163.com> |