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 39d769793 Fix group_by_proximity to return SameZone shards correctly.
39d769793 is described below
commit 39d769793c7f3bd968c785c4127bc83197e8e4ac
Author: Ezhov, Egor <[email protected]>
AuthorDate: Mon Aug 31 07:27:08 2026 -0700
Fix group_by_proximity to return SameZone shards correctly.
If the local node (coordinator) does not contain the shard,
`group_by_proximity` returns empty list for SameZone shards list.
If the `group_by_proximity` is called with list of shards without
local node, the LocalNode variable is set to 'undefined'.
As a result, the SameZone list is empty and all shards are set
to the DifferentZone list.
The solution is to use local node info to define LocalZone var
---
src/mem3/src/mem3.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mem3/src/mem3.erl b/src/mem3/src/mem3.erl
index 2b20d546a..3eb23944a 100644
--- a/src/mem3/src/mem3.erl
+++ b/src/mem3/src/mem3.erl
@@ -375,7 +375,7 @@ group_by_proximity(Shards, ZoneMap) ->
fun(S) -> mem3:node(S) =:= config:node_name() end,
Shards
),
- LocalZone = proplists:get_value(config:node_name(), ZoneMap),
+ LocalZone = node_info(config:node_name(), <<"zone">>),
Fun = fun(S) -> proplists:get_value(mem3:node(S), ZoneMap) =:= LocalZone
end,
{SameZone, DifferentZone} = lists:partition(Fun, Remote),
{Local, SameZone, DifferentZone}.