Closed mocchira closed 11 years ago
I'll implement this issue in this week. Thanks.
I found a bitcask's problem as the follows:
%% Check key_count: total number is "2"
> leo_backend_db_api:status('test-db').
[[{key_count,0},{status,[]}],
[{key_count,2},
{status,[{"/home/yosuke/dev/temp/bitcask-test/1/1.bitcask.data",0,0,52}]}],
[{key_count,0},
{status,[{"/home/yosuke/dev/temp/bitcask-test/0/1.bitcask.data",100,78,78}]}]]
%% After shutdown and relaunch, Check "key_count": total number is "5" (not expect value)
1> leo_backend_db_api:new('test-db', 3, bitcask, "/home/yosuke/dev/temp/bitcask-test/").
* bitcask - path:/home/yosuke/dev/temp/bitcask-test/0, handle:#Ref<0.0.0.98>
=ERROR REPORT==== 20-Jun-2013::22:03:34 ===
Hintfile '/home/yosuke/dev/temp/bitcask-test/0/2.bitcask.hint' invalid
=ERROR REPORT==== 20-Jun-2013::22:03:34 ===
Hintfile '/home/yosuke/dev/temp/bitcask-test/0/1.bitcask.hint' invalid
* bitcask - path:/home/yosuke/dev/temp/bitcask-test/1, handle:#Ref<0.0.0.140>
=ERROR REPORT==== 20-Jun-2013::22:03:34 ===
Hintfile '/home/yosuke/dev/temp/bitcask-test/1/1.bitcask.hint' invalid
* bitcask - path:/home/yosuke/dev/temp/bitcask-test/2, handle:#Ref<0.0.0.160>
ok
2> leo_backend_db_api:status('test-db').
[[{key_count,0},{status,[]}],
[{key_count,2},
{status,[{"/home/yosuke/dev/temp/bitcask-test/1/1.bitcask.data",
0,0,52}]}],
[{key_count,3},
{status,[{"/home/yosuke/dev/temp/bitcask-test/0/2.bitcask.data",
0,0,108},
{"/home/yosuke/dev/temp/bitcask-test/0/1.bitcask.data",100,
78,78}]}]]
From now, I'm going to consider to resolve this problem.
So I found the method of resolution as the follows:
bitcask:merge("/home/yosuke/dev/temp/bitcask-test/0").
ok
15> leo_backend_db_api:status('test-db').
[[{key_count,0},{status,[]}],
[{key_count,0},{status,[]}],
[{key_count,0},{status,[]}]]
We need to call bitcask:merge/1 after the storage relaunched.