stevenwarejones commented on code in PR #3785:
URL: https://github.com/apache/parquet-java/pull/3785#discussion_r4006694341


##########
parquet-hadoop/src/main/java/org/apache/parquet/crypto/keytools/KeyToolkit.java:
##########
@@ -143,6 +160,80 @@ private TwoLevelCacheWithExpiration<byte[]> getCache() {
     }
   }
 
+  static final class KmsClientCacheContext {
+    private final KmsClientFactory factory;
+    private final TwoLevelCacheWithExpiration<KmsClient> kmsClientCache;
+    private final TwoLevelCacheWithExpiration<KeyEncryptionKey> 
defaultKekWriteCache;
+    private final TwoLevelCacheWithExpiration<ConcurrentMap<String, 
KeyEncryptionKey>> factoryKekWriteCache;

Review Comment:
   The write-side cache is keyed by master-key ID, and the same ID can refer to 
different keys in different KMS instances. Without the KMS instance in the 
cache key, one factory-created client could reuse a KEK wrapped by another.
   
   The read-side cache is keyed by the randomly generated 128-bit KEK ID stored 
in the key material, which identifies the specific KEK. It is also already 
isolated by factory registration, so I left its existing structure unchanged.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to