-
Notifications
You must be signed in to change notification settings - Fork 128
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
multi: drop sqlite #1480
multi: drop sqlite #1480
Conversation
98e13a2
to
0a0ae52
Compare
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.
Initial review: it's a thing of beauty. RIP sqlite. Just a handful of minor issues. Will do a deeper dive with testing.
@@ -579,7 +579,7 @@ type TicketPoolValsAndSizes struct { | |||
StartHeight uint32 `json:"start_height"` | |||
EndHeight uint32 `json:"end_height"` | |||
Value []float64 `json:"value"` | |||
Size []float64 `json:"size"` | |||
Size []uint32 `json:"size"` |
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.
Note to self: api/types major version bump needed (to v5)
|
||
func makeARRAYOfBIGINTs(ints []uint64) string { | ||
if len(ints) == 0 { | ||
return "'{}'::BIGINT[]" // cockroachdb: "ARRAY[]:::BIGINT[]" |
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, I wonder if I was doing this string gen stuff because cockroachdb sucks with the lib/pq driver. Ah well, maybe cockroach will be more compatible someday. The right way to do this is how you got it now, with pq.Array/etc.
Would you also please remove |
All good with a fresh resync:
Although I miss a report at this stage (before indexing etc.) that says height and elapsed time. |
Upgrade went smoothly in 12 minutes:
|
db/dcrpg/sync.go
Outdated
panic("invalid starting height") | ||
} | ||
|
||
log.Info("Current best block (chain server): ", lastBlock) |
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 one is not (chain server)
, but the postgresql db height, whatever we want to call that.
But also logging nodeHeight
around here would be good too.
Upgrade the pgsql database, adding a stats table and a winners column to the blocks table. This is a lengthy upgrade that requires pulling MsgBlocks for the entire blockchain and evolving the ticket pool.
*Database Upgrade* - Create a backup before running this branch
Removes SQLite database. Everything is moved to
ChainDB
.In fact, nearly everything that needed to be moved was put in pgblockchain.go for now.I'll probably do some more organizing before removing from draft status, though.For full testing, you'll need dcrlabs/bug-free-happiness#6
It has passed the following tests.
go test
with all combinations of-tags
in dcrpgapiload -a rotation
The database upgrade itself is fairly long. Took ~30 minutes on my SSD. This is because the entire blockchain must be requested again and the ticket pool evolved appropriately to populate the stats table.
I think that @chappjc has expressed some interest in combining
ChainDB
andChainDBRPC
.I didn't do that yet, but unless there a reason not to, I may grab that here as well.doneIn addition to some further organizing the dcrpg package, I imagine there is some optimization to be done in the main loop now that there are fewer data sources to sync.