Repository navigation
Conversation
Collaborator
Author
|
Doh, this should've been a draft. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The temporary authentication account can be deleted without a replacement, blocking administrator bootstrapping, and the readiness request can hang indefinitely without a client-side timeout.
2 open issues
What changed in this PR
Adds optional config shards to mongodb-runner’s sharded clusters, allowing callers to delegate the transition and readiness checks to the runner.
Changes:
- Adds
configShardCLI and programmatic options, validation, and serialized state. - Implements the transition, readiness polling, and temporary-user handling for authenticated clusters.
- Adds integration tests and usage documentation.
| File | Description |
|---|---|
packages/mongodb-runner/src/mongoserver.ts |
Exposes keyfile contents for authentication detection. |
packages/mongodb-runner/src/mongocluster.ts |
Implements config-shard startup, authentication handling, and serialization. |
packages/mongodb-runner/src/mongocluster.spec.ts |
Tests transitions, authenticated startup, serialization, and topology validation. |
packages/mongodb-runner/src/cli.ts |
Adds the --configShard option. |
packages/mongodb-runner/src/cli.spec.ts |
Tests CLI startup and ls --json reporting. |
packages/mongodb-runner/README.md |
Documents config-shard usage and requirements. |
Review effort: Balanced
autarch
added a commit
that referenced
this pull request
Nov 5, 2026
Review follow-ups on #963: - On clusters that enforce authentication, configShard now requires at least one configured user. Without one, the temporary transition user would have been the only account on the cluster, and dropping it after the transition would leave no users and a permanently closed localhost exception, locking out any administrator bootstrap. - The transition/readiness clients now set a client-side timeoutMS so a mongos that stops responding cannot hang start() indefinitely (maxTimeMS only bounds server-side execution).
autarch
added a commit
that referenced
this pull request
Nov 6, 2026
Review follow-ups on #963: - On clusters that enforce authentication, configShard now requires at least one configured user. Without one, the temporary transition user would have been the only account on the cluster, and dropping it after the transition would leave no users and a permanently closed localhost exception, locking out any administrator bootstrap. - The transition/readiness clients now set a client-side timeoutMS so a mongos that stops responding cannot hang start() indefinitely (maxTimeMS only bounds server-side execution).
autarch
force-pushed
the
11-05-mongodb-runner_config-shard-topology
branch
from
November 6, 2026 21:46
7e34847 to
a5df849
Compare
autarch
added a commit
that referenced
this pull request
Nov 9, 2026
Review follow-ups on #963: - On clusters that enforce authentication, configShard now requires at least one configured user. Without one, the temporary transition user would have been the only account on the cluster, and dropping it after the transition would leave no users and a permanently closed localhost exception, locking out any administrator bootstrap. - The transition/readiness clients now set a client-side timeoutMS so a mongos that stops responding cannot hang start() indefinitely (maxTimeMS only bounds server-side execution).
autarch
force-pushed
the
11-05-mongodb-runner_config-shard-topology
branch
from
November 9, 2026 15:59
a5df849 to
b2c1f2d
Compare
Passing --configShard (or configShard: true in the config file / programmatic options) turns the config server replica set into a config shard once the cluster is up, by running transitionFromDedicatedConfigServer through mongos. start waits until the transition completes (the config server appears in listShards), and ls --json and start --json report configShard: true for such clusters, so consumers can distinguish a config shard from a dedicated config server without connecting. This is the topology mongosync's test clusters previously built by running the transition themselves after mongodb-runner finished (REP-8055). Details, verified empirically: - transitionFromDedicatedConfigServer requires MongoDB 8.0 or newer (it existed briefly in 5.0 and is absent from 6.0.x and 7.0.x binaries), so the option is rejected with a clear error for other versions, for the standalone and replset topologies, and in the option docs, CLI help, and README. - The localhost exception does not permit the transition, and __system cannot authenticate through mongos without enableTestCommands. On clusters that enforce authentication (keyfile or --auth), the runner therefore creates a temporary root user through the localhost exception, runs the transition and readiness poll as that user, and creates the cluster's own users as it (the localhost exception closes once any user exists and does not reopen after a drop) before dropping it. - configShard requires at least one configured user on clusters that enforce authentication: without one, the temporary transition user would be the only account on the cluster, and dropping it would leave no users and a permanently closed localhost exception, locking out any administrator bootstrap. - The transition and readiness-poll clients set a client-side timeoutMS, and each listShards poll is bounded by maxTimeMS from the remaining time budget, so a mongos that stops responding cannot hang start(). Tests cover the config shard topology and serialize round trip, config shard with keyfile auth (asserting the temporary transition user is removed and only the configured user remains), rejection with authentication but no configured users, rejection for non-sharded topologies, and CLI start --json / ls --json reporting.
autarch
force-pushed
the
11-05-mongodb-runner_config-shard-topology
branch
from
November 17, 2026 17:56
b2c1f2d to
c208d69
Compare
autarch
marked this pull request as ready for review
November 17, 2026 18:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
This adds a new
configShardoption to mongodb-runner for theshardedtopology. If it's set, then after the cluster is up and shards are added, the runner runstransitionFromDedicatedConfigServerthrough mongos, waits until the config server appears inlistShards(sostartreturns with the topology fully usable), and serializesconfigShard: truesostart --jsonandls --jsonreport it.Open Questions
None
Checklist