Make the foreach early-exit semantics consistent#1222
Merged
eddyashton merged 6 commits intomicrosoft:masterfrom May 28, 2020
Merged
Make the foreach early-exit semantics consistent#1222eddyashton merged 6 commits intomicrosoft:masterfrom
eddyashton merged 6 commits intomicrosoft:masterfrom
Conversation
|
foreach_tests@8766 aka 20200528.6 vs master ewma over 50 builds from 8553 to 8761 |
jumaffre
reviewed
May 27, 2020
jumaffre
reviewed
May 27, 2020
jumaffre
reviewed
May 27, 2020
jumaffre
approved these changes
May 28, 2020
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.

Noticed as part of #1221 (and one need manually merging when the other goes in, due to similar changes in
tx_view.h):TxView::foreachtakes a visitor lambda, and returning false is supposed to mean "I'm done, don't call me again". We need to run this twice, for both the original state and the current write set. The early-out-on-false behaviour only applied to the writes - if you decided you were done after looking at something in the state, you still get called with something in the write set. This fixes that - return false means you won't get called again at all.On a related point,
foreachitself returned a bool with no meaning. It could return "the lambda returned false at some point", or "you saw everything", but none of these seem particularly clear or useful. For clarity, I've just removed the return type entirely.++unit tests