Repository navigation
Conversation
623daae to
0ba3566
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
English
The fold() fast paths (is_ascii() and is_nfc_quick(s.chars()) == IsNormalized::Yes) are byte-for-byte equivalent to s.nfc().collect::<String>().to_lowercase() under UAX #15, and LegacyV55Folded keeps multi-hop upgrades from <v55 safe. Dropping folded also reduces SQLite page reads during search, offsetting on-demand folding.
One stack-level suggestion (non-blocking for this PR on its own): if this ships together with #7288, consider folding the folded column removal into #7288's agent_recall_messages table rebuild rather than running a separate ALTER TABLE ... DROP COLUMN ahead of it. Because migration::run wraps all pending migrations in a single outer SAVEPOINT, running 0057 + 0058 + 0059 back-to-back currently rewrites agent_recall_messages three times inside one uncommitted transaction (~221 s and multi-GiB WAL peak on a 20+ GiB database).
中文
fold() 新增的两个快速路径(is_ascii() 与 is_nfc_quick(s.chars()) == IsNormalized::Yes)按 UAX #15 与原实现 s.nfc().collect::<String>().to_lowercase() 逐字节等价,LegacyV55Folded 也保证了 <v55 跨级升级安全。删掉 folded 后搜索时减少了一倍 SQLite 页读取,足以抵消按需折叠的 CPU 开销。
顺带一个整个 stack 层面的建议(不阻塞本 PR 单独看):如果准备和 #7288 同批上线,可以考虑把删除 folded 列直接并入 #7288 的 agent_recall_messages 重建里,省掉前置的 ALTER TABLE ... DROP COLUMN。因为 migration::run 把所有待跑迁移包在同一个外层 SAVEPOINT 中,0057 + 0058 + 0059 连续跑会在同一个未提交事务里把 agent_recall_messages 整表重写三次(20+ GiB 库上合计约 221 秒,WAL 峰值可达十来 GiB)。
0ba3566 to
bb7dcd5
Compare
|
@Astro-Han Thanks for verifying the UAX #15 equivalence and multi-hop |
bb7dcd5 to
5434942
Compare
5434942 to
02f4a3c
Compare
Remove the redundant NFC/lowercased mirror column folded from agent_recall_messages in migration 0059: - Drop agent_recall_messages.folded via ALTER TABLE DROP COLUMN. - Fold the already-masked message body on demand in recall/query.rs, with ASCII and is_nfc_quick fast paths in recall::fold() to avoid 3-7x latency regressions on high-frequency and CJK queries. - Keep migration 0055's historical data hook (migrate_external_effect_observations) writing the v55 folded column so multi-hop upgrades from <v55 succeed cleanly before migration 0059 drops it, while runtime indexing targets the current schema without legacy branches. - Add fold equivalence unit tests and verify the dropped column in migration_tests and upgrade_compat.rs. Refs #7272 Generated-by: Antigravity
02f4a3c to
7e35a52
Compare
English
PR 2/8 in the #7272 storage optimization stack (stacked on #7285; rebased onto
mainafter0057_pinned_memory.sql).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
Removes the redundant NFC/lowercased mirror column
foldedfromagent_recall_messagesin migration0059_drop_recall_folded.sql:agent_recall_messages.foldedviaALTER TABLE DROP COLUMN.recall/query.rs, with ASCII andis_nfc_quickfast paths inrecall::fold()to avoid regressions on high-frequency and CJK queries.0055's historical data hook writing the v55foldedcolumn for multi-hop upgrades while runtime indexing targets the current schema with zero legacy read branches.Offline Real-DB Verification (24.34 GiB CoW Clone)
m0059:70.78 s, live size24,669.68 MiB -> 22,715.51 MiB(-1,954.17 MiB/-1.91 GiB)Refs #7272
中文
#7272 存储优化系列第 2/8 个 PR(基于 #7285,已同步 rebase 到
main0056之后)。系列栈(#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 迁移)改动内容
在迁移
0059_drop_recall_folded.sql中移除agent_recall_messages.folded冗余镜像列,改为在recall/query.rs按需折叠(recall::fold()带 ASCII 与is_nfc_quick快路径),同时保持多跳升级经过0055时的数据钩子兼容,运行时零历史兼容分支。真实库离线实测(24.34 GiB CoW 克隆)
m0059:70.78 s,活跃数据24,669.68 MiB -> 22,715.51 MiB(-1,954.17 MiB/-1.91 GiB)Refs #7272