Repository navigation
fix: Write FDv2 data back to the persistent store after a store outage - #503
Open
kinyoklion wants to merge 1 commit into
Open
kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
When a persistent store becomes available again after an outage, the FDv2 data system must write its in-memory data back to the store. The status listener that starts the write-back called persistent_store_outage_recovery from a block given to define_singleton_method, where self is the listener object, so every call raised NoMethodError and the write-back never ran. The listener now calls the method through a Method object. The write-back also left out deleted items, because InMemoryFeatureStoreV2#all filters them, so a flag deleted during the outage lost its tombstone. Store#commit now writes deleted items too. Tombstones now carry the key as a String, as other items do; with a Symbol key, the DynamoDB store wrote and deleted the same item in one batch and the write-back failed. The contract test service now advertises persistent-data-store-recovery and passes the Consul DSN to the Consul store, so that the store recovery tests run and the Consul tests use the store address that the harness gives. Generated-by: termag
kinyoklion
marked this pull request as ready for review
November 20, 2026 18:38
There was a problem hiding this comment.
Risk: medium.
Automated risk review (dry run): Medium
This PR would not be automatically approved. Human approval required.
Why: Persistent-store write-back after an FDv2 outage is a data-correctness change in lib/ldclient-rb/impl/data_system/fdv2.rb and lib/ldclient-rb/impl/data_store/store.rb (tombstones and the recovery listener), so this is not a narrow low-risk fix. Human review is needed, and no reviewers were assigned.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
This branch has not been deployed
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.


After a persistent store outage, the FDv2 data system never wrote its in-memory data back to the store. The status listener calls
persistent_store_outage_recoveryfrom a block given todefine_singleton_method, whereselfis the listener, so each call raised NoMethodError, which the broadcaster logged and dropped. The listener now calls the method through a Method object. The write-back also left out deleted items, becauseInMemoryFeatureStoreV2#allfilters them, and tombstones carried a Symbol key, which made the DynamoDB store put and delete the same item in one batch. Both are fixed. The contract test service now advertisespersistent-data-store-recoveryand gives the harness Consul DSN to the Consul store; without these the store recovery tests do not run, and the Consul ones bypass the harness store proxy.Still failing:
persistent data store/dynamodb/store recovery/retries write back after another failure. The AWS client retries the cut write-back request itself and reports success, so the SDK never starts a fresh write-back. Whether client retries should count as a failed write-back is a separate question.Testing: the new specs fail without the change; the v3 store recovery contract tests go from 2/18 to 17/18 passing.
SDK-3704
Opened from termag
Note
Overview
Fixes FDv2 persistent store recovery so in-memory state is written back when the store comes online with stale data, and so recovery listeners actually run.
The outage listener now invokes
persistent_store_outage_recoverythrough a boundMethodinstead of calling it on the listener object (which previously raisedNoMethodErrorand skipped write-back).Store#commitpersists deletions by using newall_including_deletedand encoding delete tombstones with string keys, preventing resurrected items and DynamoDB put/delete conflicts.Contract harness changes advertise
persistent-data-store-recoveryand normalize Consul DSNs tohttp://host:portURLs. Specs cover tombstone commits and status-driven recovery write-back.Reviewed by Cursor Bugbot for commit cb9c099. Bugbot is set up for automated code reviews on this repo. Configure here.