Repository navigation
Conversation
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 PR improves the operations consumer by ensuring only changed snapshots are written, reducing unnecessary writes and traffic to the DB. It also updates documentation and adds comprehensive tests to verify the new behavior.
Efficiency improvements to snapshot writing:
FileSpoolConsumernow writes a plan's snapshot only if its content (excludingupdated_at) has changed since the last write by that consumer, or if the consumer has not written it before. This prevents redundant writes when no new events have occurred. [1] [2] [3]_content_fingerprintcomputes a SHA-256 digest of a snapshot's content (excludingupdated_at) to efficiently detect changes.Documentation updates:
plan_execution.mdis updated to clarify that only changed snapshots are written, and to describe the behavior when snapshots are deleted or when a consumer restarts.OpsConsumerServiceis revised to reflect the new behavior of writing only changed snapshots.FileSpoolConsumeris updated to describe the new snapshot writing logic.Testing enhancements:
TestConsumerSkipsUnchangedSnapshots, is added to verify that unchanged snapshots are not rewritten, that new events trigger writes, that failed writes are retried, and that consumers write all snapshots on startup. CouchDB revision behavior is also tested.(References: [1] [2] [3] [4] [5] [6] [7] [8] [9]