-
Notifications
You must be signed in to change notification settings - Fork 2.3k
MongoDB replica set support #5068
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
base: main
Are you sure you want to change the base?
Conversation
| { | ||
| _type = Single; | ||
| } | ||
| else if (primaries > 0) |
Check warning
Code scanning / CodeQL
Comparison result is always the same Warning
Copilot Autofix
AI about 6 hours ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
| { | ||
| _type = ReplicaSetWithPrimary; | ||
| } | ||
| else if (secondaries > 0 || !_setName.empty()) |
Check warning
Code scanning / CodeQL
Comparison result is always the same Warning
Copilot Autofix
AI about 6 hours ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
| } | ||
|
|
||
| // Determine topology type | ||
| if (mongosCount > 0) |
Check warning
Code scanning / CodeQL
Comparison result is always the same Warning
| { | ||
| _type = Sharded; | ||
| } | ||
| else if (standaloneCount > 0 && _servers.size() == 1) |
Check warning
Code scanning / CodeQL
Comparison result is always the same Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 9 hours ago
To fix the issue (comparison is always false because standaloneCount <= 0), you should remove or revise the check that tests whether standaloneCount > 0 && _servers.size() == 1 on line 303. If the design means standalone servers are not present in _servers at this point, then the branch is dead code and should be deleted. The best fix is to safely remove the conditional branch and any associated comments describing what happens if there's a standalone server, only if this doesn't affect overall functionality or logic elsewhere. Make this change only to the block on lines 303–308, being careful to preserve other functionality and comments.
No imports or new methods are needed.
-
Copy modified lines R303-R308
| @@ -300,12 +300,12 @@ | ||
| { | ||
| _type = Sharded; | ||
| } | ||
| else if (standaloneCount > 0 && _servers.size() == 1) | ||
| { | ||
| // Single standalone server - treat as Single topology | ||
| // Standalone servers behave like a single primary for read preferences | ||
| _type = Single; | ||
| } | ||
| // else if (standaloneCount > 0 && _servers.size() == 1) | ||
| // { | ||
| // // Single standalone server - treat as Single topology | ||
| // // Standalone servers behave like a single primary for read preferences | ||
| // _type = Single; | ||
| // } | ||
| else if (primaries > 0) | ||
| { | ||
| _type = ReplicaSetWithPrimary; |
…osts from "hello" only to discover replica set hosts.
No description provided.