vfs_test.go单元测试跑不过 #6683
Replies: 1 comment
-
|
感谢反馈 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
如题
juicefs/pkg/vfs/vfs_test.go 单测跑不过,卡在1128行,testdir已存在
排查了下原因:
代码:
"db": "sqlite3://",
分析:sqlite这里是空路径,
sqlite3://
↓ NewClient 取 "://" 后面 → addr = ""
↓ newSQLMeta: baseUrl="" + "?" + params
↓ DSN = "?_journal=WAL&_timeout=5000&cache=shared"
↓ go-sqlite3: pos=0, 0 >= 1 为 false, 不解析参数
↓ 整个字符串当文件名 → 创建物理文件
↓ cache=shared / WAL / timeout 全部未生效
↓ 多个 xorm 引擎竞争同一文件(无超时)→ hang
↓ 杀进程 → defer 不执行 → testdir 残留
↓ 下次运行 → "file exists
也就是空路径导致实际创了个物理文件出来(如下),而不是数据库参数
[root@localhost vfs]# ll
总用量 1008
-rw-r--r--. 1 root root 14914 2月 25 17:20 internal.go
-rw-r--r--. 1 root root 819200 2月 25 18:00 '?_journal=WAL&_timeout=5000&cache=shared'
导致清理testdir一直走不到,是个必现的问题
修改为:"db": "sqlite3://:memory:",
可以通过测试
Beta Was this translation helpful? Give feedback.
All reactions