yl32940

yl32940 pushed tag gormvrtx/v1.8.0 to yl32940/TsDB2

2 weeks ago

yl32940 pushed tag v1.10.0 to yl32940/TsDB2

2 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • 25edee6ef6 fix(close): BufferPool.Close 返回刷盘错误 + File.Close 合并传递, 删掉脑补的 defer recover 问题: 之前 BufferPool.Close 吞掉 Flush 错误, File.Close 也没处理 bp.Close 的结果 —— 写盘失败的脏页永远留在缓存, Close 返回 nil 调用方以为成功, 静默丢数据 修复: BufferPool.Close 直接返回 bp.Flush(); File.Close 合并 bp error + f.Close error, DB.Close 已有 errors.Join 会带出去 同时删掉之前脑补的 defer recover + re-panic: diskWrite 底层是 os.File.WriteAt 只返回 error 不 panic; 进程级 panic 没人 recover 时 Go runtime exit → OS 内核自动 CloseHandle 所有句柄 → 文件锁自动释放, 不会残留 代价零: 正常代码路径无任何行为变化, 只是 error 不再被吞
  • 0fb009b135 fix(engine): recoverHeader 裸 WriteAt 加 bp.UpdatePage + Close panic-safe unlock + VACUUM 异步 GC 1. CRITICAL: wal_recovery.go recoverHeader — 补上了和 writeHeaderLocked 同性质的 bug: 裸 WriteAt(0) 绕过 BufferPool, Close 时 bp.Flush 会把陈旧页 0 缓存覆盖 recoverHeader 刚落盘的头页 2. HIGH: file.go Close — 加 defer recover, 防止 bp.Close()/diskWrite panic 导致 unlock 跳过 → Windows LockFileEx 锁残留 → 下次 Open 永久 ErrDatabaseLocked 3. MEDIUM: deleter.go VACUUM — 两处同步 debug.FreeOSMemory() 改成后台 goroutine, 大表 VACUUM 时 GC 峰值数秒不再阻塞主流程
  • c09d532c86 chore(const): update VersionComment to v12 with this session's engine fixes
  • ac5904de91 refactor(const): extract 5 hardcoded magic numbers into const.go Extracted from production code (not tests): - MaxBufferPoolCapacity=8000: adaptive pool cap in OpenWithOptions - FileLockByteCount=1: LockFileEx lock range length (was local const lockByteCount) - BlobChainMax=256*1024: blob chain length limit (was local const in blob_writer.go) Kept local in pool sub-package (can't import parent, documented rationale): - evictSample=32: LRU sampling window (internal tuning, not library config)
  • 9e74258b42 fix(engine): comment polish + gitignore analyzer diagnostic output
  • View comparison for these 9 commits »

2 weeks ago

yl32940 pushed tag v1.9.5 to yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • 860819fca1 Merge commit '0eb3be3'
  • 5d0e429ee6 写操作提交栅栏 + 孤儿 WAL 自愈 + 审计器 WAL 重放 根因 (DockerManager 生产事故): 插入一行要脏"数据页+主键页+二级索引页", 脏页阈值触发的中途提交会把同一操作切成两笔 WAL; kill 落在切点时 "数据页已提交、索引页未提交"被烧成正式状态 —— 行按主键在、按二级索引 永远查不到 (monitor_metrics 2 行 + 1665 个裂页残留 child 指针)。 显式事务本就被 currentTxn 挡住自动提交, 普通写入路径没有这个保护。 - DB: opDepth/beginOp 提交栅栏, 挂到插/改/删/批量删重建/建索引共 7 个 多页写路径; 操作期间阈值与防抖提交一律抑制, 收尾按 DirtyOverThreshold 条件补提交 (阈值被越过立即提交, 否则重新武装防抖) - DB: 孤儿 WAL 链启动自愈 healOrphanWALPages (空闲链自洽才动手, 只回收不重放 —— 已提交事务的回写必先于指针清零落盘) - DB: 头页仅在有真实变更 (分配游标移动) 时随 WAL 落盘 - analyzer: 检测到待恢复 WAL (FirstWALPage!=0) 时先拷临时副本重放 再审计, 不再把"未重放"误报成 CORRUPT - demo/idx_crash_chaos: 二级索引断电混沌 (阈值=1 + 随机强杀 + 逐行反查); 禁用栅栏第 1 轮即复现幽灵行, 启用后 360 轮全过 验证: wal_crash_chaos 120 轮 / txn_crash_chaos 60 轮 / DB、DB/core、 migrate、analyzer 全量测试无回归
  • View comparison for these 2 commits »

3 weeks ago

yl32940 pushed tag v1.9.4 to yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • 0eb3be3445 perf(pool): 采样淘汰替代全表扫描 — 修掉写路径 O(n×淘汰数) 退化 evictCleanForRoomLocked 曾为每次淘汰全表扫 pages map 找最小 touch: 池满后每次 WritePage 都触发, Commit 留下的干净页会让一轮写入连续淘汰 几十上百页, 批量插入/VACUUM 重建下等于每行写入全扫一遍池 (4000 页池一轮千次淘汰 ≈ 千万次条目扫描, 毫秒级卡顿)。 Redis 风格采样: Go map 遍历顺序随机, 取前 32 个候选选最冷干净页, O(K) 与池大小脱钩; 池 ≤32 时覆盖全池即精确 LRU。读路径 RLock+atomic touch 的'一写多读'设计不受影响。 回归: TestEvictBurstAfterCommit(一轮 500 次采样淘汰)/TestEvictSkipsDirtyPages; 基准 BenchmarkEvictBurst: 2001 次淘汰/轮 1.17ms (旧实现 ≈ 0.5-1s)

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

3 weeks ago

yl32940 pushed tag v1.9.2 to yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • a7d0c72713 feat(driver): VACUUM 语句 — db.Exec("VACUUM") 直接整库重建 - parser: 新增 kVacuum, 裸语句 (大小写/空白不敏感), 无子句 - exec: db.VACUUM() 透传, RowsAffected=复制行数; 活跃事务中引擎拒 (ErrTxnActive), 只读模式报错不动文件; Close/Open 切换由引擎串行锁 与驱动 shared.mu 双重挡住并发 - 场景: 生产库 analyzer 报 CORRUPT (panic 时代遗留: 1302 WAL 残留页 / 28 悬空索引项 / 缺条目 / 坏槽位), VACUUM 重建后全部归零, 文件 227→198MB - 测试: TestP1Vacuum (重建保真/继续读写/大小写形态) + TestP1VacuumInTxn - 文档: SQL_DRIVER_GUIDE 维护语句章节

3 weeks ago

yl32940 pushed tag v1.9.1 to yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • fa9c420a94 feat(analyzer): blob 链可达性 — 修复 44 页孤儿误报 + 取证/复现工具 根因: analyzer 可达页集合从不走 blob 链 (Type=9), 带 blob 列的库 (sys_logs.param 等) 全部 blob 链页被误报孤儿。DockerManager 实测库 44 页孤儿 = 44 页活 blob 链页, 真实泄漏 0 (orphanaudit 双口径对账)。 - analyzer/blobwalk.go: 从行存储 B+ 树根 BFS, 逐叶条目认领数据页, 抽行内 BlobRef 走链 — 可达集合补上 blob 链; audit/web/pagemap 挂接 - analyzer/main.go: decodeFieldValue 补 FieldType_DateTime (19) 分支 - internal/orphancheck: 双口径取证 (analyzer 口径对账 + 引擎只读扫描) - cmd/orphanaudit: 对任意副本跑双口径 (只读, 绝不写原件) - cmd/mrepro: sqlite→VRTX 迁移±VACUUM 复现, 真实孤儿>0 时 exit 1 - migrate/orphan_pages_test.go: 迁移+VACUUM 后真实孤儿=0 回归 实测: 用户库 44→0; docker.db.sqlite 迁移 (±VACUUM) 真实孤儿均=0, blob 链 38 条断裂 0; VACUUM 后 248MB→194MB 链完好
  • 5d1e5fe54a fix(core): 行写入失败回收新落 blob 链 — 堵住两条链页泄漏路径 - serializeRowInternal: blob 列先行落链, 后续列编码/布局失败时本次新落的 链成为孤儿页; 现在 defer 兜底只还 owned 链 (本次新落), 透传引用不碰 - InsertRowWithID/InsertRowsWithIDs: 唯一冲突的预检先于任何索引写入, 冲突时序列化已落的链整行/整批归还; 其它部分写入错误仍靠事务回滚 - blobFieldRef/blobRefFromValue 返回 owned 标记; blobCommit 注释同步 - 回归: DB/core/blob_leak_test.go (编码失败 / 唯一冲突两例)
  • View comparison for these 2 commits »

3 weeks ago

yl32940 pushed tag v1.9.0 to yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • 0ec004b453 feat(driver,core): SQLite 方言 || 拼接 LIKE — ','||col||',' LIKE '%,x,%' 元素匹配 生产触发 (DockerManager base.go:309): SELECT * FROM sys_services WHERE ','||service_name||',' like '%,check,%' — tokenizer 遇 '|' 报错。tokenizer 增 || punct; WHERE 左操作数支持 字面量||列||... 拼接链, 仅 [NOT] LIKE 允许 (其它比较符明确报错); core 新增 ConcatLikeCondition (逐分量拼串+likeMatch, 复用抽取的 Table.likeFieldText; LikeCondition 行为不变); JOIN 路径适配 (下推/残余谓词/NULL 语义)。生产形态测试: 元素匹配精确语义 + 占位符模式 + 软删组合 + 错误指引。

3 weeks ago

yl32940 pushed tag v1.8.1 to yl32940/TsDB2

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • 554eab6e94 fix(core): VACUUM 搬运 Blob 链内容 — 修复重建后读取 BLOB 列 EOF/损坏 DockerManager 上游报告+二分实锤: 同一源数据 migrate 后直读正常, 过一遍 VACUUM 后 param>16360 的行 (Blob 链式列) 读取必崩。机制: vacuumScan 用 deserializeRowKeepNull 拍行快照, Blob 列产出的是 8B BlobRef — 指向【旧 文件】的链页; 行搬进新库后链页并不存在, 引用悬空 (读取报 corrupted/ EOF, 视垃圾内容而定)。Blob 链页面不在行重写路径的搬运范围里。 修复: 扫描阶段对 Blob 列物化 — tbl.BlobRead(ref, CompressNone 写侧约定) 把链内容读成字节填回 vals, 新库序列化走 blobFieldRef 落【新链】。物化 失败让整个 VACUUM 报错返回 (不静默跳行丢数据)。红→绿: 修复前 'blob corrupted: decoded length mismatches TotalLen', 修复后 60000B 逐字节一致。新增 TestVacuumBlobChain 钉住。

3 weeks ago

yl32940 pushed to master at yl32940/TsDB2

  • 52b36b45a8 test(migrate): 现场复验 — 59566B TEXT→Blob 迁移 + 驱动分页查询逐字节读回 DockerManager 报'读取 BLOB 列 param: EOF'的上游对照用例: 20 行 (19×59566B + 1 小值) 经 migrate 落 Blob 列, LIMIT/OFFSET 翻页全读回逐字节一致。 上游链路健康, EOF 源于目标文件被多次中断迁移叠加损伤 (同 B+树 panic 现场的次生伤)。

3 weeks ago