Skip to content

TOOLS-4237 Convert failpoints to a struct-based interface#1021

Draft
autarch wants to merge 1 commit into
masterfrom
TOOLS-4237-failpoint-struct-interface
Draft

TOOLS-4237 Convert failpoints to a struct-based interface#1021
autarch wants to merge 1 commit into
masterfrom
TOOLS-4237-failpoint-struct-interface

Conversation

@autarch

@autarch autarch commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

This replaces string-based failpoints with an interface that failpoints need to satisfy. This is preparation for follow-up work which will add a new failpoint capable of synchronizing a pause inside mongodump with test code, so that we can write more deterministic tests for oplog rollover failures.

autarch commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

@autarch autarch force-pushed the TOOLS-4237-failpoint-struct-interface branch 2 times, most recently from d601936 to 0f08f00 Compare July 9, 2026 16:17
Replace the plain-string failpoint identifiers and duplicated
per-build-tag function implementations with a Manager interface (a
real manager backed by a mutex-guarded map, and a noopManager used
when the failpoints build tag isn't set) plus a Failpoint struct that
carries a name, optional string value, and the signaling needed by
failpoints that pause code until externally resumed.

This follows the same shape as mongosync's mongo-go/failpoints package
(Manager interface + Failpoint struct with a resume channel), scaled
down to what mongo-tools actually needs: a single global default
manager rather than per-instance injection, since mongo-tools failpoints
are configured once via a CLI flag rather than per test-created app
context.

Only the tiny "which manager is the default" decision is build-tag
gated now (in manager.go's and noop_manager.go's own init functions);
the Failpoint type and the package-level API (ParseFailpoints, Reset,
Get, Enabled, Lookup) are unconditionally compiled, matching how
mongosync keeps its failpoints package itself untagged and gates only
the wiring layer.
@autarch autarch force-pushed the TOOLS-4237-failpoint-struct-interface branch from 0f08f00 to a84239f Compare July 9, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant