track lowest allowed timestamp per persistence ID #110
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.
References #108
Socializing this before writing tests, but the idea is:
InstantFactory.now()
) against the acceptable timestamp, choose the later of the two. If the later one is the minimum acceptable, then update the minimum acceptable for next time.InstantFactory.now()
(local monotonic clock): earlier ones are evicted because monotonicity ensures that the next write will be after the minimum.Net performance impact should be minimal:
ConcurrentHashMap
view, so should be fast. In the unlikely event we need to use a late timestamp than we want (viz. we've detected clock skew), there will be a local ask: this is like the recovery case, but happens more often, so it might have an impact but this should be "transitory": the minimum acceptable timestamp will advance by a microsecond per event, and it's unreasonable to expect thousands of events for a persistence ID per second (soInstantFactory.now()
should be moving a few orders of magnitude faster than the minimum acceptable)