Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop killing deleted connections in a replicaSet #236

Merged
merged 3 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion enot_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mongodb",
"app_vsn": "3.3.3",
"app_vsn": "3.4.3",
"deps": [
{
"name": "bson",
Expand Down
18 changes: 9 additions & 9 deletions src/mongoc/mc_topology_logics.erl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
-export([update_topology_state/2, init_seeds/4, init_seeds/1]).

update_topology_state(#mc_server{type = SType, pid = Pid}, State = #topology_state{type = sharded}) when ?NON_SHARDED(SType) -> %% SHARDED
exit(Pid, kill),
exit(Pid, normal),
State;
update_topology_state(_, State = #topology_state{type = sharded}) ->
State;
Expand All @@ -33,7 +33,7 @@ update_topology_state(#mc_server{type = rsGhost}, State = #topology_state{type =
update_topology_state(#mc_server{type = standalone}, State = #topology_state{type = unknown, seeds = Seeds}) when length(Seeds) =< 1 ->
State#topology_state{type = standalone};
update_topology_state(#mc_server{type = standalone, pid = Pid}, State = #topology_state{type = unknown}) ->
exit(Pid, kill),
exit(Pid, normal),
State;
update_topology_state(#mc_server{type = mongos}, State = #topology_state{type = unknown}) ->
State#topology_state{type = sharded};
Expand All @@ -48,11 +48,11 @@ update_topology_state(
set_possible_primary(Tab, Primary),
State#topology_state{type = checkIfHasPrimary(Tab), setName = SetName};
update_topology_state(#mc_server{type = SType, pid = Pid}, State = #topology_state{type = unknown}) when ?SEC_ARB_OTH(SType) ->
exit(Pid, kill),
exit(Pid, normal),
State;
update_topology_state(#mc_server{type = SType, pid = Pid},
State = #topology_state{type = replicaSetNoPrimary}) when ?STAL_MONGS(SType) -> %% REPLICASETNOPRIMARY
exit(Pid, kill),
exit(Pid, normal),
State;
update_topology_state(Server = #mc_server{type = SType, setName = SetName},
State = #topology_state{type = replicaSetNoPrimary, setName = SetName}) when ?SEC_ARB_OTH(SType) ->
Expand All @@ -65,14 +65,14 @@ update_topology_state(
set_possible_primary(Tab, Primary),
State#topology_state{setName = SetName};
update_topology_state(#mc_server{type = SType, pid = Pid}, State = #topology_state{type = replicaSetNoPrimary}) when ?SEC_ARB_OTH(SType) ->
exit(Pid, kill),
exit(Pid, normal),
State;
update_topology_state(#mc_server{type = SType},
State = #topology_state{type = replicaSetWithPrimary, servers = Tab}) when ?UNKN_GHST(SType) -> %% REPLICASETWITHPRIMARY
State#topology_state{type = checkIfHasPrimary(Tab)};
update_topology_state(#mc_server{type = SType, pid = Pid},
State = #topology_state{type = replicaSetWithPrimary, servers = Tab}) when ?STAL_MONGS(SType) ->
exit(Pid, kill),
exit(Pid, normal),
State#topology_state{type = checkIfHasPrimary(Tab)};
update_topology_state(
#mc_server{type = SType, setName = SetName, primary = Primary},
Expand All @@ -82,7 +82,7 @@ update_topology_state(
update_topology_state(
#mc_server{type = SType, pid = Pid},
State = #topology_state{type = replicaSetWithPrimary, servers = Tab}) when ?SEC_ARB_OTH(SType) ->
exit(Pid, kill),
exit(Pid, normal),
State#topology_state{type = checkIfHasPrimary(Tab)};
update_topology_state(Server = #mc_server{type = rsPrimary, setName = SetName}, State = #topology_state{setName = SetName}) -> %% REPLICASETWITHPRIMARY
update_topology_state(Server, State#topology_state{setName = undefined});
Expand All @@ -100,7 +100,7 @@ update_topology_state(
update_topology_state(#mc_server{type = rsPrimary, pid = Pid, host = Host, setName = SSetName},
State = #topology_state{setName = CSetName, servers = Tab}) when SSetName =/= CSetName ->
ets:insert(Tab, #mc_server{pid = Pid, host = Host, type = deleted}),
exit(Pid, kill),
exit(Pid, normal),
State#topology_state{type = checkIfHasPrimary(Tab)};
update_topology_state(_, State) ->
State.
Expand Down Expand Up @@ -154,7 +154,7 @@ stop_servers_not_in_list(HostsList, Tab) ->
false ->
ets:insert(Tab, E#mc_server{type = deleted}),
unlink(E#mc_server.pid),
exit(E#mc_server.pid, kill),
exit(E#mc_server.pid, normal),
[E#mc_server.host | Acc];
true -> Acc
end
Expand Down
2 changes: 1 addition & 1 deletion src/mongodb.app.src
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%% ex: ts=4 sw=4 noexpandtab syntax=erlang
{application, mongodb, [
{description, "Client interface to MongoDB, also known as the driver. See www.mongodb.org"},
{vsn, "3.3.3"},
{vsn, "3.4.3"},
{registered, []},
{applications, [kernel, stdlib, bson, crypto, poolboy, pbkdf2]},
{mod, {mongo_app, []}}
Expand Down