Skip to content

[Subtask]: Add dictionary vector representation and immutable ownership #32383

Closed

Description

@aunjgr

Parent Issue

#32379

Detail of Subtask

Add the in-memory representation over one immutable flat/constant snapshot and accounted shared int64 row selections; compose selections, retain backing, preserve per-row metadata and implement transactional copy-on-write/materialization. Keep raw physical access explicit and persisted/wire format unchanged.

Status: approved staged work; no delivered implementation or performance claim yet. See versioned design #32380. Dependencies follow the seven-PR series; no dependent producer enablement before prerequisites merge.

Describe implementation you've considered

Use immutable snapshots and shared selections, existing allocation/lease machinery and explicit read/materialization contracts. Every live backing has one effective release owner and a physical bound. Unsupported ownership or consumers retain ordinary accounted materialization.

Additional information

Acceptance: Neutral infrastructure: no confirmed regression; no production dictionary producer enabled.

Activity

  1. self-assigned this
    on Nov 8, 2026
  2. added
    severity/s0
    on Nov 8, 2026
  3. aunjgr commented on Nov 9, 2026

    @aunjgr
    ContributorAuthor

    Implementation opened as draft #32394: immutable base/selection ownership, typed read views, explicit COW/flattening and serialization guards; no SQL producers enabled. Functional/race and full local pre-push checks pass. The completed source-pinned SF10 all22 RAM/disk screen has no confirmed query or Total regression; its complete wall/CPU tables and Total rows are appended to the PR conversation. SF100 and fresh current-main qualification remain open.

  4. aunjgr commented on Nov 9, 2026

    @aunjgr
    Author
  5. aunjgr commented on Nov 9, 2026

    @aunjgr
    ContributorAuthor

    Lease-backed dictionary candidate: local SF10 acceptance complete.

    Source pins: main 843929f68611f873ca63674a61ab4b2cdf5ee915; candidate bfd6e89de57fe41e5a64fd9b9d7241da74370283. This candidate includes the newest-main Decimal64 aggregation change on both sides. The current published PR head is still cd15bdb20f; this is an unpublished replacement candidate, and SF100 acceptance remains pending.

    The composite descriptor uses the existing dataLease slot, restoring main's 480-byte Vector header/allocation. Local changed-code coverage is 77.89% with the CI parser and unchanged 75% threshold; full static checks and the owning/race proofs pass. This is a neutral foundation gate, with no confirmed Q6 benefit or root-cause claim.

    Neutral dictionary foundation screen: PASS. SF100 qualification remains separate.

    Five independent process pairs per mode, one excluded cold full suite and one scored warm full suite per startup. All Q1–Q22 are executed/drained. Times below are paired sample means; Total is the sum of per-query wall/CPU times. Raw paired 95% intervals and Holm query tests are retained. No data/result verification.

    RAM-backed SF10

    Query Main wall (s) Core wall (s) Paired wall change Raw 95% interval Main CPU (s) Core CPU (s) Holm slowdown
    Q1 0.210423 0.200806 -4.45% [-11.43%, +3.09%] 5.930055 5.887686 none
    Q2 0.029575 0.029446 -0.47% [-8.23%, +7.95%] 0.417236 0.407357 none
    Q3 0.098820 0.095931 -2.76% [-10.85%, +6.08%] 2.283362 2.229177 none
    Q4 0.064326 0.064545 -0.02% [-10.27%, +11.39%] 1.562041 1.594002 none
    Q5 0.080022 0.074592 -6.62% [-14.14%, +1.56%] 1.602864 1.656057 none
    Q6 0.032391 0.031945 -1.24% [-19.63%, +21.37%] 0.735721 0.755929 none
    Q7 0.082306 0.077257 -5.96% [-16.16%, +5.49%] 1.924309 1.839876 none
    Q8 0.222653 0.220996 -0.61% [-8.88%, +8.41%] 2.036982 2.044023 none
    Q9 0.242591 0.239415 -1.33% [-6.28%, +3.88%] 5.299812 5.262810 none
    Q10 0.192713 0.186944 -2.97% [-5.01%, -0.89%] 4.577683 4.516731 none
    Q11 0.035146 0.035684 +1.34% [-7.75%, +11.32%] 0.542658 0.591246 none
    Q12 0.083054 0.083430 +0.48% [-5.86%, +7.24%] 2.215475 2.158993 none
    Q13 0.129233 0.130223 +0.77% [-0.53%, +2.09%] 3.616241 3.630737 none
    Q14 0.072153 0.074287 +2.97% [-1.36%, +7.49%] 1.083929 1.158015 none
    Q15 0.158789 0.156117 -1.63% [-9.66%, +7.12%] 1.941478 1.814494 none
    Q16 0.127725 0.124663 -2.39% [-5.94%, +1.29%] 1.351602 1.332730 none
    Q17 0.071524 0.070329 -1.66% [-12.78%, +10.88%] 1.769842 1.745817 none
    Q18 0.332867 0.328583 -1.26% [-3.30%, +0.82%] 6.237068 6.272050 none
    Q19 0.111085 0.112695 +1.45% [+0.37%, +2.54%] 2.788493 2.803137 none
    Q20 0.160232 0.160790 +0.37% [-1.26%, +2.03%] 3.663360 3.660420 none
    Q21 0.309312 0.302789 -2.12% [-4.52%, +0.34%] 8.173983 7.865589 none
    Q22 0.046525 0.049454 +6.15% [-1.88%, +14.85%] 1.007424 1.035311 none
    Total (sum Q1–Q22) 2.893465 2.850920 -1.47% [-2.00%, -0.94%] 60.761618 60.262188 separate Total gate

    Disk-backed warm SF10

    Query Main wall (s) Core wall (s) Paired wall change Raw 95% interval Main CPU (s) Core CPU (s) Holm slowdown
    Q1 0.200643 0.208143 +3.72% [-0.33%, +7.93%] 5.940462 6.011591 none
    Q2 0.029812 0.030284 +1.57% [-5.20%, +8.82%] 0.422957 0.411271 none
    Q3 0.096727 0.099538 +2.90% [-6.82%, +13.62%] 2.323131 2.326298 none
    Q4 0.064677 0.062078 -3.84% [-12.39%, +5.55%] 1.614066 1.564342 none
    Q5 0.076636 0.075537 -1.43% [-6.70%, +4.13%] 1.663302 1.586663 none
    Q6 0.029474 0.030464 +3.55% [-8.46%, +17.14%] 0.701508 0.683321 none
    Q7 0.080417 0.079873 -0.60% [-12.50%, +12.92%] 1.959663 1.916116 none
    Q8 0.222301 0.226453 +1.93% [-7.13%, +11.89%] 2.029779 2.018247 none
    Q9 0.243073 0.253024 +4.11% [-1.01%, +9.50%] 5.440227 5.529497 none
    Q10 0.194752 0.193079 -0.91% [-5.71%, +4.13%] 4.700188 4.641234 none
    Q11 0.034314 0.035142 +2.32% [-4.17%, +9.26%] 0.547007 0.550537 none
    Q12 0.084469 0.085396 +1.07% [-2.44%, +4.70%] 2.212333 2.219506 none
    Q13 0.132728 0.132706 +0.02% [-4.91%, +5.20%] 3.754547 3.731694 none
    Q14 0.074742 0.071856 -3.70% [-12.50%, +5.98%] 1.144726 1.153516 none
    Q15 0.156783 0.160493 +2.36% [-4.04%, +9.19%] 1.882570 1.924085 none
    Q16 0.129729 0.130684 +0.81% [-4.76%, +6.70%] 1.436482 1.464738 none
    Q17 0.071382 0.070870 -0.86% [-11.06%, +10.51%] 1.745911 1.734498 none
    Q18 0.325588 0.326691 +0.36% [-5.09%, +6.13%] 6.222556 6.183030 none
    Q19 0.114455 0.113497 -0.78% [-8.49%, +7.57%] 2.772168 2.801743 none
    Q20 0.161019 0.159807 -0.73% [-4.89%, +3.62%] 3.697070 3.658552 none
    Q21 0.314364 0.308297 -1.96% [-10.06%, +6.86%] 8.037743 8.005222 none
    Q22 0.050160 0.050032 -0.21% [-15.53%, +17.90%] 1.043825 1.034913 none
    Total (sum Q1–Q22) 2.888243 2.903945 +0.54% [-1.81%, +2.95%] 61.292222 61.150616 separate Total gate
  6. added a commit that references this issue on Nov 9, 2026
    bf08648
  7. XuPeng-SH commented on Nov 9, 2026

    @XuPeng-SH
    Contributor

    QA 交接:#32394 已合入 main,merge SHA bf086489bae357159b53f8bcdfc04082ca55b210,本次仅交接 #32383 的 dictionary representation/ownership foundation。未启用 SQL dictionary producer,不能代表 #32379 七阶段系列或 #30845/#30850 已完成。

    完整 issue/PR 讨论中的旧 follow-up 已重新核对:此前 cd15 的 Q6 回退对应旧额外字段实现,随后 lease-backed 修订恢复 480-byte Vector header,作者在明确源版本上报告 SF10/SF100 中性门槛完成;不是仅用旧通过记录覆盖失败。最新 ac5af16c 又以 legacy class-2 归一化为 FLAT 解决 decoder/window panic,最终评审 #32394 (review) 明确无未解决 finding,报告 vector/objectio 396/158 个 top-level tests 通过,并在核对实现未变后复用 shared-owner race 证据。作者报告修改行覆盖 308/391(78.77%,原 75% 门槛)和完整静态检查通过。

    性能证据仍绑定 main 843929f68611 与候选 bfd6e89de57f:每个 SF10/SF100 memory/disk profile 五个独立配对进程、完整冷套件排除、Q1–Q22 + Total,报告无确认回退及无 accepted spill/swap/OOM。最终评审复用这些供应证据,没有重新跑 SQL/TPC-H,原始 benchmark samples/CI logs/coverage inputs 未提供。本轮也只核对远端记录,没有本地或 merge SHA 实测,不把中性门槛写成 producer/Q6 加速或最终验收。SF1000 不属于本阶段已批准要求。

    QA 请重点核对 immutable base/selection 引用与恰好一次释放、嵌套 selection 合成、重复/乱序/NULL/grouping/字符串及 prepared metadata、COW/flatten 分配失败事务性、外部 backing pin 拒绝与 accounted fallback、空输出释放 backing、物理 accessor 显式边界,以及 legacy class-2 全列/流式/V1/object-window 解码兼容、输入不变和 pool/spill 清理。按既有 SF10/SF100 全查询与 Total 规则验证基础设施不回退,后续 consumer/producer 启用单独验收;不自动要求 4.2 backport。

  8. Ariznawlll commented on Nov 16, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 官方 main:7fcd9bdff8433d72983f0399fd5c10dcab91a00a;本 subtask 实现 PR feat(vector): add shared dictionary storage and row selections #32394 已 MERGED,merge commit bf086489bae357159b53f8bcdfc04082ca55b210 在该 main 的祖先链。
    • 隔离部署:该 main 本地编译的 mo-service,1 LOG / 1 TN / 1 CN,SQL 端口 17101,全新数据目录;会话确认 git_version() = 7fcd9bdff8。
    • 测试日期:2026-11-16。

    原问题验证

    dictionary 向量表示与 immutable ownership 基础设施按验收标准为中性门槛(无 SQL producer 启用、无确认回退)。QA 交接清单逐项核对:immutable base/selection 引用与恰好一次释放、嵌套 selection 合成、COW/flatten 分配失败事务性、空输出释放 backing、legacy class-2 解码兼容等均由合入源码的配套单测覆盖,全部通过。

    Happy Path 覆盖

    1. pkg/container/vector 全量单测通过(含 dictionary_ownership/scope/workspace 的所有权、租约、COW、序列化守卫测试);pkg/objectio(+ioutil/mergeutil)legacy_column 兼容测试全部通过。
    2. 聚焦 -race:vector 与 disttae 的 Dictionary|Selection|Ownership|Lease|Snapshot 系列测试通过。
    3. SQL 中性验证:无 producer 启用时 SQL 语义完全不变(见下方回归用例的 10 万行低基数语义矩阵,全部精确断言通过)。

    Unhappy Path 覆盖

    1. 不支持的 ownership/consumer 回退普通物化路径(合入源码单测断言外部 backing pin 拒绝与 accounted fallback)。
    2. legacy class-2 全列/流式/V1/object-window 解码兼容与输入不变(objectio 单测覆盖)。

    白盒验证

    核对已合入的 #32394:DictionaryBase(dictionary_ownership.go)immutable 快照 + 计账共享 int64 selection,组合 selection/保留 backing/按行元数据/事务性 COW 在位;复合描述符复用 dataLease 槽位(恢复 480 字节 Vector header)。未修改产品源码。

    回归测试

    已追加 matrixorigin/motr#349:14_issue_regression/issue_32385_32386_dictionary_consumers(含本 subtask 的中性语义断言,33 语句)。PR 作者已在 #32394 内提供源版本钉定的 SF10/SF100 RAM/Disk 中性门槛证据(五组独立配对进程,Q1–Q22 + Total 无确认回退);本地未重复 SF100 基准。

    测试证据

    受影响包单测汇总:pkg/container/vector、pkg/objectio(+ioutil/mergeutil)、pkg/vm/engine/disttae(+cache)、pkg/vm/engine/tae/blockio、pkg/fileservice 全部通过;聚焦 race 通过;motr 回归用例 record + 两轮 diff + -j 2 并行全绿、逐字节稳定。

    测试结论

    测试通过(中性基础设施门槛:无确认回退、无 producer 启用)。

  9. Ariznawlll commented on Nov 16, 2026

    @Ariznawlll
    Collaborator

    中性基础设施门槛验证通过(comment),回归断言在 motr#349。关闭。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/subtaskseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions