Repository navigation
Conversation
75a77a5 to
c451733
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
English
I ran the full 7-PR stack (#7285–#7290 + #7318 at c45173350e) end-to-end on an offline CoW clone of my real 1,714.77 MiB database (~130 MiB actual content, previously 13.2×):
- After migrations (
m0056–m0064) + full background recompression +incremental_vacuum(512)(no fullVACUUM):726.51 MiB(-57.6%, 5.6×). - After full
VACUUM:641.55 MiB(-62.6%, 4.9×) — hitting the 3–5× target in place even before #7290's new-write structural dedup applies. application_*dropped -58.3% (54.18 -> 22.58 MiB,m0063took1.40 s),agent_cells*dropped -63.5% (22.53 -> 8.23 MiB,m0064took0.85 s), andagent_usage*dropped -43.8% (38.62 -> 21.69 MiB).PRAGMA foreign_key_check(0errors),PRAGMA quick_check(ok), and FTS5integrity-checkall passed.
One must-fix bug before merging
- Missed compressed-column reader in
plugins/agent/state/src/usage/auxiliary.rs:387-395:AuxiliarySource::ApplicationOperationstill querieso.request_json, k.contract_jsondirectly and reads them withr.get::<_, String>(2)?/r.get::<_, String>(3)?. Because0063and the new write paths store both columns as SQLiteBLOBs (zstd-compressed or raw bytes),r.get::<_, String>will fail deterministically withInvalidColumnType(..., Blob)on anyAuxiliarySource::ApplicationOperationcall. Updating it to reado.request_encoding/k.contract_encodingand decode viamaka_event_log::content::decode_inline_text(plus a regression test) fixes this.
Minor notes
- Single-
SAVEPOINTsynchronous rebuild on very large DBs: On my 1.71 GiB DBm0063+m0064only took2.25 s, which is great, though both rebuild and compress synchronously inside the outerSAVEPOINTviaTEMPtables—worth keeping an eye on total WAL peak when combined withm0059/m0060on 20+ GiB DBs. - Module naming drift:
migrate_v62.rs(actually migration0063) andmigrate_v63.rs(actually migration0064) are off by one after the0056rebase.
中文
我在本地真实 1,714.77 MiB 库(约 130 MiB 实际内容,原 13.2×)的离线 CoW 克隆上端到端跑完了整个 7-PR 栈(#7285–#7290 + #7318,c45173350e):
- 迁移(
m0056–m0064)+ 全量后台重压 +incremental_vacuum(512)(不跑全库VACUUM):726.51 MiB(-57.6%,5.6×)。 - 全库
VACUUM后:641.55 MiB(-62.6%,4.9×)——还没算 #7290 对新写入的结构去重,原地升级就已经打进了 3–5× 目标。 application_*下降 -58.3%(54.18 -> 22.58 MiB,m0063仅耗时1.40 s),agent_cells*下降 -63.5%(22.53 -> 8.23 MiB,m0064仅耗时0.85 s),agent_usage*下降 -43.8%(38.62 -> 21.69 MiB)。PRAGMA foreign_key_check(0错)、PRAGMA quick_check(ok)与 FTS5integrity-check全部通过。
合并前必须修的一处 Bug
plugins/agent/state/src/usage/auxiliary.rs:387-395漏改压缩列读取:AuxiliarySource::ApplicationOperation仍直接查询o.request_json, k.contract_json并用r.get::<_, String>(2)?/r.get::<_, String>(3)?读取。由于0063和新写路径都将这两列以 SQLiteBLOB写入(zstd 压缩或原始字节),触发AuxiliarySource::ApplicationOperation时会稳定报InvalidColumnType(..., Blob)。改为同时读o.request_encoding/k.contract_encoding并经maka_event_log::content::decode_inline_text解码(并补一条回归测试)即可修复。
其余小点
- 超大库单
SAVEPOINT同步重建:在我 1.71 GiB 库上m0063+m0064合计只要2.25 s,速度很快;不过两者在单外层SAVEPOINT内同步走TEMP表压缩重建,20+ GiB 库上叠在m0059/m0060后面时建议一并留意总 WAL 峰值。 - 模块命名偏移:rebase 到
0056之后,migrate_v62.rs(实际为0063)与migrate_v63.rs(实际为0064)和实际迁移版本号差 1。
c451733 to
67c5436
Compare
English@Astro-Han Thanks for testing end-to-end on your real DB clone and catching
Full top-of-stack verification on
中文@Astro-Han 感谢在真实库克隆上端到端实测并揪出
栈顶
|
|
Posted by Claude Opus 5.5 (AI). A data point from a different workload, measured on the full stack at The database. A desktop trial root created on 11-23, so every row was written by current The upgrade. On a
With image bytes taken out of both sides, the upgraded file is about 14× its text content. Where the 246 MiB is, per step (246 MiB ÷ 928 steps ≈ 265 KiB; new text content ≈ 15 KiB per step):
Prompt chunks.
Two questions:
|
English@UncertaintyDeterminesYou4ndMe Thanks a ton for measuring on a fresh post-#7102/#7115 screenshot-heavy DB — that per-step breakdown was super valuable! Answering both questions:
In fact, tracing your prompt-chunk finding uncovered an even bigger multiplier in I just opened #7341 (stacked on #7318, zero SQL migration) to fix this cleanly via The other two buckets you called out — 中文@UncertaintyDeterminesYou4ndMe 非常感谢在 回复你的两个问题:
顺着你指出的 prompt chunk 重复 base64 查代码,发现现场比预想的更夸张: 刚在 #7318 上面补了 #7341(零 SQL 迁移),通过 |
67c5436 to
b4da5ca
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
English
Confirmed on b4da5cabea that plugins/agent/state/src/usage/auxiliary.rs:384-429 now selects o.request_encoding and k.contract_encoding and decodes both BLOB columns via decode_inline_text (with regression coverage for both compressed and raw rows). I also audited all remaining Rust and SQL readers of application_*, agent_cells, and agent_usage_calls with no unmigrated raw reads left, and verified 0064/0065 match migrations.lock.json and upgrade_compat.rs.
Minor non-blocking note: the header comments in 0064_compress_application_tables.sql:20 and 0065_compress_cells_and_usage.sql:19 still mention migrate_v62 / migrate_v63 (if you touch them before merge, remember to refresh migrations.lock.json).
Ready to merge once the base stack lands.
中文
已确认 b4da5cabea 中 usage/auxiliary.rs:384-429 已读取 request_encoding / contract_encoding 并通过 decode_inline_text 解码(含压缩与原始行回归测试);排查了全仓对 application_*、agent_cells、agent_usage_calls 的全部读点无遗漏,且 0064/0065 与 migrations.lock.json、upgrade_compat.rs 完全对齐。
小提示:0064/0065 SQL 头部注释里还留着 migrate_v62 / migrate_v63(合并前若修改需同步刷新 migrations.lock.json)。前置 PR 合并后可直接合入。
b4da5ca to
aa95520
Compare
|
@Astro-Han Quick heads-up on the rebase push |
…ntern usage JSON blobs
Compress remaining large non-contents JSON tables and intern repeated usage
JSON metadata via atomic forward migrations 0064 and 0065:
- Migration 0064 (platform/event-log): rebuild and compress
application_operation_contracts.contract_json,
application_operations.request_json, and
application_intents.{reference_json, recovery_json} with inline encoding
columns (preserving sqlite_sequence cursor, FKs, triggers, and views) and
decode via content::decode_inline_text / maka_content_text.
- Migration 0065 (plugins/agent/state): rebuild and compress agent_cells.body
with promoted (owner_attempt, owner_call) columns backing agent_cell_parent,
and intern repeated agent_usage_calls.{binding_json, quote_json} into
agent_usage_json_blobs (registered in store/removal.rs).
- Update all agent_cells and usage SQL queries (including quiescence,
source_tree, and reconcilable waits) and verify v64/v65 invariants in
upgrade_compat.rs.
Refs #7272
Generated-by: Antigravity
aa95520 to
40ce0fa
Compare
English
PR 7/8 in the #7272 storage optimization stack (stacked on #7290; rebased onto
mainincluding0057_pinned_memory.sql, #7315, and #7317).Stack (#7272)
m0058)agent_recall_messages.folded(m0059)m0060)(owner, session)strings withnamespace_id(m0061)contents(m0062–m0063)application_*&agent_cells, internagent_usage_callsJSON blobs (m0064–m0065)Layout v3, zero SQL migration)Summary
Compresses the remaining large non-
contentsJSON tables and interns repeated usage JSON metadata via atomic forward migrations0063and0064:0064_compress_application_tables.sql(platform/event-log): Rebuilds and compressesapplication_operation_contracts.contract_json,application_operations.request_json, andapplication_intents.{reference_json, recovery_json}with inline encoding columns (preservingsqlite_sequencecursor, FKs, triggers, and views), decoded viacontent::decode_inline_text/maka_content_text(includingusage/auxiliary.rs::AuxiliarySource::ApplicationOperation).0065_compress_cells_and_usage.sql(plugins/agent/state): Rebuilds and compressesagent_cells.bodywith promoted(owner_attempt, owner_call)columns backingagent_cell_parent, interns repeatedagent_usage_calls.{binding_json, quote_json}intoagent_usage_json_blobs(registered instore/removal.rs), updates all cell/usage queries, and verifies v64/v65 invariants inupgrade_compat.rs.Offline Real-DB Verification (24.70 GiB CoW Clone at
67c5436130)Measured end-to-end on an offline APFS copy-on-write clone of a real
24.70 GiBSQLite database (25,292.53 MiB,2,400,872contentsrows,1,125,026agent_recall_messagesrows) with the reproducible pure-schemadict_v1.binand 8 MiB production recompression budget:VACUUM)contents*agent_recall*agent_session_history*application_*agent_usage*agent_cells*agent_facts+pins*agent_memory*otherVACUUMlive)VACUUM)m0058:0.25 s|m0059:80.57 s|m0060:333.71 s|m0061:55.79 s|m0062/m0063:0.00 s|m0064:8.49 s|m0065:6.48 s| background recompress (8 MiB budget):125.26 sPRAGMA foreign_key_check = 0,PRAGMA quick_check = ok,FTS5 integrity-check = OKTests
node scripts/ci.mjs check migrations— PASS (74 locked, 0 pending)node scripts/asf-license-headers.mjs check— PASSnode scripts/ci.mjs check i18n&tooling-tests(447/447) — PASScargo fmt --check&cargo clippy --no-deps -p maka-event-log -p maka-agent-facts -p maka-agent-state --all-targets -- -D warnings— PASScargo nextest run -p maka-event-log -p maka-agent-facts -p maka-agent-state -p maka-agent-engine— 255/255 PASSmaka-agent-nativetests (fix(agent,workbench): resolve transcript anchors for session search jumps #7315 jump anchors, fix(agent): prevent superseded compaction re-adoption and unbrick crossed timing reads #7317 compaction checkpoints, compact cell/external effect, recall) — 10/10 PASScargo nextest run -p maka-cli --test upgrade_compat upgrade_compat_capsule_roundtrip— PASSRefs #7272
中文
#7272 存储优化系列第 7/8 个 PR(基于 #7290,已同步 rebase 到含
0056、#7315、#7317 的main)。系列栈(#7272)
m0058)agent_recall_messages.folded冗余列(m0059)m0060)namespace_id替换重复(owner, session)字符串(m0061)contents分档/静态字典 zstd 压缩与后台存量重压(m0062–m0063)application_*与agent_cells并对agent_usage_callsJSON 字典驻留(m0064–m0065)Layout v3,零 SQL 迁移)改动内容
通过原子前向迁移
0063与0064压缩剩余非contents大 JSON 表并对重复用量 JSON 做字典驻留:0064_compress_application_tables.sql(platform/event-log):原子重建并压缩application_operation_contracts.contract_json、application_operations.request_json与application_intents.{reference_json, recovery_json}(保留sqlite_sequence游标、外键、触发器与视图),通过content::decode_inline_text/maka_content_text透明解码(含usage/auxiliary.rs::AuxiliarySource::ApplicationOperation)。0065_compress_cells_and_usage.sql(plugins/agent/state):原子重建并压缩agent_cells.body,提升(owner_attempt, owner_call)显式列支撑agent_cell_parent索引;将重复agent_usage_calls.{binding_json, quote_json}驻留到agent_usage_json_blobs(同步登记至store/removal.rs);更新全部agent_cells/usage查询点并在upgrade_compat.rs中验证 v64/v65 不变量。真实库离线实测(24.70 GiB CoW 克隆,
67c5436130)在
24.70 GiB真实 SQLite 库离线 APFS CoW 克隆(25,292.53 MiB、2,400,872条contents、1,125,026条agent_recall_messages,使用可复现纯 schemadict_v1.bin与生产 8 MiB 重压预算)上的整栈端到端实测结果:VACUUM)contents*agent_recall*agent_session_history*application_*agent_usage*agent_cells*agent_facts+pins*agent_memory*otherVACUUM前活跃页)VACUUM后)m0058:0.25 s|m0059:80.57 s|m0060:333.71 s|m0061:55.79 s|m0062/m0063:0.00 s|m0064:8.49 s|m0065:6.48 s| 后台重压(8 MiB 预算):125.26 sPRAGMA foreign_key_check = 0,PRAGMA quick_check = ok,FTS5 integrity-check = OKRefs #7272