Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
Created March 21, 2014 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregoryyoung/9686774 to your computer and use it in GitHub Desktop.
Save gregoryyoung/9686774 to your computer and use it in GitHub Desktop.
hmm lots of comments
private bool DetectConcurrencyViolations(CheckpointTag expectedTag)
{
//NOTE: the comment below is not longer actual
// Keeping it for reference only
// We do back-read all the streams when loading state, so we know exactly which version to expect
//TODO: if the following statement is about event order stream - let write null event into this stream
//NOTE: the following condition is only meant to detect concurrency violations when
// another instance of the projection (running in the another node etc) has been writing to
// the same stream. However, the expected tag sometimes can be greater than last actually written tag
// This happens when a projection is restarted from a checkpoint and the checkpoint has been made at
// position not updating the projection state
return expectedTag != _lastCommittedOrSubmittedEventPosition;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment