Repository navigation
Order trimmed analyses and same-time notes by the order written - #22
Merged
Merged
Conversation
trimJobs sorted a session's jobs by Started to drop the oldest. Two time.Now calls back to back can return the same time, and when two jobs did, the sort left which one survived to the map's iteration order. TestJobsAreBounded then failed now and then, finding the oldest job still there. Each job now keeps the number its ID is made from, and trimJobs sorts by that. The new test gives every job the same Started and checks that the newest maxJobs survive.
Notes merges the session's log with its connected sessions' logs and sorts by At. sort.Slice is not stable, so a log's notes that read the same clock value could come back in a different order from the one they were written in, once a connected log was merged in. sort.SliceStable keeps each log's own order for those.
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.
Two fixes for the same cause: back-to-back
time.Nowcalls can return the same time. On the machine this was found on, about 3% of consecutive calls returned a time no later than the one before.trimJobssorted byStarted, so with equal times the job that survived depended on map iteration order.TestJobsAreBoundedfailed now and then because of it. Jobs now carry the number their ID is made from, and trimming sorts by that.Notessorted the merged logs with an unstable sort, so same-time notes from one log could come back reordered once a connected log was merged in. Nowsort.SliceStable.Each commit's new test fails against the old code: 5 of 5 runs for the jobs test, every run for the notes test.