ALTER CLUSTER
Function
ALTER CLUSTER is used to rotate fine-grained TDE keys. When a fine-grained TDE cluster is created, ALTER CLUSTER ENCRYPTION KEY ROTATION is automatically invoked to create a key.
DEKs and CEKs are stored in the system catalog PG_TDE. Each time the key is rotated, UPDATE is performed on each row of the system catalog.
This syntax is supported only in clusters of version 9.1.1.200 or later.
Key Cache and Rotation
After the ALTER CLUSTER ENCRYPTION KEY ROTATION statement is executed to rotate the key, the system generates a new DEK. The key generated during each rotation is decrypted from KMS and cached to the local cache upon the first access, reducing the network overhead of subsequent access to KMS.
The TDE cache capacity is specified by the cachesize field in the GUC parameter tde_cache_config (contact technical support to set this parameter). The default value is 100000. When the number of keys in the cache reaches the upper limit, the system evicts old keys based on the least recently used (LRU) policy to make space for new keys.
If the cache capacity is too small to accommodate all historical rotated keys, a cache miss will occur when the evicted key is accessed next time. In this case, the system needs to obtain the key from KMS again, decrypt it, and write it to the cache again. This increases the I/O access latency.
The cache timeout interval is specified by the cachetime field in the GUC parameter tde_cache_config (contact technical support to set this parameter). The default value -1 indicates that the timeout eviction is disabled. When this parameter is set to a positive value, the system periodically deletes the cached keys that have not been accessed for a specified period of time. As a result, the KMS needs to be reconnected during subsequent access.
You are advised to properly plan the key rotation frequency and set cachesize based on the number of keys that need to be cached based on service requirements to ensure that the cache can accommodate all active keys and avoid extra KMS access overheads caused by cache eviction. In addition, you can set cachetime based on the time locality of key access to balance the memory usage and access performance.
Precautions
Only the user who has the database owner permission can execute ALTER CLUSTER.
Syntax
1 | ALTER CLUSTER ENCRYPTION KEY ROTATION; |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot