Skip to content

Commit

Permalink
Taking care of review comments
Browse files Browse the repository at this point in the history
Adjusting provider_name length in pg_tde_key_provider catalog
definition and adding a TODO note for implementing an eviction
policy for the master key cache.
  • Loading branch information
codeforall committed Feb 27, 2024
1 parent d49c679 commit ce0ce5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pg_tde--1.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CREATE SCHEMA percona_tde;
-- and we do not want to encrypt this table using pg_tde.
CREATE TABLE percona_tde.pg_tde_key_provider(provider_id SERIAL,
keyring_type VARCHAR(10) CHECK (keyring_type IN ('file', 'vault-v2')),
provider_name VARCHAR(256) UNIQUE NOT NULL, options JSON, PRIMARY KEY(provider_id)) using heap;
provider_name VARCHAR(255) UNIQUE NOT NULL, options JSON, PRIMARY KEY(provider_id)) using heap;

-- If you want to add new provider types, you need to make appropriate changes
-- in include/catalog/tde_keyring.h and src/catalog/tde_keyring.c files.
Expand Down
9 changes: 8 additions & 1 deletion src/catalog/tde_master_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,14 @@ get_master_key_from_cache(bool acquire_lock)
}

/*
* push the master key for current database to the shared memory cache
* Push the master key for current database to the shared memory cache.
* TODO: Add eviction policy
* For now we just keep pushing the master keys to the cache and do not have
* any eviction policy. We have one master key for a database, so at max,
* we could have as many entries in the cache as the number of databases.
* Which in practice would not be a huge number, but still we need to have
* some eviction policy in place. Moreover, we need to have some mechanism to
* remove the cache entry when the database is dropped.
*/
static void
push_master_key_to_cache(TDEMasterKey *masterKey)
Expand Down

0 comments on commit ce0ce5c

Please sign in to comment.