Skip to content

Commit

Permalink
Nhse d32 maskvit.i116 forcelegacytree (#42)
Browse files Browse the repository at this point in the history
* Allow for tree format to be pinned back to previous version

Maybe required when using per-bucket AAE in a rolling upgrade.

* LegacyTree does not use map

So invert the config option here
  • Loading branch information
martinsumner authored Sep 19, 2024
1 parent d93755e commit e8b86a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
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

0 comments on commit e8b86a7

Please sign in to comment.