Commit fd3154d
committed
PYTHON-525 Don't reset whole Cluster on network error.
According to the spec, clear the pool for the server we were disconnected from
and mark the server Unknown, but don't update other servers. This is a change
from PyMongo 2's MongoReplicaSetClient, which reset all servers and their pools
when disconnected from the primary specifically.
The spec's justification is, "since application sockets are used frequently, a
network error likely means the server has just become unavailable, so an
immediate refresh is likely to get a network error, too. The server will not
remain Unknown forever. It will be refreshed by the next periodic check or, if
an application operation needs the server sooner than that, then a re-check
will be triggered by the server selection algorithm."
If the primary has gone down and we are in the midst of an election, marking
all servers Unknown and forcing a re-scan will simply detect that all servers
are currently secondaries, which the client knows anyway.1 parent 5d5c983 commit fd3154d
2 files changed
Lines changed: 46 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
| 813 | + | |
814 | 814 | | |
815 | 815 | | |
816 | | - | |
817 | | - | |
| 816 | + | |
818 | 817 | | |
819 | 818 | | |
820 | 819 | | |
821 | 820 | | |
822 | 821 | | |
823 | 822 | | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
| 823 | + | |
829 | 824 | | |
830 | 825 | | |
831 | 826 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
1109 | 1110 | | |
1110 | 1111 | | |
1111 | 1112 | | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
1112 | 1155 | | |
1113 | 1156 | | |
1114 | 1157 | | |
0 commit comments