diff --git a/src/catalog/tde_principal_key.c b/src/catalog/tde_principal_key.c index 111955df..3be9eb08 100644 --- a/src/catalog/tde_principal_key.c +++ b/src/catalog/tde_principal_key.c @@ -26,6 +26,7 @@ #include "utils/builtins.h" #include "pg_tde.h" #include "access/pg_tde_xlog.h" +#include #include #include "access/pg_tde_tdemap.h" @@ -662,6 +663,10 @@ push_principal_key_to_cache(TDEPrincipalKey *principalKey) if (!found) memcpy(cacheEntry, principalKey, sizeof(TDEPrincipalKey)); dshash_release_lock(get_principal_key_Hash(), cacheEntry); + + /* we don't want principal keys to end up paged to the swap */ + if (mlock(cacheEntry, sizeof(TDEPrincipalKey)) == -1) + elog(ERROR, "could not mlock principal key cache entry: %m"); } /*