Repository navigation
Conversation
Refs matrixorigin#24552. Include the design, reproducible verification script, test suites and recorded validation results.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Use MatrixOne error constructors and preserve bounded whole-transaction retries for local and remote lock-wait timeouts. Attach regression evidence and repair the baseline gossip fixture caller.
Preserve the TTL grammar and current-main qualified identifiers, snapshot diagnostics, EXPLAIN formats, and ALTER ADD COLUMN productions. Keep main's canonical gossip port-range repair.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: b65fa0d0b98bbc0b69931e5882a54b75cf547ff4
Assessment: request_changes
The mandatory design-review gate is unmet. Reusing transactional DELETE and existing constraint metadata is a coherent approach, but the supplied evidence contains no traceable approval of the design revision. Implementation approval remains blocked; the complete implementation review was not performed.
Model: gpt-6-astra / xhigh
Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0
- P2
docs/design/20261013-table-ttl.en.md:3: This feature adds persistent TTL policies, SQL syntax, and a scheduled worker that automatically deletes tenant rows across multiple subsystem boundaries.
Impact: Validation requirement: obtain and record a distinct design-review decision tied to the exact document revision before proceeding with implementation approval. The repository's design-first contract applies through both complexity triggers and the 793 changed non-generated production lines. Passing implementation tests does not close this gate.
Evidence: The English and Chinese documents describe implementation and validation but contain no design approval record. Frozen evidence.json has no reviews, no inline review comments, and an empty local_validation array; its issue comments supply no approval. .agents/skills/mo-dev/references/feature-design-review.md section 2 requires a traceable reviewed revision and approval before implementation review.
Validation:
-
Verified the frozen head, merge-base, clean source, supplied patch identity, 35-file inventory, and git diff --check.
-
Static reconciliation passed with exit 0: attempt-1/checks/1791970824455289328-3.json matches design-gate-check.log. Detailed scope is retained in design-gate-review.json under the assigned diagnostic directory.
-
Read both design documents, frozen PR discussion, TTL policy/worker/planner validation code, and author validation reports. No Go or native tests were executed.
Limitations:
-
The mo-self-review skill states that a missing or unapproved design 'short-circuits full implementation polishing.' Complete implementation, generated-parser, test-quality, and concurrency/compatibility review remains outstanding.
-
Author results describe earlier checkouts; they were not independently reconciled as exact-head runtime validation. Successful frozen CI statuses do not establish design approval.
3935996 to
6b38fcd
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-xupeng · review
Commit: 804bd56493eb4c0e4e312318a2eca6dc6590bdb5
Assessment: approve
Reviewed the complete 65-file delta and affected owners/callers. The initial row-expiry design coherently reuses catalog, scheduling and transactional DELETE ownership. Prior discovery/cancellation and premature TIMESTAMP-expiry concerns are closed; no actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a14d34-4e51-79a3-a62d-6c9c16279dc8 · slot 0 · generation 0
Validation:
-
Reviewed DDL persistence, COPY/LIKE preservation, tenant isolation, temporal boundaries, stale metadata, rollback, retries, cancellation, continuation and cron shutdown, including regression-test quality.
-
Local preflight passed. Regenerated parser matches committed output after path normalization, with zero conflicts. Protobuf audit confirms only the added TableTTL=17 value and comment formatting.
-
Verified current-merge author evidence: merge parents, parser/grammar hashes and retained log hashes match. Logs report passing parser, planner, TTL, SQL integration and cron-registration selections.
-
Frozen current-head CI records 13 successful, 15 skipped and 2 neutral checks. Manual-script syntax and git diff --check passed.
-
Reconciled local commands, source fingerprints, exit receipts and retained logs. Source remains clean. Detailed evidence is retained in attempt-1/review-report.json, evidence-audit.json and receipt-reconciliation.json.
Limitations:
-
No fresh native Go, SQL integration or race tests were executed locally; retained author evidence was reused. Historical race/stress results and unsupported PR-body counts were not treated as fresh current-head execution.
-
Scale performance, whole-process memory bounds, multi-CN fault injection, clock drift and mixed-version operation remain outside the documented scope; homogeneous TTL-capable deployment is required.
-
The linked issue's full body was not supplied; assessment covers the documented initial row-expiry contract.
fengttt
left a comment
There was a problem hiding this comment.
I have put a few questions in the design notes. The syntax, semantics, are not fleshed out yet. A few unanswered questions,
- Are we doing a simple timestamp column based interval retention or a full fledged snowflake like storage archive policy?
- Are there any performance consideration and design at all?
And no test?
| id BIGINT PRIMARY KEY, | ||
| event_time DATETIME(6), | ||
| payload VARCHAR(256) | ||
| ) TTL event_time + INTERVAL 7 DAY DELETE; |
There was a problem hiding this comment.
SQL in genenal do not use magical TLAs like TTL. Use full english words, unless this is generalized syntax or standard.
|
|
||
| DATE uses UTC midnight. DATETIME has no timezone and is interpreted as UTC wall time by TTL. TIMESTAMP follows the normal client-timezone conversion on insertion and is compared as an absolute time under the worker's UTC session. Microsecond precision is retained. Both operands of the DELETE predicate are DATETIME(6): widening the column under the UTC worker session avoids mixed TIMESTAMP/DATETIME comparison rounding the cutoff to the column scale. Sub-microsecond invocation fractions are floored when formatting the cutoff, so the predicate never advances the true cutoff. | ||
|
|
||
| Expiry is asynchronous: rows remain visible until the DELETE transaction commits. Logical deletion does not promise immediate object/disk reclamation; existing MVCC, snapshot, PITR and GC retention rules still apply. |
There was a problem hiding this comment.
Row remains visible is a really strange statement, esp in the same sentence as "DELETE transaction commits". As I understand you want expired rows may be GCed later.
It is not clear we should use a soft filter to enforce the expiration. It is not hard, and efficient, I don't see why not.
| ALTER TABLE events TTL event_time + INTERVAL 1 WEEK; | ||
| ``` | ||
|
|
||
| `DELETE` is optional. The TTL column must be DATE, DATETIME or TIMESTAMP; NULL values are retained. SECOND, MINUTE, HOUR, DAY and WEEK are fixed-length intervals. The positive integer duration is bounded by 100 × 365 days. A row expires when `column + duration <= the invocation's fixed UTC time`. Equality expires the row; future values remain. Late expired inserts are accepted and processed by a later invocation. |
There was a problem hiding this comment.
If delete is optional, what is the default behavior? Any alternative?
The use case is designed to support constant value based on a timestamp column, therefore the condition SHOULD be a column and a constant. Using an expression is way too general. TimeZone should be specified with the timestamp column. All the later discussion on date, utc, etc are pointless. The timestamp column used -- I would add a requirement that the TS column is the lead column of primary key or cluster key, otherwise reject the statement
The alternative, like snowflake, is a full fledged storage/archive policy, with that the delete condition is full sql predicate. In this case, all the timezone, interval, date, etc are not relavent to this feature at all. Implementataion and performance trade offs are totally different.
aunjgr
left a comment
There was a problem hiding this comment.
APPROVE at 804bd56493eb4c0e4e312318a2eca6dc6590bdb5.
Design review passes for the initial transactional TTL contract and its bounded-discovery amendment. Reusing ordinary DELETE preserves transaction, index, FK and MVCC ownership. The documented semantics are eventual logical expiration, not immediate disk reclamation or a fixed backlog-completion SLA. This review accepts the explicitly stated homogeneous TTL-capable-CN deployment scope; it does not certify mixed-version rollout or the broader partition/performance objectives of #24552.
Checked parser/AST ownership and legacy ttl identifiers; policy binding, duration/type/sequence identity validation and schema restrictions; CREATE/ALTER/SHOW/LIKE/COPY persistence; task registration and worker execution. The UTC cutoff is fixed per invocation, and widening both operands to DATETIME(6) avoids prematurely expiring fractional TIMESTAMP values. NULL/future rows remain.
The deletion boundary is safe: each batch locks in the target tenant/database, then revalidates physical table ID, schema version, complete policy-bearing constraint and serialized source-column identity before normal DELETE. Same-name recreation, policy removal/change and uncredited metadata growth cannot authorize stale deletion. Retry restarts the entire transaction, recognizes wrapped lock timeouts and remains bounded/cancelable.
Discovery now has finite page/count/width/candidate-credit/error-sample limits before retained copies, closes each result before the next query or deletion, and checks cancellation at handoff and during decode. The fenced compound-key cursor advances only through completed attempts, retaining unattempted candidates after a run deadline; task-local admission rejects duplicate execution without waiting. Independent stopper-owned cron registrations keep a blocked lineage registration from stranding TTL registration or shutdown.
Validation: inspected the deterministic page/credit/fence/cancellation/reuse and wrapped-error tests, public real-storage TTL lifecycle/precision/tenant/privilege/rollback/restart/cron controls, and source-qualified validation records. Reused qualifying CI and existing race evidence for unchanged lifecycle owners; the latest main integration regenerates the parser from the merged grammar and reports a reproducible conflict-free output. I did not rerun an embedded cluster, multi-CN fault campaign, throughput benchmark or disk-reclamation experiment locally. No remaining blocking finding within this initial scope.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-xupeng · review
Commit: 13780b807a0a92fa1580edbeac04656132c95199
Assessment: request_changes
Reviewed the complete 71-file delta, responsibility owners, tests, and supplied design/comment evidence. Confirmed one restore defect: ALTER TTL leaves dump replay metadata inconsistent with the current schema.
Model: gpt-6-astra / xhigh
Session: 01a15209-2c6d-71e2-b8f3-aa17387fa283 · slot 2 · generation 0
- P2
pkg/sql/plan/build_ddl.go:7510: Create a table, add TTL with ALTER TABLE, then DUMP TABLE ... METADATA ONLY. Drop the table, recreate it using manifest.create_sql, and LOAD TABLE from that dump. MODIFY TTL and REMOVE TTL reproduce the same failure.
Impact: The dump's CREATE statement describes the original TTL policy while its schema hash describes the current policy. Consequently, restoring from the dump's own metadata fails with 'target table schema does not match table dump'. Synchronize TTL mutations with the replay-DDL owner and add public SQL dump/load regressions for add, modify, and remove.
Evidence: applyTTLOption updates policy metadata without updating Createsql; tableDumpManifestCreateSQL returns that stored SQL, while schema hashing reconstructs the current definition. Diagnostic TestReviewTTLDumpReplay reproduced all three failures through the MySQL entry point. Unchanged TTL passed, and replaying current SHOW CREATE made each failed case load successfully. See dump-replay.jsonl, dump-replay-excerpt.log, ttl_dump_review_test.go, and checks/1792690407623430242-3.json (exit 1).
Validation:
-
Artifacts are retained under /home/xupeng/.local/state/mo-bot/jobs/85aa434eea049015cd5f6aed/attempt-1. final-validation-index.json reconciles commands, source fingerprints, exits, and stdout/stderr hashes; final audit receipt 1792690674778930568-4.json exited 0.
-
Isolation preflight passed. Verified 192 matching native inputs and repository-owner provenance before native tests. Assigned source remained unchanged.
-
Four focused CN registration tests passed under -race, then passed 100 repetitions each without skips or race warnings.
-
Parser regeneration matched after generated-header normalization with zero conflicts; protobuf audit confirmed only the TableTTL enum addition. Diff checks passed.
-
Reconciled current-merge author manifests, source fingerprints, and retained passing parser/planner/TTL and selected integration logs. These were reused rather than rerun.
Limitations:
-
The new reproduction used empty tables and metadata-only dumps; populated-data restoration was not exercised.
-
Full suites were not independently rerun. Historical race summaries were not treated as current-head execution evidence.
-
The linked issue's full body was absent from the supplied evidence. Scale, multi-CN fault, clock-drift, and mixed-version behavior were not experimentally validated.
|
Tick the box to add this pull request to the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #24552. This delivers initial table-level row expiration; partition expiry and cheap physical reclamation remain separate work.
What this PR does / why we need it:
Latest correction (2026-10-23): address review 5618378841. After ALTER adds/modifies/removes TTL, dump replay SQL could retain the old policy while its hash described the current schema, so LOAD rejected the dump's own CREATE output. Manifest generation now reconstructs supported table definitions from current metadata, using the same owner as schema hashing, preserving existing legacy-type/collation normalization and expression witnesses. The fix is at
8cb32856c905b9a0cbfcac0ad65f506c575c9cd7; merge commitf91bd4f582resolves the generated-parser conflict against main0594cdb955.Validation: the old production source fails all six ALTER cases across metadata-only and populated dump modes; unchanged controls do not fail. All eight public MySQL replay cases now pass, including fractional row values and restored defaults. Focused dump-owner tests pass (121 entries / 49 roots); full parser/planner/TTL suites pass (21,476 entries / 4,368 roots, two existing skips); native TTL/default/historical-expression/cron selections pass (78 entries / 15 roots). Configured incremental lint reports zero issues; error-construction, script syntax and diff checks pass. Reproduction, source/log hashes and results. Both language designs and the verification script are updated. GitHub reports mergeable; new-head CI and maintainer re-review remain pending. The separate product syntax/visibility/performance discussion is unchanged.
Adds persistent table TTL policies and bounded asynchronous expiration through the existing task framework and transactional DELETE path:
Policies use existing constraint properties. CREATE/ALTER/SHOW/LIKE preserve policy metadata; unsupported table shapes, invalid metadata and active source-column mutations are rejected. Initial support covers permanent ordinary non-partitioned user tables, DATE/DATETIME/TIMESTAMP and fixed SECOND/MINUTE/HOUR/DAY/WEEK intervals up to 100 × 365 days.
The worker revalidates tenant, physical table identity, version, durable constraints and source-column identity under the existing table lock before deleting. UTC DATETIME(6) comparison preserves fractional cutoffs for low-scale TIMESTAMP columns; NULL/future rows survive. Existing transaction behavior preserves indexes, constraints, MVCC and rollback.
Discovery uses fenced keyset pages with explicit bounds (128 rows/page, four pages, 16 KiB/constraint, 32 candidates/128 KiB retained credit), bounded diagnostics and task-local fair continuation. Defaults remain 1024 rows/batch, eight batches/table, five seconds/table and 50 seconds/run. Retry limits are unchanged. Cancellation closes results and preserves unattempted candidates.
Lineage GC and TTL cron registration run independently under the existing CN stopper and share one retry implementation. A blocked or permanently failing lineage registration cannot prevent TTL activation; shutdown cancels and joins both registrations. Deterministic tests reproduce both failures on the preceding implementation and verify independence, retries and shutdown. Concurrent test bookkeeping is synchronized and registration assertions do not depend on scheduling order.
Rebased onto main
154a24d463d60ae507471b8ae58f56a4d4055541, preserving the feature commits and historical evidence. Regenerated the MySQL parser from the merged grammar with zero conflicts; repeat generation is identical. Native SQL lifecycle coverage also verifies TTL survives main's CHECK and charset conversion paths.Design: English, 中文. Historical design/evidence references remain tied to their original source revisions. Current delivery validation is recorded below.
Validation after this rebase (Go 1.27.1, darwin/arm64; repository CGo wrapper,
-count=1):ttlandcnservicepackages pass race once; affected TTL parser/planner and real SQL scenarios also pass race. Each of the three registration lifecycle tests passes 100 individually selected race repetitions. Adaptive real SQL race repetitions also pass: concurrent workers ×7, foreground writers ×20 and policy removal during lock wait ×100.git diff --checkand verification-script syntax checks pass. Separate gpt-6.1-sol/xhigh design and overall review gates are recorded in the delivery evidence.Remote CI for the newly published revision is pending and is not claimed as passed.
Expiration is eventual and still incurs background catalog/DELETE scans, temporal casts and table-lock contention. Functional tests do not establish zero foreground throughput impact, scale throughput or whole-process RSS bounds. Physical reclamation follows existing snapshot/PITR/GC rules. Deployment requires homogeneous TTL-capable CN builds; partition/object fast-drop, mixed-version protocol fencing, backlog metrics and large-scale performance qualification remain outside this initial scope.