[设计 / Design] 服务端 ID 与时间生成:sequence、uuid 生成、now / server-side ID and time generation
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start by reading the repository documentation and source for insert handling, defaults, transaction replay/receipts, and backup, restore, and migration behavior; the issue names no files or tests. The proposal is explicitly an RFC-level design question: determine how generated values remain stable across replay and persistence before implementation. Done means the design resolves these constraints and specifies the proposed sequence, UUID v7, and time defaults.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
中文说明
环境 / Environment: unionid 0.10.0 (linux x86_64 release binary), 2026-10-01。以下带「已复现」的条目均用该二进制实际运行验证;「未实测」表示依据文档或源码推断。
现象(已复现)
insert accounts {owner: ...}(省略id):E_FIELD: missing required field 'accounts.id',没有自增/序列。- 没有
now/current_timestamp/ uuid 生成函数(derive t = now→E_FIELD: unknown field 'now')。
影响
多个客户端各自用 max+1 生成 int 主键会冲突(虽然主键唯一约束能拒绝,但业务要自己重试);created_at 依赖客户端时钟,无法保证与提交顺序一致。
设计问题(需要 RFC)
- 生成值必须在事务内确定,且幂等 replay 时保持首次结果(回执已保存完整响应,需确认与生成值兼容)。
- 增量备份 journal、restore、migration shadow generation 必须保持生成值确定(可能需要 sequence 作为 durable 对象并参与 backup/schema hash)。
- 建议最小集:表级
default支持next(seq)/uuid_v7()/now()三个受控默认表达式;先不做通用可变函数。
当前交付与验收
RFC 0027 已由 #460 合入;实现已由 #475 合并至 main b7eb7c3。尚未正式发布,历史 v0.10.0 复现保留为原始报告。
工程验收已覆盖顶层 next(sequence)/uuid_v7()/now()、nominal 类型、字段省略与无副作用 tooling、原子分配/回滚/replay、schema/diff/portable/macro、sequence/default migration 与 shadow abort/resume、真实 CLI/TCP/HTTP、进程退出、OS 文件增长失败、两种恢复和耗尽状态。检查不访问开发者已有数据库。bot review 的四项反馈已修复:recoverable migration 在启动 maintenance 前校验生成能力;format 10/14 的 apply/advance 均验证无副作用拒绝、重开/check 和显式安装后的重试,另补 prepare policy drift 与 REPL sequence 补全。另外已复现并修复 review 总结中的低层公开 API 副作用:Database::execute 只在单语句成功后发布候选根;普通和 i64::MAX 的单条/批量失败不消耗共享 sequence,也不改变行、索引、RowId 或写集。最新完整 http/http-client 测试与 fmt/check/严格 clippy 通过;最新 head 69f8f9d 的 Ubuntu CI(37153094512)已全部通过;bot 已完成对最新 head 69f8f9d 的实际增量复审(run 2cc91446-b8d6-4fe1-b4ac-3edfa46d90cc),无新增 actionable comments;四条原反馈已修复并 resolved。#475 已合并至 main b7eb7c3。
存储前置设计已由 #439/#474 的 native format 14 基础实现明确:显式安装 generated_defaults capability 和 catalog codec 8,不增加 feature/journal 成对格式号;默认格式仍为 10,软件版本与 release contract 未改。#439 的正式发布验收仍保持开放。实际 v0.13.2 与从 b60929d 编译的 format-14-aware 旧 reader 分别证明新布局/未知能力的明确拒绝,完整逻辑状态不变。
- 实现 review/合并:RFC 契约验收、四条 bot comments 和公开 Database 回滚反馈已处理,最终 69f8f9d CI 与实际 bot review 通过,#475 合并至 b7eb7c3。
- parser/formatter/binder、schema/source/diff、无副作用 prepare/explain/read-only 与 Rust macro 输入契约(候选实现验证)。
- 候选根内生成与 counter:batch/脚本/字段声明顺序、显式覆盖、constraint/expect/deadline/cancel 原子回滚(候选实现验证)。
- 与 #439 对齐的版本/能力设计;小写集、receipt/journal 原子持久提交、实际旧软件拒绝、显式安装和 active journal transition(候选实现验证)。
- sequence/default migration、shadow abort/resume、重开/check/compaction、逻辑与指定 sequence 的增量恢复、i64::MAX 持久耗尽(候选实现验证)。
- 正式版本交付:完成最新 CI/review 和发布验收,在 Discussions 发布中英双语使用指南。真实 CLI/TCP/HTTP/Rust macro 与内置 docs/agent 的工程部分已验证,发布部分尚未完成。
验收对应:语法见 generated_defaults_syntax;schema/portable/query input 见 generated_defaults_schema;执行/存储/恢复/CLI/TCP 见 generated_defaults;私有时钟/熵、中断、引用失败及工具无副作用见 engine::generation_tests;宏见 query-macro/tests/generated;HTTP 见 http_client::generated_http_retry;内置文档示例见 llm_docs。最新完整 http/http-client 回归、fmt/check/严格 all-target clippy 通过。测试用私有 cfg(test) 源,不开放客户端时钟或随机种子配置。
English Description
The original v0.10.0 Linux report reproduced missing server-generated IDs/time/UUIDs; it remains historical evidence, not a current-binary reproduction.
RFC 0027 merged through #460. #475 merged into main b7eb7c3 and implements the unreleased capability. Engineering acceptance covers controlled top-level defaults, nominal types, omission and side-effect-free tooling, atomic allocation/rollback/replay, schema/diff/portable/macros, migration/shadow recovery, real CLI/TCP/HTTP, process exits, OS file-growth failure, both restore paths and durable exhaustion. Tests use isolated databases. All four bot findings are fixed, including generator capability admission before recoverable maintenance. Format 10/14 and apply/advance cover side-effect-free rejection, reopen/check and retry after explicit installation; prepared policy drift and REPL sequence completion are also covered. The retained low-level public API concern is reproduced and fixed: Database::execute publishes a candidate root only after statement success. Normal and i64::MAX single/batch failures preserve shared sequences, rows, indexes, RowIds and write sets. Full http/http-client tests and fmt/check/strict clippy pass; exact-head Ubuntu CI (37153094512, 69f8f9d) passes. Actual incremental bot review completed for 69f8f9d (run 2cc91446-b8d6-4fe1-b4ac-3edfa46d90cc) with no new actionable findings; all four original threads are fixed and resolved. #475 merged at b7eb7c3.
#439/#474 provides the native format-14 storage foundation: explicitly installed generated_defaults with catalog codec 8, without another feature/journal format pair. Default format 10, software versions and release contracts are unchanged; #439 release acceptance remains open. Actual v0.13.2 and a format-14-aware reader built from b60929d prove explicit rejection of new layout and unknown capability respectively, preserving complete logical state.
- Implementation review/merge: RFC acceptance, all four bot findings and public Database rollback are addressed; exact-head 69f8f9d CI and actual bot review pass; #475 merged at b7eb7c3.
- Parser/formatter/binder, schema/source/diff, side-effect-free prepare/explain/read-only and macro omission inputs (candidate acceptance).
- Candidate-root counters, script/batch/declared-field order, explicit overrides and atomic constraint/expect/deadline/cancel rollback (candidate acceptance).
- #439-aligned storage, incremental counter writes, atomic receipt/journal commit, actual old-reader rejection, explicit installation and active-journal transitions (candidate acceptance).
- Sequence/default migration, shadow abort/resume, reopen/check/compaction, logical/sequence-selected restore and durable i64::MAX exhaustion (candidate acceptance).
- Formal delivery: exact-head CI/review and release acceptance, followed by bilingual usage guidance in Discussions. Actual CLI/TCP/HTTP/macros and bundled docs/agent engineering acceptance passes; publishing is incomplete.
Evidence maps to generated_defaults_syntax, generated_defaults_schema, generated_defaults, engine::generation_tests, query-macro/tests/generated, http_client::generated_http_retry and llm_docs. Full http/http-client regression, fmt/check and strict all-target clippy pass. Private cfg(test) clock/entropy controls are not exposed in public requests. Keep the full issue open until review and release acceptance are complete.
- Lingua principale
- Rust
- Stelle
- 4
- Fork
- 0
- Merge medio
- 32m
- PR unite (30g)
- 54
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di worktools/unionid
-
documentation enhancement priority/P2
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
worktools/unionid#443 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement priority/P2 quality
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
worktools/unionid#441 · 11 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[设计 / Design] 存储格式矩阵每个特性成对膨胀,应解耦 journal 开关与功能能力 / storage-format matrix grows in pairs per featureApertadesign enhancement priority/P1
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
worktools/unionid#439 · 10 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
design enhancement priority/P1
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
worktools/unionid#438 · 18 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di worktools/unionid
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
higress-group/HiRoute#405 ·
I maintainer di solito rispondono entro 1 giorno
-
rust_analyzer flycheck: no CLI way to enable clippy from `check.overrideCommand`Forse già presa @TrapsterDK l’ha presa oggi. Apertaneeds-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
bazelbuild/rules_rust#4392 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
🐞 bug 🧩 bevy_gantz_egui
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
nannou-org/gantz#500 ·
I maintainer di solito rispondono entro 1 giorno