s/ApplyMetada/ApplyMetadata/ is not a big deal, but might as well spell it right.
The two identical ApplyMetaDaEffect entries were a little trickier to pick apart
in the logs, when otherwise grouping CommitDebug entries by ID.
* Add cleanIdempotencyIds
Delete zero or more idempotency ids older than minAgeSeconds
* Automatically clean idempotency ids from first proxy
* Add test for cleaner
* Fix formatting
* Address review comments
* [EAR]: Remove usage of EncryptDomainName for Encryption at-rest operations
Description
diff-1: Address review comments
EncryptDomainName is an auxillary information, given EAR encryption domain
matches with Tenants, EncryptDomainName maps to TenantName in the current
code. However, this mapping adds EAR depedency has multiple drawbacks:
1. In some scenarios obtaning consistent mapping of TenantId <-> TenantName
is difficult to maintain. For instance: StorageServer (SS) TLog mutation
pop loop, it is possible that same commit batch contains: TenantMap update
mutation as well as a Tenant user mutation. SS would parse TenantMap update
mutation (FDB System Keyspace encryption domain), process the mutation, but,
doesn't apply it to the process local TenantMap. SS then attempts to process,
Tenant user mutation and fails to decrypt the mutation given TenantMetadaMap
isn't updated yet.
2. FDB codebase uses EncryptDomainId matching TenantId, TenantName is used as
an auxillary information source and feels better to be handled by an
external KMS.
Major changes include:
1. EAR to remove TenantName dependency across all participating processes
such as: CommitProxy, Redwood, BlobGranule and Backup agent.
2. Update EKP and KmsConnector APIs to avoid relying on "domainName"
information being passed around to external KMS EAR endpoints.
Testing
devRunCorrectness - 100K
EncryptKeyProxyTest - 100K
EncryptionOps Test - 100K
* Refactor CP::WriteMutation to optimize ACTOR alloc/dealloc
Description
WriteMutation routine is responsible for appending mutations to be persisted
in TLog, the operation isn't a 'blocking' operation, except for few cases
when Encryption is supported by the cluster such
as:
1. Fetch encryption keys to encrypt the mutation.
2. Split ClearRange mutation to respect Encryption domain boundaries.
3. Ensure sanity of already encrypted mutation - simulation limited check.
Patch optimizes the "fast" path by avoiding alloc/dealloc overhead
due to be ACTOR framework support, the penalty happens iff any of above
conditions are met.
Testing
devRunCorrectness - 100K
* Fix a potential memory error
The returned KeyRef should live at least as long as the supplied arena
* Improve keyAfter and singleKeyRange
Avoid duplicating the keyAfter implementation, and share memory between
begin and end for singleKeyRange returning a standalone
* Avoid creating and destroying an arena in a loop
This defeats some of the purposes of Arena's, namely to amortize the
cost of calling malloc and free and to improve cache locality.
* Improve Arena usage
Avoid an arena allocation in keyAfter - instead return a string with
static lifetime. I made sure to return the same memory as was just
brought into cache to inspect whether key == \xff\xff.
Also avoid creating and destroying an arena in a loop for encrypting
idempotency id sets.
* Proactively clean up idempotency ids for successful commits
This change also includes some minor changes from my branch working on
an idempotency ids cleaner, that I'd like to get merged sooner rather
than later.
- Adding a timestamp to idempotency values
- Making IdempotencyId an actor file
- Adding commit_unknown_result_fatal
- Checking idempotencyIdsExpiredVersion in determineCommitStatus
- Some testing QOL changes
* Factor out decodeIdempotencyKey logic
* Fix formatting
* Update flow/include/flow/error_definitions.h
Co-authored-by: A.J. Beamon <aj.beamon@snowflake.com>
* Use KeyBackedObjectProperty for idempotencyIdsExpiredVersion
* Add IDEMPOTENCY_ID_IN_MEMORY_LIFETIME knob
* Rename ExpireIdempotencyKeyValuePairRequest
Also add a code probe for the case where an ExpireIdempotencyIdRequest is
received before the count is known, and add an assert
* Fix formatting and add TODO for nwijetunga
Co-authored-by: A.J. Beamon <aj.beamon@snowflake.com>