Percona-Lab / pg_tde

MIT License
107 stars 19 forks source link

Fix internal key XLogging for keyring changes #135

Closed dAdAbird closed 6 months ago

dAdAbird commented 7 months ago

There is no functional relation cache during XLog replay therefore GetMasterKey() would fail looking for the keyring namespace. Actually, it would fail earlier on get_master_key_info_path() as XLog replay has its own MyDatabaseId and MyDatabaseTableSpace. The latter could be fixed by providing RelFileLocator to GetMasterKey() but the former can't be fixed easily (if it could be fixed at all) as XLog replay deals with the Buffer and shouldn't have access to the relations. To solve this, we should pass the master key name in the XLog so there is no need to call GetMasterKey() during XLog redo.

It also doesn't make sense to add an internal key to the cache during XLog replay as this cache is per-process and it won't be available to any user connections.

dAdAbird commented 6 months ago

It was decided to make another PR w/ Xlogging of MasterKey data