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

Explicit db.flush() does not work when wal disabled in OptimisticTransactionDB #12906

Open
pragmaxim opened this issue Aug 1, 2024 · 2 comments

Comments

@pragmaxim
Copy link

pragmaxim commented Aug 1, 2024

Expected behavior

db.flush should flush memtables to sst files. I use it in a shutdown hook so that I don't loose data as I am disabling WAL for performance reasons.

Actual behavior

it has no effect

Steps to reproduce the behavior

I posted this issue already rust-rocksdb/rust-rocksdb#900 but then I figured it is probably a rocksdb issue.

@cbi42
Copy link
Member

cbi42 commented Aug 2, 2024

Can you repro it? I tried the following and it works fine.

TEST_P(OptimisticTransactionTest, Flush) {
  WriteOptions write_options;
  write_options.disableWAL = true;
  ASSERT_OK(txn_db->Put(write_options, Slice("foo"), Slice("bar")));
  ASSERT_OK(txn_db->Put(write_options, Slice("foo2"), Slice("bar")));
  ASSERT_OK(txn_db->Flush({}));
  std::vector<LiveFileMetaData> meta;
  txn_db->GetLiveFilesMetaData(&meta);
  ASSERT_EQ(meta.size(), 1);
}

@pragmaxim
Copy link
Author

pragmaxim commented Aug 3, 2024

@cbi42 I could probably repro it only in rust-lang, if you are interested. However it happens when one thread is still heavily committing new transactions while another thread calls db.flush ... I also tried to sleep 10 seconds after the flushing call but that did not help, literally nothing was flushed ...

Repro here : pragmaxim-com/openapi-wasm-client@e5ec1c6

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

No branches or pull requests

2 participants