-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
libroach: avoid recycling encrypted WALs #38868
Conversation
Hm, seems this violates the goal of not reusing keys. I should've read the docs earlier. |
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.
Hm, seems this violates the goal of not reusing keys. I should've read the docs earlier.
I was thinking this weekend that perhaps we should just disable WAL reuse if encryption is enabled. There is a performance hit to doing that, though.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @mberhault and @petermattis)
Thought through it again. I don't really like how RocksDB overwrites our |
Also I did look into writing a zero entry using the new encryption key as we discussed. It worked if the whole WAL were zeroed, but not if there were a portion zeroed followed by some unzeroed bytes. Works:
Doesn't work:
|
That sounds like a good path forward to me. I think you should apply a short-term bandaid here, and disable WAL recycling when encryption is enabled. |
be055f1
to
0ac87c1
Compare
OK, I updated this PR to do that. |
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.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @ajkr and @mberhault)
c-deps/libroach/ccl/encrypted_env_test.cc, line 293 at r1 (raw file):
{ std::unique_ptr<rocksdb::WritableFile> res; if (i == static_cast<int>(ReuseWritableFileInjectionEnv::Mode::kNone)) {
I think you can use mode
instead of i
here, to avoid the cast on the right hand side of the expression.
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.
TFTR.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @mberhault and @petermattis)
c-deps/libroach/ccl/encrypted_env_test.cc, line 293 at r1 (raw file):
Previously, petermattis (Peter Mattis) wrote…
I think you can use
mode
instead ofi
here, to avoid the cast on the right hand side of the expression.
Oh right, done.
RocksDB fails recovery if there are any non-empty WALs that have zero readable entries. So we need to make sure `EncryptedEnv::ReuseWritableFile()` cannot produce such files, even if an inopportune crash happens. We do not know how to achieve this while still changing the encryption key for the recycled WAL, so for now this PR works around the problem in `EncryptedEnv::ReuseWritableFile()` by faking recycling. Release note: None
0695ce8
to
57619ba
Compare
bors r+ |
38868: libroach: avoid recycling encrypted WALs r=ajkr a=ajkr RocksDB fails recovery if there are any non-empty WALs that have zero readable entries. So we need to make sure `EncryptedEnv::ReuseWritableFile()` cannot produce such files, even if an inopportune crash happens. We do not know how to achieve this while still changing the encryption key for the recycled WAL, so for now this PR works around the problem in `EncryptedEnv::ReuseWritableFile()` by faking recycling. Release note: None Co-authored-by: Andrew Kryczka <andrew.kryczka2@gmail.com>
Build succeeded |
RocksDB fails recovery if there are any non-empty WALs that have zero
readable entries. So we need to make sure
EncryptedEnv::ReuseWritableFile()
cannot produce such files, even ifan inopportune crash happens. We do not know how to achieve this while
still changing the encryption key for the recycled WAL, so for now this
PR works around the problem in
EncryptedEnv::ReuseWritableFile()
byfaking recycling.
Release note: None