refactor: abstract store and remove all db.Atomic usage#5021
Merged
Conversation
161daf3 to
4d59692
Compare
f46c110 to
dac797c
Compare
Codecov Report
@@ Coverage Diff @@
## master #5021 +/- ##
==========================================
- Coverage 53.57% 53.53% -0.05%
==========================================
Files 430 431 +1
Lines 54091 54120 +29
==========================================
- Hits 28980 28971 -9
- Misses 22864 22900 +36
- Partials 2247 2249 +2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Contributor
There was a problem hiding this comment.
Snapshot? AccountsOnlineRoundParams is part of accountsV2Reader
Contributor
Author
There was a problem hiding this comment.
we will sort out snapshot, batch, transaction on the PR I'm work on on right now based on what methods they end up calling.
The PR I'm working on gets rid of that tx *sql.Tx in the callbacks in favor of using interfaces with the methods we have defined already.
| dbs.Wdb.SetLogger(dblogger) | ||
|
|
||
| newLedgerTracker.dbs = dbs | ||
| newLedgerTracker.dbs = store.CreateTrackerSQLStore(dbs) |
Contributor
There was a problem hiding this comment.
I think go prefers Make/New prefix instead of Create for such functions
algorandskiy
approved these changes
Jan 30, 2023
cce
reviewed
Jul 21, 2023
| start := time.Now() | ||
| ledgerGeneratecatchpointCount.Inc(nil) | ||
| err = ct.dbs.Rdb.AtomicContext(ctx, func(dbCtx context.Context, tx *sql.Tx) (err error) { | ||
| err = ct.dbs.BatchContext(ctx, func(dbCtx context.Context, tx *sql.Tx) (err error) { |
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.
Summary
db.Pairand/ordb.Accessorfor the trackerdb/catchpoints has been removed.Transaction(atomic read+write),Snapshot(isolated reads),Batch(all or nothing writes)Upcoming PRs:
Transactionin favor of eitherSnapshotorBatch.*sql.Txexposed in this functions to be only the already defined "reader/writer" abstarctions.Test Plan
Existing tests.