...
To support multiple keys for reading encrypted data it is required to store a key identifier on each encrypted page and on each encrypted WAL record (see more details). The key identifier is a sequential counter and should be the same on all nodes.
- Start distributed process CACHE_GROUP_KEY_CHANGE_PREPARE, each node
- verifies that re-encryption is not in progress for the specified cache group.
- ensures that new key identifier does not exist
- After successful completion of PREPARE, start distributed process CACHE_GROUP_KEY_CHANGE_FINISH, each node
- saves logical WAL record (ENCRYPTION_STATUS_RECORD) with current groups and key identifiers to start re-encryption on logical recovery.
- save the new key in metastore (as inactive key)
- adds new key and sets it for writing
- adds the mapping "WAL segment -> *old* key identifier" (to safely cleanup previous key in the future)
- saves logical WAL record (ENCRYPTION_STATUS_RECORD) with current page count in partitions.
- stores current page count as total pages for background re-encryption on partitions.
- starts background re-encryption of an existing data.
...