Skip to content
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

fix: snapshot level isolation violations #5279

Merged
merged 3 commits into from
May 13, 2024

Conversation

dpc
Copy link
Contributor

@dpc dpc commented May 13, 2024

Fix #5271
Fix #5195

@dpc dpc requested review from a team as code owners May 13, 2024 20:26
dpc added 3 commits May 13, 2024 13:26
While looking for mistakes in `.snapshot()` use I've noticed that
these two (rarely used) methods did not have some existing fixes
that the main versions do.
@@ -168,7 +168,7 @@ impl IRawDatabase for RocksDbReadOnly {
impl<'a> IDatabaseTransactionOpsCore for RocksDbTransaction<'a> {
async fn raw_insert_bytes(&mut self, key: &[u8], value: &[u8]) -> Result<Option<Vec<u8>>> {
fedimint_core::runtime::block_in_place(|| {
let val = self.0.get(key).unwrap();
let val = self.0.snapshot().get(key).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

For onlookers....this was the bug :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Can probably remove unwrap here if we want too

Copy link
Contributor

@m1sterc001guy m1sterc001guy left a comment

Choose a reason for hiding this comment

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

Boom!

@dpc dpc added this pull request to the merge queue May 13, 2024
Merged via the queue into fedimint:master with commit f081fd4 May 13, 2024
21 checks passed
@dpc dpc deleted the 24-05-13-db-isolation branch May 13, 2024 21:53
@elsirion
Copy link
Contributor

elsirion commented May 14, 2024

Great work! 🎉

Wow, that's some unintuitive API on the rocksdb side! So if you use the snapshot struct for reading then what it actually does is read from the DB transaction, but setting the snapshot in the read options for each read (I was worried that it would only read from the snapshot at first).

@fedimint-backports
Copy link

Successfully created backport PR for releases/v0.3:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: panic: Must deleted existing spendable note mint_client_sanity flake: losing 1msat balance
4 participants