Repository navigation
A row's id can start a new life after its purge: old knowledge of it no longer outranks a fresh result, and nothing is left waiting - #732
Closed
SunkenInTime wants to merge 1 commit into
Closed
SunkenInTime wants to merge 1 commit into
SunkenInTime wants to merge 1 commit into
Conversation
…rite over 29 days old no longer outranks a fresh result or justifies a write, and a write waits for the page its row was last shown on
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Owner
Author
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.
Nothing changes on screen: the store's queue is not drawn and only driver builds send from it. This fixes #728, the queue waiting forever on a row whose id was deleted, purged and added again, and two more of the same kind that a new per-step check in the model found.
Why
The server purges an element's or a lineup group's tombstone, and a trashed page, 30 days after the delete. After that the same id can be added again, and its revisions start over at 1. The queue assumed a revision always names the same content. Two things went wrong:
_knownRowkeeps the highest revision it knows, so it trusted its own landed revision 2 over the fresh result showing revision 1. The next edit waited for a result that would show revision 2, which never comes.The rule
A revision names a row's content only within one life of the row. A new life can start only after the old row is purged, 30 days after the delete. So what this device learned about a row more than 29 days ago (
trustRowsFor, a day of margin, as with the resend window) can't outrank what it learns now, and can't justify a write:QueueSession.resultsFrom). The queue forgets them as a new session would (forgetResults, factored out ofopenSession), but keeps the session number, so results the sender records after it still apply. A write then waits for a fresh result before anything justifies it.LandedWork.aged, stored as an optionalagedkey). An aged record no longer predicts a row and never outranks a result. The first current result that covers its row retires it, whatever revision that result shows.recordExpiries), so views stay a function of the queue as it is. That keeps clear of the carried-views problem A put-back waiting for its row asks once the delete's resend window closes, in carried views too #724 fixed.You suggested stating it through the queue's notion of a justified row. That's the second half of the rule, "can't justify a write", and it's what fixes seed 247. But justification alone doesn't cover the stall: there the landed record had no prediction (no justified row) and still outranked the fresh result. Time is the one signal that separates "a result older than my answer" from "a row in its next life", so the rule is stated by age.
Cousins. Lineup groups and pages have them. Lineup tombstones and trashed pages are purged after the same 30 days, and their ids are free after that. The rule is per row of any kind, and there's a test for each. Their failure without the change is milder: the old queue asks the user ("changed by someone else"), because its landed record still predicts a row the fresh result contradicts. It doesn't stall. With the change, the next write names the new life's revision 1.
A second stall, found by the new check (seeds 375, 701, 1027, 1419, 1843). A teammate moved a row to another page. A whole-row write behind this device's own landed work waited for a result of the page the editor still drew the row on, not the page a result had last shown it on. Reading that page could never settle it. Now it waits for the page the row was last shown on.
The model
cloud_model_test.dartnow checks, after every step and not only at the end, that no entry is left stuck:Of the 13 without the change, nine are stalls caught only by the new per-step check (375, 701, 1027, 1419, 1843); main's model passed those seeds. Four are the known justification failures (247, 1983). Seed 685 came from #727's first model, before random claim sizes, and doesn't recur with today's random draws. Its sequence is the first test below. The suite runs seeds 1 to 200.
The permutation test. It requires every causal order of the same facts to end in the same queue. It now keeps a result and a clock step of 29 days or more in their given order, as it already did for a clock step and a batch refusal. A result read before such a step and one read after it are different facts now: the earlier one is no longer trusted.
Tests
New,
test/cloud_row_life_test.dart. Each fails without the change except the last of the first group, which guards against overcorrecting.an element: this device's landed write from over 29 days ago does not outrank a fresh result of the row back at revision 1, so the next edit is not left waiting for a result that never comes, and goes out against the row as it is now. The Cloud queue: an edit to a row that was deleted, purged and re-created under the same id waits forever #728 sequence, at its smallest. Without the change:awaiting a result for ElementTarget(e1)after the fresh read.an element: a result read over 29 days ago no longer justifies what this device predicts its write produced. The seed 247 sequence. Without the change, the landed work predictsProducedRow(page-a, 2)from the old content.a lineup group: a landed write from over 29 days ago does not outrank a fresh result of the group back at revision 1: the next write names revision 1. Without the change it asks the user.a page: a landed rename from over 29 days ago does not outrank a fresh page list showing the page back at revision 1: the next rename names revision 1. Without the change it asks the user.within 29 days a result at a lower revision does not outrank this device's landed write: it is older than the answer. Passes either way. It fails if the rule loses its 29-day bound.a whole write behind this device's own landed work waits for the page the row was last shown on, not the page the editor still draws it on. Without the change it waits for page-a.Package suite: 1,060 passed, and
dart analyzein the package reports no issues, infos included. The app'stest/library_storeandtest/collabpass (377). The comments check passes.Stored format
One optional key on a landed record,
aged. A record without it is not aged; the next transition marks it if it's old enough. The session'sresultsFromlives in memory, as the session always has. No shipped build writes the store.Cost
A row whose session results have aged is read again before its next justified write: at most one round of extra reads per 29 days, per page touched.
ci: library test