Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-stream snapshotting #2

Merged
merged 6 commits into from
Oct 19, 2017
Merged

In-stream snapshotting #2

merged 6 commits into from
Oct 19, 2017

Conversation

bartelink
Copy link
Collaborator

@bartelink bartelink commented Sep 4, 2017

This PR shows an experimental approach to in-stream snapshotting. The following aspects should be noted about the approach used:

  • intentionally surfaces snapshot as an event to
    • minimise surprises; if a developer regularly traverses the snapshotting schemas and log, it's more likely to be borne in mind
    • allow the snapshotting correctness to be subjected to normal testing
  • only ever writes a snapshot-event when one or more other events are being written
    • Maintaining multiple snapshot versions becomes expensive (both in terms of storage and in terms of having to traverse them when doing actual material work)
    • Readers doing fixup writes is liable to trigger concurrency conflicts

Basic technique:

  • reads backward in batches
    • if a snapshot is encountered, the read process is stopped as we can now fold from the compaction event forward
    • if we hit the start of the stream, we deem ourselves not to have encountered a snapshot
  • when writing
    • the need for a snapshot (based on whether we're within a single page and/or there's a compaction event falling within the last page given the current state) is surfaced as an IsCompactionDue predicate in the Context
    • the command processing flow actively checks this and generates the Snapshot event in an explicit fashion

Work

  • Define commands / tests
  • Minimize reads
  • Ensure we have tests for batch capacities
  • Log compaction savings

@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 3 times, most recently from e43d9ff to edcb74a Compare September 5, 2017 08:04
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch from edcb74a to cae8ccf Compare September 5, 2017 10:01
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 4 times, most recently from ca1e320 to 65e527c Compare September 6, 2017 02:37
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 6 times, most recently from 0de9f34 to c41d2f3 Compare September 12, 2017 07:00
@bartelink bartelink changed the title In-stream snapshotting WIP In-stream snapshotting Sep 12, 2017
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 2 times, most recently from 9889e0a to 8b0431f Compare September 12, 2017 21:47
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 2 times, most recently from 2bed359 to 8c28a8e Compare September 24, 2017 07:38
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch from 8c28a8e to b479fb4 Compare September 24, 2017 09:59
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 3 times, most recently from 882c244 to 127e7da Compare September 24, 2017 16:08
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 4 times, most recently from d880c8c to 4fb9469 Compare October 1, 2017 03:35
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 3 times, most recently from 8f455f6 to 95573da Compare October 1, 2017 20:52
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch from 95573da to 432f3c8 Compare October 1, 2017 21:53
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch 6 times, most recently from f18bf78 to c48733d Compare October 6, 2017 04:20
@bartelink bartelink force-pushed the master branch 3 times, most recently from da48901 to 722d0ea Compare October 6, 2017 08:31
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch from c48733d to e6028c1 Compare October 6, 2017 08:38
@bartelink bartelink force-pushed the feature/ges-instream-snapshots branch from fb9e3c8 to 5385e59 Compare October 19, 2017 13:52
@bartelink bartelink merged commit f41e084 into master Oct 19, 2017
@bartelink bartelink deleted the feature/ges-instream-snapshots branch November 13, 2017 12:05
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