Skip to content

Commit

Permalink
Add Xlog init macros for frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
dAdAbird committed Sep 4, 2024
1 parent 051be41 commit 9828734
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/catalog/tde_global_space.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ TDEInitGlobalKeys(const char *dir)
#endif /* !FRONTEND */
{
RelKeyData *ikey;

if (dir != NULL)
pg_tde_set_globalspace_dir(dir);

ikey = pg_tde_get_key_from_file(&GLOBAL_SPACE_RLOCATOR(XLOG_TDE_OID));

/*
Expand Down
1 change: 0 additions & 1 deletion src/include/access/pg_tde_tdemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "access/xlog_internal.h"
#include "catalog/pg_tablespace_d.h"
#include "catalog/tde_principal_key.h"
#include "storage/fd.h"
#include "storage/relfilelocator.h"

typedef struct InternalKey
Expand Down
29 changes: 29 additions & 0 deletions src/include/access/pg_tde_xlog_encrypt_fe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*-------------------------------------------------------------------------
*
* pg_tde_xlog_encrypt_fe.h
* Frontened definitions for encrypted XLog storage manager
*
*-------------------------------------------------------------------------
*/

#ifndef PG_TDE_XLOGENCRYPT_FE_H
#define PG_TDE_XLOGENCRYPT_FE_H

#ifdef PERCONA_FORK
#include "access/pg_tde_xlog_encrypt.h"
#include "catalog/tde_global_space.h"
#include "encryption/enc_aes.h"
#include "keyring/keyring_file.h"
#include "keyring/keyring_vault.h"

/* Frontend has to call it needs to read an encrypted XLog */
#define TDE_XLOG_INIT(kring_dir) \
AesInit(); \
InstallFileKeyring(); \
InstallVaultV2Keyring(); \
TDEInitGlobalKeys(kring_dir); \
TDEXLogSmgrInit()

#endif /* PERCONA_FORK */

#endif /* PG_TDE_XLOGENCRYPT_FE_H */
1 change: 1 addition & 0 deletions src/include/catalog/tde_global_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* We take Oids of the sql operators, so there is no overlap with the "real"
* catalog objects possible.
*/
#define GLOBAL_DATA_TDE_OID InvalidOid
#define XLOG_TDE_OID 608

#define GLOBAL_DATA_TDE_OID InvalidOid
Expand Down
3 changes: 2 additions & 1 deletion src/include/pg_tde_fe.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
#pragma GCC diagnostic ignored "-Wunused-value"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wextra"

/*
* Errors handeling
* Errors handling
* ----------------------------------------
*/

Expand Down

0 comments on commit 9828734

Please sign in to comment.