Fix bugs in EncyrptKeyProxy actor (#7388)
Description Major changes include: 1. GetEncryptByKeyIds cache elements can expire. 2. Update iterator after erasing an element during refresh encryption keys operation. Testing EncryptKeyProxyTest
This commit is contained in:
parent
7da26db342
commit
8808d93813
|
@ -342,8 +342,7 @@ ACTOR Future<Void> getCipherKeysByBaseCipherKeyIds(Reference<EncryptKeyProxyData
|
|||
const EncryptBaseCipherDomainIdKeyIdCacheKey cacheKey =
|
||||
ekpProxyData->getBaseCipherDomainIdKeyIdCacheKey(item.domainId, item.baseCipherId);
|
||||
const auto itr = ekpProxyData->baseCipherDomainIdKeyIdCache.find(cacheKey);
|
||||
if (itr != ekpProxyData->baseCipherDomainIdKeyIdCache.end()) {
|
||||
ASSERT(itr->second.isValid());
|
||||
if (itr != ekpProxyData->baseCipherDomainIdKeyIdCache.end() && itr->second.isValid()) {
|
||||
cachedCipherDetails.emplace_back(
|
||||
itr->second.domainId, itr->second.baseCipherId, itr->second.baseCipherKey, keyIdsReply.arena);
|
||||
|
||||
|
@ -598,7 +597,7 @@ ACTOR Future<Void> refreshEncryptionKeysCore(Reference<EncryptKeyProxyData> ekpP
|
|||
|
||||
// Garbage collect expired cached CipherKeys
|
||||
if (itr->second.isExpired()) {
|
||||
ekpProxyData->baseCipherDomainIdCache.erase(itr);
|
||||
itr = ekpProxyData->baseCipherDomainIdCache.erase(itr);
|
||||
} else {
|
||||
itr++;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ void FlowKnobs::initialize(Randomize randomize, IsSimulated isSimulated) {
|
|||
init( ENCRYPT_CIPHER_KEY_CACHE_TTL, isSimulated ? 120 : 10 * 60 );
|
||||
if ( randomize && BUGGIFY) { ENCRYPT_CIPHER_KEY_CACHE_TTL = deterministicRandom()->randomInt(50, 100); }
|
||||
init( ENCRYPT_KEY_REFRESH_INTERVAL, isSimulated ? 60 : 8 * 60 );
|
||||
if ( randomize && BUGGIFY) { ENCRYPT_KEY_REFRESH_INTERVAL = deterministicRandom()->randomInt(20, 40); }
|
||||
if ( randomize && BUGGIFY) { ENCRYPT_KEY_REFRESH_INTERVAL = deterministicRandom()->randomInt(2, 10); }
|
||||
|
||||
// REST Client
|
||||
init( RESTCLIENT_MAX_CONNECTIONPOOL_SIZE, 10 );
|
||||
|
|
Loading…
Reference in New Issue