-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Parachains db column "migration" #5797
Parachains db column "migration" #5797
Conversation
Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
|
Tested this locally, but a Versi burn in is needed to see how much time migration takes and if there are any issues afterwards |
|
I was about to suggest the same 👍 It is wa-ay better to provide a clear migration path than to crash on upgrade with no cleaning up. |
|
The only issue was that paritydb has stored unordered columns as hashes only with no values, so @eskimor told that there is no way to migrate with data preservation. Have you tried that such a migration does really work? |
Not sure what happens to the data right now, it shouldn’t be preserved. Its a soft wipeout and hopefully there is no dangling stuff. The good partt is that there is no startup error now and no need to manually ‘fix’ the db. |
|
I don't think Why not just delete the parachains database instead? As far as I know it should be re-populated in a matter of a few blocks. |
|
Can only confirm, only 'uniform' column can be migrated. |
|
Migrate function here should work when changing configuration of hash indexed column (hash indexed to hash indexed), and also with the same parameters (can gain reclaim some space sometime). When migrating from hash indexed to btree, what may currently happen is that it migrate the index and values tables (the btree_indexed option parameter is currently ignored by the migration). After that, probably opening the db with btree_index act as if the column was deleted (no entry may have been written where the btree root usually is) and things may run fine. For btree indexed column the migrate function is The fact that we cannot recover key of the content stored in column may be a concern in some case, idea should be to attach key to value then or implement a variant that keep original key along the value (or in an attached value entry). But that is a different question. Also depending on context if a single column needs to be removed, deleting the metadata file and all index_X_* and table_X_* with X the column number should work (almost untested). |
It would be enough to delete dispute coordinator column I suppose. The goal here is to provide more or less smooth migration. Even a shell script that performs |
|
I was hoping for a more sane solution especially on the user experience. Automated db removal sounds a bit scary to me. |
|
+1 on the fact that automating a column removal is scary, maybe if we know some column are allowed to be removed we can hardcode the info and only run this on such column. |
Signed-off-by: Andrei Sandu <[email protected]>
I've implemented it to work only for 1 column (dispute coordinator data) and will spit out warnings. There shouldn't be any issues with sync and responsiveness AFAIK. |
|
Database implementation details w.r.t. file names may change in the future and this will break. There should be a function for clearing a column provided by the database. I've added one here: |
|
Thanks, you are right, this relies on impl details. I’d expand on that - move most of this code in paritydb and add an additional column option to delete it when no migration is available. Would this work? |
|
Not sure this is a good idea. Mixing actual configuration options with some flags that specify behaviour for some edge cases. I'd rather have it simple: try to open the database in the user code. If there's a particular error, the user code may handle it by dropping the column. I've added an explicit error type |
Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
ordian
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.
IMHO we should try to clear a column only if opening the db fails with some specific error. Other than that, lgtm.
Co-authored-by: Andronik <[email protected]>
I think this is currently more efficient and gives more control on how the issue is resolved, because we can detect the condition ourselves, and doesn't require to have a loop in which to open and delete on error. If you have a strong opinion about this I would change it. |
It doesn't need to be a loop, just opening at most 2 times (regular open, and in case of this specific error, try clearing a column and open again (w/o a retry), otherwise, propagate the error). My main worry is that generally, we don't want to wipe the parachains db (or part of it) on all nodes, esp once paritydb replaces rocksdb and we do this on more than 1/3 of validators. This could lead to security and/or consensus issues. |
Assuming one column needs clearing, yeah 2 db opens would work, but if we don;t really know the number of cols which need fixing we need to loop and err on each col index and then fix it. If we use the version file bumper, then we would need manually hardcode the migration explicitly like it works for rocks db. |
Signed-off-by: Andrei Sandu <[email protected]>
…itytech/polkadot into sandreim/paritydb_migrate_parachains
Signed-off-by: Andrei Sandu <[email protected]>
|
I've implemented the versioning for ParityDB which was missing and added the column clear code as a parityDB migration from anything in the past to current version. |
ordian
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.
We should test this, but looks reasonable.
Signed-off-by: Andrei Sandu <[email protected]>
Signed-off-by: Andrei Sandu <[email protected]>
…/paritydb_migrate_parachains
|
bot merge |
* master: (37 commits) Backport crate version bumps to 0.9.27 (#5826) Fix GHA (#5825) [ci] Add timeout to benchmark jobs (#5822) Parachains db column "migration" (#5797) Companion for #11831 (#5784) [ci] Return production image (#5818) add migration for staking v10 (#5817) Prepare for rust 1.62.1 (#5811) Bump strum to 0.24.1 (#5816) Bump substrate (#5814) Add missing trigger wildcards for some CI workflows (#5812) malus: add `finality_delay` cli flag (#5770) [ci] publish parachain-implementers-guide (#5806) westend xcm: collectives parachain is trusted teleporter (#5798) Cleanup light client leftovers (#5794) Fix benchmarking tests (#5791) allow re-use and avoid compiling kusama parachain code (#5792) Introduce async runtime calling trait for runtime-api subsystem (#5782) add `Extrinsic Ordering` check that runs against a local reference node (#5790) Co #11456: Expose `benchmark extrinsic` command (#5620) ...
This is a followup of #5594 . This aims to be a "catch" all migration for any column option changes such that no manual fixing for ParityDB is required. Should also work if client is rolled back.