-
Notifications
You must be signed in to change notification settings - Fork 524
Add kvstore to catchpoints #4455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
18aab49 to
92821c7
Compare
c37defc to
01a3850
Compare
Codecov Report
@@ Coverage Diff @@
## feature/avm-box #4455 +/- ##
===================================================
- Coverage 55.30% 54.93% -0.37%
===================================================
Files 403 403
Lines 51036 51120 +84
===================================================
- Hits 28224 28082 -142
- Misses 20419 20697 +278
+ Partials 2393 2341 -52
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
algorandskiy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I need another pass and look the entire boxes PR first.
Couple notes:
- catchpoint dump should have kv values in its textual format
- on readDatabaseStep and iterators closing business - why it was changed at all?
|
oh, looks like the feature branch misses catchpoint overflow pr |
Still want to test a full restore that involves .replay(), and ensure that merkle tree additions are tested.
530c305 to
0963cb3
Compare
readDatabaseStep (and the internal assyncWriter) are changed so that they return empty values when they are done, rather than having the caller try to determine how much data they should return.
tzaffi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but left a few small questions.
| err = catchpointAccessor.ResetStagingBalances(ctx, true) | ||
| require.NoError(t, err, "ResetStagingBalances") | ||
| // TODO: catchpointAccessor.ProgressStagingBalances() like in ledgerFetcher.downloadLedger(cs.ctx, peer, round) like catchup/catchpointService.go which is the real usage of BuildMerkleTrie() | ||
| // TODO: catchpointAccessor.ProcessStagingBalances() like in ledgerFetcher.downloadLedger(cs.ctx, peer, round) like catchup/catchpointService.go which is the real usage of BuildMerkleTrie() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // TODO: catchpointAccessor.ProcessStagingBalances() like in ledgerFetcher.downloadLedger(cs.ctx, peer, round) like catchup/catchpointService.go which is the real usage of BuildMerkleTrie() |
I'm guessing this TODO from #2235 is no longer relevant
|
I want to merge this into the feature branch, so I'll do that around 4pm unless I hear objections. @algorandskiy , I didn't follow the very last thing you said, but I also see you resolved it, so I'm not going to worry about it unless you mention it again on the feature branch review. @cce, I'm going to carry over your object to |
|
I ran a catchpoint test, worked. Going through it when I have time today. |
| return err | ||
| } | ||
|
|
||
| rows, err := tx.Query("SELECT key, value FROM catchpointkvstore") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this need to be ordered. The result should be the same across all nodes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only so that the catchpoint dump utility prints in the same order? I want to check my understanding that the catchpoint files don't actually need to be identical (down to the level of ordering) for any other reason. All that matters for their use that they produce the same merkle trie, which is order independent. (I think.)
I'll certainly make the change, but I want to be sure I know what's going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! This is actually in the catchpoint dump utility! So certainly we're talking about the same reason.
So now, just to be extra safe, can you confirm that the similar SELECT, in catchpointwriter.go does NOT need to be ordered?
// Create the *Rows iterator JIT
if cw.kvRows == nil {
rows, err := tx.QueryContext(ctx, "SELECT key, value FROM kvstore")
if err != nil {
return err
}
cw.kvRows = rows
}
Roundtrip tested in catchpointwriter_test.go, but I'm still unhappy that I'm not testing the entire catchpoint restore process, including replay. A good test that includes that with many kinds of txns would have caught my last bug.
I'm also unsure if the merkle tree is being properly tested with the tests so far.
Sorry for the size of the diff - I finally fixed a problem that was introduced when ledger/internal was created. A lot of handy test code was pushed down into it, even though it was a test of the ledger proper, not ledger/internal (which is mainly the BlockEvaluator). So this moves that support code up into ledger, and uses it (including
DoubleLedger) to make it easy to test the catchpoint process after high level txns, like a box creating app call, are issued.