【发布时间】:2012-11-28 19:56:17
【问题描述】:
我有一个 Mnesia 数据库,当我重新启动我的应用程序时,我在待处理的事务中收到错误 (badarg)。我认为即将插入无效值。 如何检查待处理事务以查找错误值是什么,以及如何在不删除整个数据库的情况下从待处理事务中删除该值。
更新:
崩溃报告如下:
{badarg, [{ets, insert, [{image_db...}, {image_db...}...]
image_db 是我插入数据库的结构。不幸的是,要插入的项目列表太长,我看不到损坏的值。
mnesia:info() 命令在启动时显示 1 个中止事务。
更新 2:
如何读取 mnesia db 目录下的二进制日志文件?
更新 3:
这是一个本地单节点 Mnesia 表。我这样初始化它:
mnesia:stop(),
catch(mnesia:create_schema([node()])),
mnesia:start(),
timer:sleep(1000), % vital but ugly as hell
mnesia:create_table(?DBNAME, [{disc_copies, [node()]}, {type, ordered_set},
{attributes, record_info(fields, image_db)}]),
mnesia:wait_for_tables(?DBNAME, 1000),
image_db 记录如下所示:
-type now_time() :: {integer(), integer(), integer() }.
-record(image_db, {time :: now_time(),
path :: string(),
size :: integer() }).
问题不时出现,我认为是在将无效记录插入数据库后。我现在添加了一个记录验证功能来避免这种情况,但问题仍然存在,如何通过删除存储事务中的无效值来恢复数据库?
【问题讨论】:
-
请准确显示您遇到的错误