Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for tree format to be pinned back to previous version #41

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions priv/riak_kv.schema
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
{commented, enabled}
]}.

%% @doc Use legacy-format tictac tree
%% Should only be required when perfoming a rolling upgrade to 3.4.0 or 3.2.3,
%% and using per-bucket full-sync.
%% Temporary option - will be removed in 3.6
{mapping, "legacyformat_tictacaae_tree", "riak_kv.legacyformat_tictacaae_tree", [
{datatype, {flag, enabled, disabled}},
{default, disabled},
hidden
]}.

%% @doc A path under which aae data files will be stored.
{mapping, "tictacaae_dataroot", "riak_kv.tictacaae_dataroot", [
{default, "$(platform_data_dir)/tictac_aae"},
Expand Down
17 changes: 12 additions & 5 deletions src/riak_kv_clusteraae_fsm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,13 @@ init(From={_, _, _}, [Query, Timeout]) ->
element(3, Query));
merge_tree_range ->
TreeSize = element(4, Query),
leveled_tictac:new_tree(range_tree, TreeSize);
UseLegacyTree =
application:get_env(
riak_kv, legacyformat_tictacaae_tree, false
),
leveled_tictac:new_tree(
range_tree, TreeSize, not UseLegacyTree
);
repl_keys_range ->
{[], 0, element(5, Query), ?REPL_BATCH_SIZE};
repair_keys_range ->
Expand Down Expand Up @@ -1001,11 +1007,12 @@ json_encode_tictac_empty_test() ->
?assertMatch([], leveled_tictac:find_dirtyleaves(Tree, ReverseTree)).

json_encode_tictac_withentries_test() ->
encode_results_ofsize(small),
encode_results_ofsize(large).
encode_results_ofsize(small, true),
encode_results_ofsize(large, false),
encode_results_ofsize(large, true).

encode_results_ofsize(TreeSize) ->
Tree = leveled_tictac:new_tree(tictac_folder_test, TreeSize),
encode_results_ofsize(TreeSize, MapBasedTree) ->
Tree = leveled_tictac:new_tree(tictac_folder_test, TreeSize, MapBasedTree),
ExtractFun = fun(K, V) -> {K, V} end,
FoldFun =
fun({Key, Value}, AccTree) ->
Expand Down