This is an automated email from the ASF dual-hosted git repository.
nickva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/main by this push:
new 0783f6799 Fix typo in source check in mem3 reshard logic
0783f6799 is described below
commit 0783f6799f09fd06690e0b46e122692cc642615b
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Mon Aug 24 16:36:09 2026 -0400
Fix typo in source check in mem3 reshard logic
Previously we matched both the shard record and the shard name to the same
variable. Fix the match and slighly improve readability by making a small
function for it.
---
src/mem3/src/mem3_reshard_dbdoc.erl | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/mem3/src/mem3_reshard_dbdoc.erl
b/src/mem3/src/mem3_reshard_dbdoc.erl
index e2f0d0c50..d03a53027 100644
--- a/src/mem3/src/mem3_reshard_dbdoc.erl
+++ b/src/mem3/src/mem3_reshard_dbdoc.erl
@@ -152,13 +152,7 @@ check_source_removed(#shard{name = Name}) ->
Nodes = lists:usort([N || N <- ShardNodes, lists:member(N, Live)]),
{Responses, _} = rpc:multicall(Nodes, mem3, shards, [DbName]),
Shards = lists:usort(lists:flatten(Responses)),
- SourcePresent = [
- S
- || S = #shard{name = S, node = N} <- Shards,
- S =:= Name,
- N =:= node()
- ],
- case SourcePresent of
- [] -> true;
- [_ | _] -> false
- end.
+ [] =:= matching_shards(Name, node(), Shards).
+
+matching_shards(Name, Node, Shards) ->
+ [S || #shard{name = SN, node = N} = S <- Shards, SN =:= Name, N =:= Node].