-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Parity-db Change
missing implementation.
#11049
Conversation
client/db/src/parity_db.rs
Outdated
Change::Reference(col, key) => | ||
if ref_counted_column(col) { | ||
// FIXME accessing value is not strictly needed, optimize this in parity-db. | ||
let value = <Self as Database<H>>::get(self, col, key.as_ref()); |
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.
commit
in parity_db could use a more clear change API indeed. I think multiple references/releases of the same key in a single commit are not supported at the moment. It should work fine actually.
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.
yes, I also realize this morning that we always read the same counter value.
I did not fix it, as for storage chain it is not an issue and I do not know of other usage of these Change variants.
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
I totally lost track of this PR, still needed. |
client/db/src/parity_db.rs
Outdated
if ref_counted_column(col) { | ||
(col as u8, key.as_ref().to_vec(), Some(value)) | ||
} else { | ||
panic!("Change::Store is only used for ref counted columns") |
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.
If that is the case, why do we still need the if around it?
client/db/src/parity_db.rs
Outdated
if ref_counted_column(col) { | ||
(col as u8, key.as_ref().to_vec(), Some(value)) | ||
} else { | ||
panic!("Change::Store is only used for ref counted columns") |
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.
panic!("Change::Store is only used for ref counted columns") | |
unreachable!("Change::Store is only used for ref counted columns") |
client/db/src/parity_db.rs
Outdated
if ref_counted_column(col) { | ||
(col as u8, key.as_ref().to_vec(), None) | ||
} else { | ||
panic!("Change::Release is only used for ref counted columns") |
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.
panic!("Change::Release is only used for ref counted columns") | |
unreachable!("Change::Release is only used for ref counted columns") |
client/db/src/parity_db.rs
Outdated
let value = <Self as Database<H>>::get(self, col, key.as_ref()); | ||
(col as u8, key.as_ref().to_vec(), value) | ||
} else { | ||
panic!("Change::Reference is only used for ref counted columns") |
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.
panic!("Change::Reference is only used for ref counted columns") | |
unreachable!("Change::Reference is only used for ref counted columns") |
bot merge |
Waiting for commit status. |
Merge cancelled due to error. Error: Statuses failed for 63f2770 |
bot merge |
Error: Statuses failed for 63f2770 |
* support for release as in kvdb (only if no rc). * Start impl * minimal implementation for paritydb rc * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Commit not panicking in DbAdapter * errors from string * update parity db version Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
* support for release as in kvdb (only if no rc). * Start impl * minimal implementation for paritydb rc * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Commit not panicking in DbAdapter * errors from string * update parity db version Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
* support for release as in kvdb (only if no rc). * Start impl * minimal implementation for paritydb rc * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Update client/db/src/parity_db.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * Commit not panicking in DbAdapter * errors from string * update parity db version Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
This pr is a minimal implementation of Change::Store, Change::Reference, Change::Release, in order for parity db to support storage chain (those operator are only in this case).
The implementation is really not optimal: when using reference, we should not fetch the value, a parity-db specific instruction should be use (only need to update the internal storage rc), with current
commit
api adding a new instruction requires a bit of rework so having this quick PR first make sense to me.In case column do not use rc, I choose to not use the default implementation from kvdb as it indicates that something should be change.
Polkadot companion: paritytech/polkadot#5472