TOOLS-4237 Convert failpoints to a struct-based interface#1021
Draft
autarch wants to merge 1 commit into
Draft
Conversation
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d601936 to
0f08f00
Compare
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.
0f08f00 to
a84239f
Compare
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.

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.