Skip to content

Commit d711f37

Browse files
committed
Refactor some lower level functions in tde_keyring
Previously write_key_provider_info() was a bit of a "do everything" function that had very different behavior depending on what parameters was passed to it. This commit reworks it to a "dumb" function that just writes the data without asking questions and have the callers take responsibility for data validity. This is to make it easier to validate the data in different ways depending on the caller's needs without further complicating write_key_provider_info(). This commit also renames the KeyringProviderXLRecord to KeyringProviderFileRecord as that structure is used for more things than only WAL now.
1 parent 59243cc commit d711f37

File tree

4 files changed

+216
-140
lines changed

4 files changed

+216
-140
lines changed

contrib/pg_tde/src/access/pg_tde_xlog.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ tdeheap_rmgr_redo(XLogReaderState *record)
7474

7575
else if (info == XLOG_TDE_ADD_KEY_PROVIDER_KEY)
7676
{
77-
KeyringProviderXLRecord *xlrec = (KeyringProviderXLRecord *) XLogRecGetData(record);
77+
KeyringProviderFileRecord *xlrec = (KeyringProviderFileRecord *) XLogRecGetData(record);
7878

7979
redo_key_provider_info(xlrec);
8080
}
@@ -129,7 +129,7 @@ tdeheap_rmgr_desc(StringInfo buf, XLogReaderState *record)
129129
}
130130
if (info == XLOG_TDE_ADD_KEY_PROVIDER_KEY)
131131
{
132-
KeyringProviderXLRecord *xlrec = (KeyringProviderXLRecord *) XLogRecGetData(record);
132+
KeyringProviderFileRecord *xlrec = (KeyringProviderFileRecord *) XLogRecGetData(record);
133133

134134
appendStringInfo(buf, "add key provider %s for %u", xlrec->provider.provider_name, xlrec->database_id);
135135
}

0 commit comments

Comments
 (0)