You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/11/08 14:46:13 UTC
[GitHub] [couchdb] nickva opened a new pull request, #4261: Improve index cleanup
nickva opened a new pull request, #4261:
URL: https://github.com/apache/couchdb/pull/4261
Improve fabric index cleanup
* Clean-up stale view purge checkpoints. Previously we didn't, and purge
progress could have stalled purge progress by keeping around inactive
lagging purge checkpoints.
* couch_mrview_cleanup attempted to clean purge checkpoints but that didn't
work for clustered databases, only for local ones. Nowadays most dbs
are clustered so make sure those work as well.
* DRY-out code from both fabric inactive index cleanup and
couch_mrview_cleanup modules. Move some of the common code to
couch_mrview_util module. couch_mrvew_cleanup is the only place in charge
the cleanup logic now.
* Consolidate and improve tests. Utility functions to get all index files,
purge checkpoint and signatures are now tested with couch_mrview_util tests,
and end-to-end fabric cleanup tests are in fabric_tests. Since fabirc_tests
covers all the test scenarios from fabric_test.exs, remove fabric_test.exs
so we don't have test duplicated and get same coverage.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1019571254
##########
src/couch_mrview/src/couch_mrview_debug.erl:
##########
@@ -432,6 +492,107 @@ convert_collator_versions_to_strings(State) ->
),
maps:put(collator_versions, CollatorVersions, State).
+active_signatures(DbName) when is_list(DbName) ->
+ active_signatures(list_to_binary(DbName));
+active_signatures(DbName) when is_binary(DbName) ->
+ [binary_to_list(S) || S <- sigs(DbName)].
+
+index_files(DbName) when is_list(DbName) ->
+ index_files(list_to_binary(DbName));
+index_files(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ maps:values(Indices) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
+ ),
+ [format_view_path(F) || F <- AsList]
+ end.
+
+stale_index_files(DbName) when is_list(DbName) ->
+ stale_index_files(list_to_binary(DbName));
+stale_index_files(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [Db1 | _] = Dbs ->
+ Sigs = couch_mrview_util:get_signatures(Db1),
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ Inactive = maps:without(maps:keys(Sigs), Indices),
+ maps:values(Inactive) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
+ ),
+ [format_view_path(F) || F <- AsList]
+ end.
+
+purge_checkpoints(DbName) when is_list(DbName) ->
+ purge_checkpoints(list_to_binary(DbName));
+purge_checkpoints(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ maps:values(Purges) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ ),
+ [binary_to_list(DocId) || DocId <- AsList]
+ end.
+
+stale_purge_checkpoints(DbName) when is_list(DbName) ->
+ stale_purge_checkpoints(list_to_binary(DbName));
+stale_purge_checkpoints(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [Db1 | _] = Dbs ->
+ Sigs = couch_mrview_util:get_signatures(Db1),
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ Inactive = maps:without(maps:keys(Sigs), Purges),
+ maps:values(Inactive) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ ),
+ [binary_to_list(DocId) || DocId <- AsList]
+ end.
Review Comment:
It did look a bit repetitive. Maybe it's worth having an internal stale_purge_checkpoint_int(...) which takes a `shard_names(DbName)` result and then when returning we post-process it to turn them into more user-friendly list of strings?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1019573241
##########
src/couch_mrview/test/eunit/couch_mrview_util_tests.erl:
##########
@@ -35,3 +38,139 @@ validate_group_level(Group, GroupLevel) ->
Args0 = #mrargs{group = Group, group_level = GroupLevel, view_type = red},
Args1 = couch_mrview_util:validate_args(Args0),
Args1#mrargs.group_level.
+
+get_signature_from_filename_test() ->
+ Sig = "da817c3d3f7413c1a610f25635a0c521",
+ P1 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.view",
+ P2 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.compact.view",
+ P3 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521",
+ ?assertEqual(Sig, couch_mrview_util:get_signature_from_filename(P1)),
+ ?assertEqual(Sig, couch_mrview_util:get_signature_from_filename(P2)),
+ ?assertEqual(Sig, couch_mrview_util:get_signature_from_filename(P3)).
+
+verify_view_filename_test() ->
+ P1 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.view",
+ P2 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.compact.view",
+ P3 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521",
+ ?assert(couch_mrview_util:verify_view_filename(P1)),
+ ?assert(couch_mrview_util:verify_view_filename(P2)),
+ ?assertNot(couch_mrview_util:verify_view_filename(P3)),
+ ?assertNot(couch_mrview_util:verify_view_filename("")),
+ ?assertNot(couch_mrview_util:verify_view_filename("foo.view")).
+
+setup() ->
+ DbName = ?tempdb(),
+ ok = fabric:create_db(DbName, [?ADMIN_CTX, {q, 2}]),
+ DDoc = couch_mrview_test_util:ddoc(map),
+ {ok, _} = fabric:update_doc(DbName, DDoc, [?ADMIN_CTX]),
+ {ok, _} = fabric:query_view(DbName, <<"bar">>, <<"baz">>, #mrargs{}),
+ {ok, Db} = couch_mrview_test_util:init_db(?tempdb(), map),
+ {ok, _} = couch_mrview:query_view(Db, ?DDOC_ID, <<"baz">>),
+ {DbName, Db}.
+
+teardown({DbName, Db}) ->
+ couch_db:close(Db),
+ couch_server:delete(couch_db:name(Db), [?ADMIN_CTX]),
+ ok = fabric:delete_db(DbName, [?ADMIN_CTX]).
+
+get_signatures_test_() ->
+ {
+ setup,
+ fun() -> test_util:start_couch([fabric]) end,
+ fun test_util:stop_couch/1,
+ {
+ foreach,
+ fun setup/0,
+ fun teardown/1,
+ [
+ ?TDEF_FE(t_get_signatures_local),
+ ?TDEF_FE(t_get_signatures_clustered),
+ ?TDEF_FE(t_get_purge_checkpoints_local),
+ ?TDEF_FE(t_get_purge_checkpoints_clustered),
+ ?TDEF_FE(t_get_index_files_local),
+ ?TDEF_FE(t_get_index_files_clustered)
+ ]
+ }
+ }.
+
+t_get_signatures_local({_, Db}) ->
+ DbName = couch_db:name(Db),
+ Sigs = couch_mrview_util:get_signatures(DbName),
+ ?assert(is_map(Sigs)),
+ ?assertEqual(1, map_size(Sigs)),
+ [{Sig, true}] = maps:to_list(Sigs),
+ {ok, Info} = couch_mrview:get_info(Db, ?DDOC_ID),
+ ?assertEqual(proplists:get_value(signature, Info), Sig),
+
+ {ok, DDoc} = couch_db:open_doc(Db, ?DDOC_ID, [?ADMIN_CTX]),
+ Deleted = DDoc#doc{deleted = true, body = {[]}},
+ {ok, _} = couch_db:update_doc(Db, Deleted, []),
+ ?assertEqual(#{}, couch_mrview_util:get_signatures(DbName)).
+
+t_get_signatures_clustered({DbName, _Db}) ->
+ [Shard1, Shard2] = mem3:local_shards(DbName),
+ ShardName1 = mem3:name(Shard1),
+ ShardName2 = mem3:name(Shard2),
+ Sigs = couch_mrview_util:get_signatures(ShardName1),
+ ?assertEqual(Sigs, couch_mrview_util:get_signatures(ShardName2)),
+ ?assert(is_map(Sigs)),
+ ?assertEqual(1, map_size(Sigs)),
+ [{Sig, true}] = maps:to_list(Sigs),
+ {ok, Info} = couch_mrview:get_info(ShardName1, ?DDOC_ID),
+ ?assertEqual(proplists:get_value(signature, Info), Sig),
+
+ {ok, DDoc} = fabric:open_doc(DbName, ?DDOC_ID, [?ADMIN_CTX]),
+ Deleted = DDoc#doc{deleted = true, body = {[]}},
+ {ok, _} = fabric:update_doc(DbName, Deleted, [?ADMIN_CTX]),
+ ?assertEqual(#{}, couch_mrview_util:get_signatures(ShardName1)),
+ ?assertEqual(#{}, couch_mrview_util:get_signatures(ShardName2)).
+
+t_get_purge_checkpoints_local({_, Db}) ->
+ DbName = couch_db:name(Db),
+ Sigs = couch_mrview_util:get_purge_checkpoints(DbName),
Review Comment:
Oh definitely. Good find.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1019566718
##########
src/couch_mrview/src/couch_mrview_util.erl:
##########
@@ -70,31 +76,78 @@ get_value_from_options(Key, Options) ->
end.
verify_view_filename(FileName) ->
- FilePathList = filename:split(FileName),
- PureFN = lists:last(FilePathList),
- case filename:extension(PureFN) of
+ case filename:extension(FileName) of
".view" ->
- Sig = filename:basename(PureFN),
- case
- [
- Ch
- || Ch <- Sig,
- not (((Ch >= $0) and (Ch =< $9)) orelse
- ((Ch >= $a) and (Ch =< $f)) orelse
- ((Ch >= $A) and (Ch =< $F)))
- ] == []
- of
- true -> true;
- false -> false
- end;
+ Sig = get_signature_from_filename(FileName),
+ lists:all(fun(C) -> ?IS_HEX(C) end, Sig);
_ ->
false
end.
-get_signature_from_filename(FileName) ->
- FilePathList = filename:split(FileName),
- PureFN = lists:last(FilePathList),
- filename:basename(PureFN, ".view").
+get_signature_from_filename(Path) ->
+ filename:basename(filename:basename(Path, ".view"), ".compact").
+
+% Returns map of `Sig => true` elements with all the active signatures..
Review Comment:
Oops!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1019569233
##########
src/fabric/test/eunit/fabric_tests.erl:
##########
@@ -12,48 +12,229 @@
-module(fabric_tests).
+-include_lib("couch/include/couch_db.hrl").
-include_lib("couch/include/couch_eunit.hrl").
cleanup_index_files_test_() ->
{
- setup,
+ foreach,
fun setup/0,
fun teardown/1,
- fun(Ctx) ->
- [
- t_cleanup_index_files(),
- t_cleanup_index_files_with_existing_db(Ctx),
- t_cleanup_index_files_with_deleted_db(Ctx)
- ]
- end
+ [
+ ?TDEF_FE(t_cleanup_index_files),
+ ?TDEF_FE(t_cleanup_index_files_with_existing_db),
+ ?TDEF_FE(t_cleanup_index_files_with_view_data),
+ ?TDEF_FE(t_cleanup_index_files_with_deleted_db),
+ ?TDEF_FE(t_cleanup_index_file_after_ddoc_update),
+ ?TDEF_FE(t_cleanup_index_file_after_ddoc_delete)
+ ]
}.
setup() ->
Ctx = test_util:start_couch([fabric]),
- % TempDb is deleted in the test "t_cleanup_index_files_with_deleted_db".
- TempDb = ?tempdb(),
- fabric:create_db(TempDb),
- {Ctx, TempDb}.
+ DbName = ?tempdb(),
+ fabric:create_db(DbName, [{q, 1}]),
+ create_ddoc(DbName, <<"_design/foo">>, <<"bar">>),
+ {ok, _} = fabric:query_view(DbName, <<"foo">>, <<"bar">>),
+ create_ddoc(DbName, <<"_design/boo">>, <<"baz">>),
+ {ok, _} = fabric:query_view(DbName, <<"boo">>, <<"baz">>),
+ {Ctx, DbName}.
-teardown({Ctx, _TempDb}) ->
+teardown({Ctx, DbName}) ->
+ fabric:delete_db(DbName),
test_util:stop_couch(Ctx).
-t_cleanup_index_files() ->
- ?_assert(
- lists:all(fun(Res) -> Res =:= ok end, fabric:cleanup_index_files())
+t_cleanup_index_files(_) ->
+ CheckFun = fun(Res) -> Res =:= ok end,
+ ?assert(lists:all(CheckFun, fabric:cleanup_index_files())).
+
+t_cleanup_index_files_with_existing_db({_, DbName}) ->
+ ?assertEqual(ok, fabric:cleanup_index_files(DbName)).
+
+t_cleanup_index_files_with_view_data({_, DbName}) ->
+ Sigs = sigs(DbName),
+ Indices = indices(DbName),
+ Purges = purges(DbName),
+ ok = fabric:cleanup_index_files(DbName),
+ % We haven't inadvertently removed any active index bits
+ ?assertEqual(Sigs, sigs(DbName)),
+ ?assertEqual(Indices, indices(DbName)),
+ ?assertEqual(Purges, purges(DbName)).
+
+t_cleanup_index_files_with_deleted_db(_) ->
+ SomeDb = ?tempdb(),
+ ?assertEqual(ok, fabric:cleanup_index_files(SomeDb)).
+
+t_cleanup_index_file_after_ddoc_update({_, DbName}) ->
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view",
+ "da817c3d3f7413c1a610f25635a0c521.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>,
+ <<"_local/purge-mrview-da817c3d3f7413c1a610f25635a0c521">>
+ ],
+ purges(DbName)
+ ),
+
+ update_ddoc(DbName, <<"_design/foo">>, <<"bar1">>),
+ ok = fabric:cleanup_index_files(DbName),
+ {ok, _} = fabric:query_view(DbName, <<"foo">>, <<"bar1">>),
+
+ % One 4bc stays, da8 should gone and 9e3 is added
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view",
+ "9e355b0fee411b4257036b8fca56f263.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>,
+ <<"_local/purge-mrview-9e355b0fee411b4257036b8fca56f263">>
+ ],
+ purges(DbName)
).
-t_cleanup_index_files_with_existing_db({_Ctx, TempDb}) ->
- ?_assertEqual(ok, fabric:cleanup_index_files(TempDb)).
+t_cleanup_index_file_after_ddoc_delete({_, DbName}) ->
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view",
+ "da817c3d3f7413c1a610f25635a0c521.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>,
+ <<"_local/purge-mrview-da817c3d3f7413c1a610f25635a0c521">>
+ ],
+ purges(DbName)
+ ),
+
+ delete_ddoc(DbName, <<"_design/foo">>),
+ ok = fabric:cleanup_index_files(DbName),
+
+ % 4bc stays the same, da8 should be gone
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>
+ ],
+ purges(DbName)
+ ),
+
+ delete_ddoc(DbName, <<"_design/boo">>),
+ ok = fabric:cleanup_index_files(DbName),
+
+ ?assertEqual([], indices(DbName)),
+ ?assertEqual([], purges(DbName)),
+
+ % cleaning a db with all deleted indices should still work
+ ok = fabric:cleanup_index_files(DbName),
-t_cleanup_index_files_with_deleted_db({_Ctx, TempDb}) ->
- ?_test(
- begin
- fabric:delete_db(TempDb, []),
- ?assertError(
- database_does_not_exist,
- fabric:inactive_index_files(TempDb)
+ ?assertEqual([], indices(DbName)),
+ ?assertEqual([], purges(DbName)).
+
+shard_names(DbName) ->
+ [mem3:name(S) || S <- mem3:local_shards(DbName)].
+
+% Sorted list of sigs
+%
+sigs(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [SomeDb | _] ->
+ Sigs = couch_mrview_util:get_signatures(SomeDb),
+ lists:sort(maps:keys(Sigs))
+ end.
+
+% Sorted list of index files
+%
+indices(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ maps:values(Indices) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
),
- ?assertEqual(ok, fabric:cleanup_index_files(TempDb))
- end
- ).
+ % Keep only file names and extensions. Since we use q=1, we shouldn't
+ % have any duplicates
+ [filename:basename(F) || F <- AsList]
+ end.
+
+% Sorted list of purge checkpoint doc ids
+%
+purges(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ maps:values(Purges) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ )
+ end.
+
+create_ddoc(DbName, DDName, ViewName) ->
Review Comment:
Good idea. That was a copy-paste from somewhere. I'll change it!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
jaydoane commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1017138619
##########
src/couch_mrview/src/couch_mrview_cleanup.erl:
##########
@@ -12,57 +12,62 @@
-module(couch_mrview_cleanup).
--export([run/1]).
+-export([
+ run/1,
+ cleanup_purges/3,
Review Comment:
Would `cleanup_checkpoints` be more descriptive?
##########
src/couch_mrview/src/couch_mrview_util.erl:
##########
@@ -70,31 +76,78 @@ get_value_from_options(Key, Options) ->
end.
verify_view_filename(FileName) ->
- FilePathList = filename:split(FileName),
- PureFN = lists:last(FilePathList),
- case filename:extension(PureFN) of
+ case filename:extension(FileName) of
".view" ->
- Sig = filename:basename(PureFN),
- case
- [
- Ch
- || Ch <- Sig,
- not (((Ch >= $0) and (Ch =< $9)) orelse
- ((Ch >= $a) and (Ch =< $f)) orelse
- ((Ch >= $A) and (Ch =< $F)))
- ] == []
- of
- true -> true;
- false -> false
- end;
+ Sig = get_signature_from_filename(FileName),
+ lists:all(fun(C) -> ?IS_HEX(C) end, Sig);
_ ->
false
end.
-get_signature_from_filename(FileName) ->
- FilePathList = filename:split(FileName),
- PureFN = lists:last(FilePathList),
- filename:basename(PureFN, ".view").
+get_signature_from_filename(Path) ->
+ filename:basename(filename:basename(Path, ".view"), ".compact").
+
+% Returns map of `Sig => true` elements with all the active signatures..
Review Comment:
extra period at end?
##########
src/fabric/test/eunit/fabric_tests.erl:
##########
@@ -12,48 +12,229 @@
-module(fabric_tests).
+-include_lib("couch/include/couch_db.hrl").
-include_lib("couch/include/couch_eunit.hrl").
cleanup_index_files_test_() ->
{
- setup,
+ foreach,
fun setup/0,
fun teardown/1,
- fun(Ctx) ->
- [
- t_cleanup_index_files(),
- t_cleanup_index_files_with_existing_db(Ctx),
- t_cleanup_index_files_with_deleted_db(Ctx)
- ]
- end
+ [
+ ?TDEF_FE(t_cleanup_index_files),
+ ?TDEF_FE(t_cleanup_index_files_with_existing_db),
+ ?TDEF_FE(t_cleanup_index_files_with_view_data),
+ ?TDEF_FE(t_cleanup_index_files_with_deleted_db),
+ ?TDEF_FE(t_cleanup_index_file_after_ddoc_update),
+ ?TDEF_FE(t_cleanup_index_file_after_ddoc_delete)
+ ]
}.
setup() ->
Ctx = test_util:start_couch([fabric]),
- % TempDb is deleted in the test "t_cleanup_index_files_with_deleted_db".
- TempDb = ?tempdb(),
- fabric:create_db(TempDb),
- {Ctx, TempDb}.
+ DbName = ?tempdb(),
+ fabric:create_db(DbName, [{q, 1}]),
+ create_ddoc(DbName, <<"_design/foo">>, <<"bar">>),
+ {ok, _} = fabric:query_view(DbName, <<"foo">>, <<"bar">>),
+ create_ddoc(DbName, <<"_design/boo">>, <<"baz">>),
+ {ok, _} = fabric:query_view(DbName, <<"boo">>, <<"baz">>),
+ {Ctx, DbName}.
-teardown({Ctx, _TempDb}) ->
+teardown({Ctx, DbName}) ->
+ fabric:delete_db(DbName),
test_util:stop_couch(Ctx).
-t_cleanup_index_files() ->
- ?_assert(
- lists:all(fun(Res) -> Res =:= ok end, fabric:cleanup_index_files())
+t_cleanup_index_files(_) ->
+ CheckFun = fun(Res) -> Res =:= ok end,
+ ?assert(lists:all(CheckFun, fabric:cleanup_index_files())).
+
+t_cleanup_index_files_with_existing_db({_, DbName}) ->
+ ?assertEqual(ok, fabric:cleanup_index_files(DbName)).
+
+t_cleanup_index_files_with_view_data({_, DbName}) ->
+ Sigs = sigs(DbName),
+ Indices = indices(DbName),
+ Purges = purges(DbName),
+ ok = fabric:cleanup_index_files(DbName),
+ % We haven't inadvertently removed any active index bits
+ ?assertEqual(Sigs, sigs(DbName)),
+ ?assertEqual(Indices, indices(DbName)),
+ ?assertEqual(Purges, purges(DbName)).
+
+t_cleanup_index_files_with_deleted_db(_) ->
+ SomeDb = ?tempdb(),
+ ?assertEqual(ok, fabric:cleanup_index_files(SomeDb)).
+
+t_cleanup_index_file_after_ddoc_update({_, DbName}) ->
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view",
+ "da817c3d3f7413c1a610f25635a0c521.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>,
+ <<"_local/purge-mrview-da817c3d3f7413c1a610f25635a0c521">>
+ ],
+ purges(DbName)
+ ),
+
+ update_ddoc(DbName, <<"_design/foo">>, <<"bar1">>),
+ ok = fabric:cleanup_index_files(DbName),
+ {ok, _} = fabric:query_view(DbName, <<"foo">>, <<"bar1">>),
+
+ % One 4bc stays, da8 should gone and 9e3 is added
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view",
+ "9e355b0fee411b4257036b8fca56f263.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>,
+ <<"_local/purge-mrview-9e355b0fee411b4257036b8fca56f263">>
+ ],
+ purges(DbName)
).
-t_cleanup_index_files_with_existing_db({_Ctx, TempDb}) ->
- ?_assertEqual(ok, fabric:cleanup_index_files(TempDb)).
+t_cleanup_index_file_after_ddoc_delete({_, DbName}) ->
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view",
+ "da817c3d3f7413c1a610f25635a0c521.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>,
+ <<"_local/purge-mrview-da817c3d3f7413c1a610f25635a0c521">>
+ ],
+ purges(DbName)
+ ),
+
+ delete_ddoc(DbName, <<"_design/foo">>),
+ ok = fabric:cleanup_index_files(DbName),
+
+ % 4bc stays the same, da8 should be gone
+ ?assertEqual(
+ [
+ "4bcdf852098ff6b0578ddf472c320e9c.view"
+ ],
+ indices(DbName)
+ ),
+ ?assertEqual(
+ [
+ <<"_local/purge-mrview-4bcdf852098ff6b0578ddf472c320e9c">>
+ ],
+ purges(DbName)
+ ),
+
+ delete_ddoc(DbName, <<"_design/boo">>),
+ ok = fabric:cleanup_index_files(DbName),
+
+ ?assertEqual([], indices(DbName)),
+ ?assertEqual([], purges(DbName)),
+
+ % cleaning a db with all deleted indices should still work
+ ok = fabric:cleanup_index_files(DbName),
-t_cleanup_index_files_with_deleted_db({_Ctx, TempDb}) ->
- ?_test(
- begin
- fabric:delete_db(TempDb, []),
- ?assertError(
- database_does_not_exist,
- fabric:inactive_index_files(TempDb)
+ ?assertEqual([], indices(DbName)),
+ ?assertEqual([], purges(DbName)).
+
+shard_names(DbName) ->
+ [mem3:name(S) || S <- mem3:local_shards(DbName)].
+
+% Sorted list of sigs
+%
+sigs(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [SomeDb | _] ->
+ Sigs = couch_mrview_util:get_signatures(SomeDb),
+ lists:sort(maps:keys(Sigs))
+ end.
+
+% Sorted list of index files
+%
+indices(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ maps:values(Indices) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
),
- ?assertEqual(ok, fabric:cleanup_index_files(TempDb))
- end
- ).
+ % Keep only file names and extensions. Since we use q=1, we shouldn't
+ % have any duplicates
+ [filename:basename(F) || F <- AsList]
+ end.
+
+% Sorted list of purge checkpoint doc ids
+%
+purges(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ maps:values(Purges) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ )
+ end.
+
+create_ddoc(DbName, DDName, ViewName) ->
Review Comment:
I stared at this a few seconds before I noticed those were different variables. What do you think of `DDocId`?
##########
src/couch_mrview/test/eunit/couch_mrview_util_tests.erl:
##########
@@ -35,3 +38,139 @@ validate_group_level(Group, GroupLevel) ->
Args0 = #mrargs{group = Group, group_level = GroupLevel, view_type = red},
Args1 = couch_mrview_util:validate_args(Args0),
Args1#mrargs.group_level.
+
+get_signature_from_filename_test() ->
+ Sig = "da817c3d3f7413c1a610f25635a0c521",
+ P1 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.view",
+ P2 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.compact.view",
+ P3 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521",
+ ?assertEqual(Sig, couch_mrview_util:get_signature_from_filename(P1)),
+ ?assertEqual(Sig, couch_mrview_util:get_signature_from_filename(P2)),
+ ?assertEqual(Sig, couch_mrview_util:get_signature_from_filename(P3)).
+
+verify_view_filename_test() ->
+ P1 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.view",
+ P2 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521.compact.view",
+ P3 = "/x.1667618375_design/mrview/da817c3d3f7413c1a610f25635a0c521",
+ ?assert(couch_mrview_util:verify_view_filename(P1)),
+ ?assert(couch_mrview_util:verify_view_filename(P2)),
+ ?assertNot(couch_mrview_util:verify_view_filename(P3)),
+ ?assertNot(couch_mrview_util:verify_view_filename("")),
+ ?assertNot(couch_mrview_util:verify_view_filename("foo.view")).
+
+setup() ->
+ DbName = ?tempdb(),
+ ok = fabric:create_db(DbName, [?ADMIN_CTX, {q, 2}]),
+ DDoc = couch_mrview_test_util:ddoc(map),
+ {ok, _} = fabric:update_doc(DbName, DDoc, [?ADMIN_CTX]),
+ {ok, _} = fabric:query_view(DbName, <<"bar">>, <<"baz">>, #mrargs{}),
+ {ok, Db} = couch_mrview_test_util:init_db(?tempdb(), map),
+ {ok, _} = couch_mrview:query_view(Db, ?DDOC_ID, <<"baz">>),
+ {DbName, Db}.
+
+teardown({DbName, Db}) ->
+ couch_db:close(Db),
+ couch_server:delete(couch_db:name(Db), [?ADMIN_CTX]),
+ ok = fabric:delete_db(DbName, [?ADMIN_CTX]).
+
+get_signatures_test_() ->
+ {
+ setup,
+ fun() -> test_util:start_couch([fabric]) end,
+ fun test_util:stop_couch/1,
+ {
+ foreach,
+ fun setup/0,
+ fun teardown/1,
+ [
+ ?TDEF_FE(t_get_signatures_local),
+ ?TDEF_FE(t_get_signatures_clustered),
+ ?TDEF_FE(t_get_purge_checkpoints_local),
+ ?TDEF_FE(t_get_purge_checkpoints_clustered),
+ ?TDEF_FE(t_get_index_files_local),
+ ?TDEF_FE(t_get_index_files_clustered)
+ ]
+ }
+ }.
+
+t_get_signatures_local({_, Db}) ->
+ DbName = couch_db:name(Db),
+ Sigs = couch_mrview_util:get_signatures(DbName),
+ ?assert(is_map(Sigs)),
+ ?assertEqual(1, map_size(Sigs)),
+ [{Sig, true}] = maps:to_list(Sigs),
+ {ok, Info} = couch_mrview:get_info(Db, ?DDOC_ID),
+ ?assertEqual(proplists:get_value(signature, Info), Sig),
+
+ {ok, DDoc} = couch_db:open_doc(Db, ?DDOC_ID, [?ADMIN_CTX]),
+ Deleted = DDoc#doc{deleted = true, body = {[]}},
+ {ok, _} = couch_db:update_doc(Db, Deleted, []),
+ ?assertEqual(#{}, couch_mrview_util:get_signatures(DbName)).
+
+t_get_signatures_clustered({DbName, _Db}) ->
+ [Shard1, Shard2] = mem3:local_shards(DbName),
+ ShardName1 = mem3:name(Shard1),
+ ShardName2 = mem3:name(Shard2),
+ Sigs = couch_mrview_util:get_signatures(ShardName1),
+ ?assertEqual(Sigs, couch_mrview_util:get_signatures(ShardName2)),
+ ?assert(is_map(Sigs)),
+ ?assertEqual(1, map_size(Sigs)),
+ [{Sig, true}] = maps:to_list(Sigs),
+ {ok, Info} = couch_mrview:get_info(ShardName1, ?DDOC_ID),
+ ?assertEqual(proplists:get_value(signature, Info), Sig),
+
+ {ok, DDoc} = fabric:open_doc(DbName, ?DDOC_ID, [?ADMIN_CTX]),
+ Deleted = DDoc#doc{deleted = true, body = {[]}},
+ {ok, _} = fabric:update_doc(DbName, Deleted, [?ADMIN_CTX]),
+ ?assertEqual(#{}, couch_mrview_util:get_signatures(ShardName1)),
+ ?assertEqual(#{}, couch_mrview_util:get_signatures(ShardName2)).
+
+t_get_purge_checkpoints_local({_, Db}) ->
+ DbName = couch_db:name(Db),
+ Sigs = couch_mrview_util:get_purge_checkpoints(DbName),
Review Comment:
Should this be `Checkpoints = `?
Maybe copy pasta in this and the next test?
##########
src/couch_mrview/src/couch_mrview_debug.erl:
##########
@@ -432,6 +492,107 @@ convert_collator_versions_to_strings(State) ->
),
maps:put(collator_versions, CollatorVersions, State).
+active_signatures(DbName) when is_list(DbName) ->
+ active_signatures(list_to_binary(DbName));
+active_signatures(DbName) when is_binary(DbName) ->
+ [binary_to_list(S) || S <- sigs(DbName)].
+
+index_files(DbName) when is_list(DbName) ->
+ index_files(list_to_binary(DbName));
+index_files(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ maps:values(Indices) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
+ ),
+ [format_view_path(F) || F <- AsList]
+ end.
+
+stale_index_files(DbName) when is_list(DbName) ->
+ stale_index_files(list_to_binary(DbName));
+stale_index_files(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [Db1 | _] = Dbs ->
+ Sigs = couch_mrview_util:get_signatures(Db1),
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ Inactive = maps:without(maps:keys(Sigs), Indices),
+ maps:values(Inactive) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
+ ),
+ [format_view_path(F) || F <- AsList]
+ end.
+
+purge_checkpoints(DbName) when is_list(DbName) ->
+ purge_checkpoints(list_to_binary(DbName));
+purge_checkpoints(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ maps:values(Purges) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ ),
+ [binary_to_list(DocId) || DocId <- AsList]
+ end.
+
+stale_purge_checkpoints(DbName) when is_list(DbName) ->
+ stale_purge_checkpoints(list_to_binary(DbName));
+stale_purge_checkpoints(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [Db1 | _] = Dbs ->
+ Sigs = couch_mrview_util:get_signatures(Db1),
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ Inactive = maps:without(maps:keys(Sigs), Purges),
+ maps:values(Inactive) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ ),
+ [binary_to_list(DocId) || DocId <- AsList]
+ end.
Review Comment:
This is a very useful pattern, but it does start to look a little like boilerplate with so many small variations. I guess abstracting it might make it less clear what's going on in each specific case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1017070292
##########
src/couch_mrview/src/couch_mrview_debug.erl:
##########
@@ -41,7 +46,12 @@ help() ->
index_view_state,
index_report,
view_report,
- index_view_report
+ index_view_report,
+ active_signatures,
Review Comment:
I saw the report versions but in that case they don't return data which then be processed or chained with other remsh function. The state suffix seems a bit odd since it's more of a list of items not a state (which I'd think of an gen_server state for example).
The convention could be updated so if a name is plural it returns a list of items?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1019659789
##########
src/couch_mrview/src/couch_mrview_debug.erl:
##########
@@ -432,6 +492,107 @@ convert_collator_versions_to_strings(State) ->
),
maps:put(collator_versions, CollatorVersions, State).
+active_signatures(DbName) when is_list(DbName) ->
+ active_signatures(list_to_binary(DbName));
+active_signatures(DbName) when is_binary(DbName) ->
+ [binary_to_list(S) || S <- sigs(DbName)].
+
+index_files(DbName) when is_list(DbName) ->
+ index_files(list_to_binary(DbName));
+index_files(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ maps:values(Indices) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
+ ),
+ [format_view_path(F) || F <- AsList]
+ end.
+
+stale_index_files(DbName) when is_list(DbName) ->
+ stale_index_files(list_to_binary(DbName));
+stale_index_files(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [Db1 | _] = Dbs ->
+ Sigs = couch_mrview_util:get_signatures(Db1),
+ AllIndices = lists:map(fun couch_mrview_util:get_index_files/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Indices, Acc) ->
+ Inactive = maps:without(maps:keys(Sigs), Indices),
+ maps:values(Inactive) ++ Acc
+ end,
+ [],
+ AllIndices
+ )
+ ),
+ [format_view_path(F) || F <- AsList]
+ end.
+
+purge_checkpoints(DbName) when is_list(DbName) ->
+ purge_checkpoints(list_to_binary(DbName));
+purge_checkpoints(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [_ | _] = Dbs ->
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ maps:values(Purges) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ ),
+ [binary_to_list(DocId) || DocId <- AsList]
+ end.
+
+stale_purge_checkpoints(DbName) when is_list(DbName) ->
+ stale_purge_checkpoints(list_to_binary(DbName));
+stale_purge_checkpoints(DbName) when is_binary(DbName) ->
+ case shard_names(DbName) of
+ [] ->
+ [];
+ [Db1 | _] = Dbs ->
+ Sigs = couch_mrview_util:get_signatures(Db1),
+ AllPurges = lists:map(fun couch_mrview_util:get_purge_checkpoints/1, Dbs),
+ AsList = lists:sort(
+ lists:foldl(
+ fun(Purges, Acc) ->
+ Inactive = maps:without(maps:keys(Sigs), Purges),
+ maps:values(Inactive) ++ Acc
+ end,
+ [],
+ AllPurges
+ )
+ ),
+ [binary_to_list(DocId) || DocId <- AsList]
+ end.
Review Comment:
I managed to simplify it a bit by using two common internal functions. So then stale vs all is returned if the passed in active signatures map is empty or has actual active signatures.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1017070292
##########
src/couch_mrview/src/couch_mrview_debug.erl:
##########
@@ -41,7 +46,12 @@ help() ->
index_view_state,
index_report,
view_report,
- index_view_report
+ index_view_report,
+ active_signatures,
Review Comment:
I saw the report versions but in that case they don't return data which then be processed or chained with other remsh function. The state suffix seems a bit odd since it's more of a list of items not a state (which I'd think of an gen_server state for example).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva merged pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva merged PR #4261:
URL: https://github.com/apache/couchdb/pull/4261
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1019567038
##########
src/couch_mrview/src/couch_mrview_cleanup.erl:
##########
@@ -12,57 +12,62 @@
-module(couch_mrview_cleanup).
--export([run/1]).
+-export([
+ run/1,
+ cleanup_purges/3,
Review Comment:
Since checkpoints could be mem3 or replication checkpoints I thought purges is a bit more specific.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] iilyak commented on a diff in pull request #4261: Improve index cleanup
Posted by GitBox <gi...@apache.org>.
iilyak commented on code in PR #4261:
URL: https://github.com/apache/couchdb/pull/4261#discussion_r1017067561
##########
src/couch_mrview/src/couch_mrview_debug.erl:
##########
@@ -41,7 +46,12 @@ help() ->
index_view_state,
index_report,
view_report,
- index_view_report
+ index_view_report,
+ active_signatures,
Review Comment:
So far for debug functions I tried to split them into two categories. The functions which return the data and functions which print reports.
- For functions which return data the suffix `_state` was used.
- For functions which print reports the suffix `_report` was used.
The `_report` functions so far supported two ways of invoking them.
- pass same arguments as arguments of `_state` functions
- pass the data structure returned by `_state` function
This allows few things:
1. retrieving raw data for manipulation
2. printing nice reports with minimum number of arguments
3. complex pipelines where following steps are implemented
- `_state` function are called to get raw data
- the raw data are filtered based on arbitrary criteria (possibly implemented as a remsh function)
- call `_report` function with filtered data to get only what we need.
I think with very little change this PR could do the same.
See https://github.com/apache/couchdb/commit/963daf6ca9df5815973bb6934c3fdc02b905f6f9 to get better idea of the API.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org