Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

kvdb-rocksdb: remove buffered operations when committing transaction #7950

Merged
merged 1 commit into from
Feb 20, 2018

Conversation

andresilva
Copy link
Contributor

When committing a transaction any keys associated with the transaction are dropped from the overlay.
The test shows the expected semantics for buffered operations.

@andresilva andresilva added the M4-core ⛓ Core client code / Rust. label Feb 19, 2018
@@ -491,6 +491,9 @@ impl Database {
let batch = WriteBatch::new();
let ops = tr.ops;
for op in ops {
// remove any buffered operation for this key
self.overlay.write()[Self::to_overlay_column(op.col())].remove(op.key());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I should take a read lock first to check if there's any entry, instead of always locking for write.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sure either; is there any reliable way to just benchmark this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe, we always lock for write

@andresilva andresilva added the A0-pleasereview 🤓 Pull request needs code review. label Feb 19, 2018
@5chdn 5chdn added this to the 1.10 milestone Feb 19, 2018
Copy link
Collaborator

@kirushik kirushik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than that possible lock improvement, LGTM.

@@ -491,6 +491,9 @@ impl Database {
let batch = WriteBatch::new();
let ops = tr.ops;
for op in ops {
// remove any buffered operation for this key
self.overlay.write()[Self::to_overlay_column(op.col())].remove(op.key());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sure either; is there any reliable way to just benchmark this?

@debris debris added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Feb 20, 2018
@debris debris merged commit bfdc097 into master Feb 20, 2018
@debris debris deleted the andre-fix-kvdb-buffered-write branch February 20, 2018 16:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants