Pinned Aspire MongoDB advanced replica-set reconciliation and lifecycle boundaries
Parent: MongoDB Drivers · Published reference · snapshot 2026-11-02
↓ Facts as markdownall context files
Source-anchored research for Pinned Aspire MongoDB advanced replica-set reconciliation and lifecycle boundaries. Run status: COMPLETED.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Structure and components
- Before reconfiguring a persisted set, the facade compares persisted host values with declared internal hosts case-insensitively and throws if any persisted host is missing. The helper removal fixture asserts the surviving host array and retained IDs; it does not exercise the facade initialization path. The functional topology fixture explicitly excludes removals and attributes the refusal to combined member removal and changed split horizons. These sources describe different layers, so the helper fixture does not establish facade removal support. (medium confidence) [source 1] [source 2] [source 3]
- The logical facade tracks stopped member names because it has no process of its own. It publishes Exited when all declared members have stopped. Its member-before-start callback removes the starting member’s stopped marker and moves an already-configured facade from the all-stopped condition to Starting; that callback contains no initialization call. A ready notification restores Running only when its cancellation token is not canceled, IsConfigured is true, and the notifying member is absent from StoppedMembers. The restart fixture publishes stop, before-start, canceled ready and then ready events and asserts Exited, Starting, Starting and Running respectively. (medium confidence) [source 1] [source 2] [source 3]
How it works
- BuildMembersConfiguration preserves existing IDs using a case-insensitive host-to-ID map. It reserves all IDs in the supplied current configuration and allocates unused nonnegative IDs only for new hosts. The helper fixtures assert retained IDs across append, removal and reorder, and an unused ID when one host is replaced. (medium confidence) [source 1] [source 2]
- For a persisted configuration, MembersConfigurationMatches compares array counts, finds each desired document by ID, and compares every desired field. When desired votes or priority is absent, it checks the corresponding current value against one; it ignores other server-added fields. A match skips reconfiguration. Otherwise the initializer sends replSetReconfig with the facade name, selected version plus 1, desired members, force=true, and ReadPreference.Nearest. It retries NewReplicaSetConfigurationIncompatible and ConfigurationInProgress while retaining the last command exception. (low confidence) [source]
- Only when all probes report uninitialized does the initializer use the first declared member to initiate a one-member configuration, then forcibly reconfigure to all desired members at version 2. It uses ReadPreference.Nearest for both commands. AlreadyInitialized, NewReplicaSetConfigurationIncompatible and ConfigurationInProgress cause another whole attempt; timeout and connection exceptions in this branch also permit retry. (low confidence) [source]
- As literal wrapper configuration, WithMember calls WithTlsAllowInvalidCertificates and adds WithHttpsDeveloperCertificate only when no HttpsCertificateAnnotation exists. Initialization throws when any member has TlsEnabled false. The source comments attribute that requirement to its SNI-based split-horizon design; this is an attributed implementation rationale. (medium confidence) [source 1] [source 2] [source 3]
Problems, failure modes and limitations
- At the pinned source, AddMongoDBReplicaSet creates a logical resource with a shared keyfile from CreateReplicaSetKeyFile, optional shared username, and a generated default password when none is supplied. It registers a separate MongoDB health check and initial Waiting state. Its initializer reports FailedToStart when no members are declared. The API is experimental; its remarks limit initialization to local runs and state that publishing and deployment are unsupported. It calls ThrowIfPublishMode before creating the resource. (medium confidence) [source 1] [source 2] [source 3]
- Each configuration attempt has a probe loop over the declared members, using replSetGetConfig with explicit ReadPreference.Nearest. Among returned configurations it selects the highest integer version; equal versions leave the first selected result in place. A probe TimeoutException or MongoConnectionException prevents the all-uninitialized condition. Fresh initialization is eligible only after every member reports NotYetInitialized. An exception outside the handled probe outcomes reaches the outer failure handler. (low confidence) [source]
- The pinned retry loop permits ten attempts and waits one second between unsuccessful attempts except after the last. Reconfiguration retries NewReplicaSetConfigurationIncompatible and ConfigurationInProgress; initiation retries those plus AlreadyInitialized and catches TimeoutException or MongoConnectionException. The loop retains the last caught MongoCommandException. Exhaustion throws a DistributedApplicationException with that error when present; the outer handler logs critically and publishes FailedToStart. IsConfigured is set and Running is published only after the configured condition succeeds. (low confidence) [source]
Comparisons and alternatives
- The helper rebuilds voting fields from declared order rather than copying arbitrary persisted votes or priority: the first seven generated documents omit those fields, and later documents set both to zero. The comparison helper treats omitted desired votes and priority as defaults of one. Preserving host IDs therefore does not imply preserving customized voting fields when reconfiguration occurs. (medium confidence) [source 1] [source 2]
- The facade URI contains the declared member endpoints as a comma-separated seed list, shared URI-escaped credentials, replicaSet, authSource and authMechanism, with tls=true resolved lazily from the first endpoint. Its exposed properties include the full URI and replica-set name rather than a single host/port. A member URI instead appends directConnection=true and, for advanced members, readPreference=secondaryPreferred. (medium confidence) [source 1] [source 2] [source 3]
Facts and statements
- At the pinned source, WithMember rejects a member carrying the single-member replica-set annotation, an already assigned replica-set name (including a duplicate in the same set), and any admission after fifty members. These checks precede ConfigureReplicaSetMember. Its publish-mode guard runs before these checks and before mutation; the publish-mode fixture asserts that member and facade annotations, credentials and model resources remain unchanged. (medium confidence) [source 1] [source 2] [source 3]
- WithMember rejects a conflicting keyfile value and explicitly different username or password parameter objects before ConfigureReplicaSetMember mutates the member. An admitted member receives the facade’s shared username and password and has PasswordParameterWasGenerated set to false. A keyfile already using the shared parameter retains its custom mount path; an absent keyfile is added through WithKeyFile. ConfigureReplicaSetMember sets ReplicaSetName, adds the membership annotation and bind-all and --replSet arguments. WithKeyFile treats its value as file contents and mounts it at the specified container path. (medium confidence) [source 1] [source 2] [source 3]
- WithMember adds WaitForStart for each member. The initializer publishes BeforeResourceStartedEvent to honor those waits before resolving the facade connection string, publishing ConnectionStringAvailableEvent, and setting Starting. The fixture asserts WaitUntilStarted, so member health is not the prerequisite for initialization. (medium confidence) [source 1] [source 2]
- The initializer resolves a direct connection expression for every declared member and designates the first as initialPrimary. It builds each Internal address from the resource name and target port and resolves External from the endpoint HostAndPort property. BuildMembersConfiguration writes Internal into the host field and External into the external field nested under horizons; the fixture asserts separate internal and external address arrays. (medium confidence) [source 1] [source 2] [source 3]
- Initial Running publication follows configuration success (or an already-matching configuration), without a health/election wait in that success block. The facade registers a separate MongoDB health check with a cached client. The functional fixture waits for replica-set health separately before exercising its workload; source-defined Running is therefore not an assertion that every member is healthy or that election readiness has been verified. (medium confidence) [source 1] [source 2]
- The persisted-data functional theory declares unchanged topology, appended member, prepended member and reordered members. Its second AppHost reuses the earlier password and data volumes, waits for facade health, checks stored data and compares host-to-ID mappings; added-member cases also assert unique IDs and four configured hosts. These are literal fixture assertions about those topology cases. (medium confidence) [source 1] [source 2]
Children
- No children recorded.