Permalink
Browse files

CBD-279 Faster check if group is up to date

The function seqs_up_to_date/2 is slower then just
using plain operator erlang:'>'/2. It was in place
since the early days of the indexer to assert that
both list of seq numbers were sorted and each position
referenced the same partition ID. Existing tests will
now detect if the list of seq numbers doesn't match
the expected format.

Change-Id: If75ace2b759e670ea1b344856de59e3f64b9674b
Reviewed-on: http://review.couchbase.org/16366
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  • Loading branch information...
1 parent f0937ac commit ae06025c7f421e505ee69b6cb33293857ad324e3 @fdmanana fdmanana committed May 24, 2012
Showing with 1 addition and 13 deletions.
  1. +1 −13 src/couch_set_view/src/couch_set_view_group.erl
@@ -577,7 +577,7 @@ handle_call({compact_done, Result}, {Pid, _}, #state{compactor_pid = Pid} = Stat
cleanup_kv_count = CleanupKVCount
} = Result,
- case seqs_up_to_date(?set_seqs(NewGroup), ?set_seqs(Group)) of
+ case (?set_seqs(NewGroup)) >= (?set_seqs(Group)) of
true ->
if is_pid(UpdaterPid) ->
?LOG_INFO("Set view `~s`, ~s group `~s`, compact group up to date - restarting updater",
@@ -1329,18 +1329,6 @@ commit_header(Group) ->
ok = couch_file:sync(Group#set_view_group.fd).
--spec seqs_up_to_date(partition_seqs(), partition_seqs()) -> boolean().
-seqs_up_to_date([], []) ->
- true;
-seqs_up_to_date([{PartId, SeqA} | RestA], [{PartId, SeqB} | RestB]) ->
- case SeqA - SeqB of
- Greater when Greater >= 0 ->
- seqs_up_to_date(RestA, RestB);
- _Smaller ->
- false
- end.
-
-
-spec maybe_update_partition_states(ordsets:ordset(partition_id()),
ordsets:ordset(partition_id()),
ordsets:ordset(partition_id()),

0 comments on commit ae06025

Please sign in to comment.