Change Riak object hash approach
Change the riak object hash being kept in the metadata, to being a hash of the vector clock
This commit is contained in:
parent
959e7f932f
commit
7642aac2cc
3 changed files with 17 additions and 10 deletions
|
@ -1511,11 +1511,11 @@ hashtree_query_test() ->
|
||||||
?STD_TAG,
|
?STD_TAG,
|
||||||
false}),
|
false}),
|
||||||
KeyHashList = HTFolder(),
|
KeyHashList = HTFolder(),
|
||||||
lists:foreach(fun({B, _K, H}) ->
|
lists:foreach(fun({B, _K, H}) ->
|
||||||
?assertMatch("Bucket", B),
|
?assertMatch("Bucket", B),
|
||||||
?assertMatch(true, is_integer(H))
|
?assertMatch(true, is_integer(H))
|
||||||
end,
|
end,
|
||||||
KeyHashList),
|
KeyHashList),
|
||||||
?assertMatch(1200, length(KeyHashList)),
|
?assertMatch(1200, length(KeyHashList)),
|
||||||
ok = book_close(Bookie1),
|
ok = book_close(Bookie1),
|
||||||
{ok, Bookie2} = book_start([{root_path, RootPath},
|
{ok, Bookie2} = book_start([{root_path, RootPath},
|
||||||
|
|
|
@ -445,8 +445,11 @@ build_metadata_object(PrimaryKey, MD) ->
|
||||||
riak_extract_metadata(delete, Size) ->
|
riak_extract_metadata(delete, Size) ->
|
||||||
{delete, null, null, Size};
|
{delete, null, null, Size};
|
||||||
riak_extract_metadata(ObjBin, Size) ->
|
riak_extract_metadata(ObjBin, Size) ->
|
||||||
{Vclock, SibBin} = riak_metadata_from_binary(ObjBin),
|
{VclockBin, SibBin} = riak_metadata_from_binary(ObjBin),
|
||||||
{SibBin, Vclock, erlang:phash2(ObjBin), Size}.
|
{SibBin,
|
||||||
|
VclockBin,
|
||||||
|
erlang:phash2(lists:sort(binary_to_term(VclockBin))),
|
||||||
|
Size}.
|
||||||
|
|
||||||
%% <<?MAGIC:8/integer, ?V1_VERS:8/integer, VclockLen:32/integer,
|
%% <<?MAGIC:8/integer, ?V1_VERS:8/integer, VclockLen:32/integer,
|
||||||
%%% VclockBin/binary, SibCount:32/integer, SibsBin/binary>>.
|
%%% VclockBin/binary, SibCount:32/integer, SibsBin/binary>>.
|
||||||
|
|
|
@ -80,7 +80,7 @@ recovr_strategy(_Config) ->
|
||||||
Q = fun(RT) -> {index_query,
|
Q = fun(RT) -> {index_query,
|
||||||
"Bucket6",
|
"Bucket6",
|
||||||
{fun testutil:foldkeysfun/3, []},
|
{fun testutil:foldkeysfun/3, []},
|
||||||
{"idx1_bin", "#", "~"},
|
{"idx1_bin", "#", "|"},
|
||||||
{RT, undefined}}
|
{RT, undefined}}
|
||||||
end,
|
end,
|
||||||
{async, TFolder} = leveled_bookie:book_returnfolder(Book1, Q(true)),
|
{async, TFolder} = leveled_bookie:book_returnfolder(Book1, Q(true)),
|
||||||
|
@ -205,8 +205,12 @@ aae_bustedjournal(_Config) ->
|
||||||
% Will need to remove the file or corrupt the hashtree to get presence to
|
% Will need to remove the file or corrupt the hashtree to get presence to
|
||||||
% fail
|
% fail
|
||||||
|
|
||||||
FoldObjectsFun = fun(B, K, V, Acc) -> [{B, K, erlang:phash2(V)}|Acc]
|
FoldObjectsFun =
|
||||||
end,
|
fun(B, K, V, Acc) ->
|
||||||
|
VC = testutil:get_vclock(V),
|
||||||
|
H = erlang:phash2(lists:sort(VC)),
|
||||||
|
[{B, K, H}|Acc]
|
||||||
|
end,
|
||||||
SW = os:timestamp(),
|
SW = os:timestamp(),
|
||||||
{async, HashTreeF3} = leveled_bookie:book_returnfolder(Bookie2,
|
{async, HashTreeF3} = leveled_bookie:book_returnfolder(Bookie2,
|
||||||
{foldobjects_allkeys,
|
{foldobjects_allkeys,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue