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

PS-7887-2: RocksDB encryption #4578

Draft
wants to merge 35 commits into
base: 8.0
Choose a base branch
from

Conversation

kamil-holubicki
Copy link
Contributor

This work is based on top of #4462

  1. Rebased to current 8.0 HEAD
  2. SST files are immutable. Master Key rotation affects only new files
  3. Introduced EncryptionInfoStorage interface with EncryptionInfoPlainFileStorage implementation

NOTE: There is 1 change in rocksdb repository: missing override added. It will be added in upstream in the future, or if not, we can put this class wrapper in myrocks namespace.

White: Parts provided by RocksDB, located in rocksdb namespace
Pink: Parts provided by RocksDB, located in rocksdb namespace that we cannot use (do not meet our requirements)
Blue: Parts provided by Percona, located in myrocks namespace.
RDB-encryption-version2-ClassDiagram

1. Detection of MKs used
2. (Keyring)MasterKeyManager introduced
1. MK generated and stored in KeyringComponent (dirty implementation)
1. MK rotation
1. Moved (almost) everything into MyRocks layer
1. Cleanup (files renamed, classes renamed)
1. Master key manager synchronization
1. clang
1. fix MasterKeyManager synchronization
1. Introduced thread safe AesCtrCipherStreamTS needed by
EncryptedRandomAccessFile::Read() (concurrent read support)
1. Thread safe CipherStream (also for write, probably not needed)
2. Solved double encryption prefix problem (reopenRWFile)
3. MTR suite adjusted
4. KeyringManager deinitialization method added (todo: solve it in better way)
1. MTR fixes
1. Fix new writable file encryption
1. Fix writable file recreation (MTR)
1. adjust MTR tests
2. added tests combinations for encryption
3. removed execution with encryption=1 from suite.opt (moved to
combinations)
1. OPTIONS file encryption
1. Header CRC calculation/validation added
2. CRC moved after key and IV
3. key+IV+CRC are encrypted with master key
1. Cleanup around MK manager
1. MTR fixes
1. fault_env and enc_env deinitialization improved
1. Logging improved
2. Error handling improved
3. Disabled tests not suitable for encryption
(have_rocksdb_encryption_disabled.inc)
4. Fixed file size calculation (allowed size of 0 as we can have
not encrypted files as well)
1. Suppressed too verbose error logging
2. Fixed error log typos
1. Master key rotation prefix read/read synchronized
1. Implemented main/backup encryption prefix to make master key rotation
crash safe
2. MyRocks logger full initialization move before encryption init
rocksdb submodule repo url updated
make rocksdb_encryption variable dynamic
I_S.ROCKSDB_ENCRYPTION table introduced
2. SST files are immutables
3. MK rotation reworked (now affects only new files)
2. Master key rotation recovery
2. Logging + error handling added to
enc_info_plainfile_storage
1. uuid used for MK identification managed by EncryptionUuidProvider.
Backup does not archive uuid, so after restoring new uuid will
be generated and used
2. MK rotation blocked for the 1st phase of backup when files deletions
are disabled. This is to avoid inconsistencies during backup.
As the rotation is only generation of new MK in Keyring and storing this
info in .encryption_info file it simplifies the whole things. Blocking
MK rotation does not block normal MyRocks operations (insert, delete,
etc), but simplifies the flow a lot.
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

Successfully merging this pull request may close these issues.

1 participant