Conversation
…d id is never reused
Contributor
Author
|
@yegor256 take a look please, happy to clarify anything about the change. |
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.
Fbe.fbnumbered every new fact from(max _id)of the facts that were still in the factbase. Once the fact with the highest_idwas deleted, the next insert got its number again, so anything that kept that_idfrom earlier in the run, such asFbe.overwrite,Fbe.deleteor the log lines, pointed at a different fact.The
Preblock now remembers, in a local it closes over, the highest_idit has given out while the cached factbase lives, and takes the larger of that and(max _id), so a number is never handed out twice. The(max _id)part stays, so a factbase that arrives with facts already numbered still continues after its highest one.The tests delete the last fact, delete every fact, and delete then insert inside one transaction, and each checks the next
_id. One more test makes sure numbering still follows the highest_idof the origin factbase.This covers one run. An
_iddeleted in a previous run and not saved into the factbase can still come back in the next one, because nothing records it; that would need the counter persisted somewhere, which is a bigger change than this issue.Closes #1245