Skip to content

Commit

Permalink
PG-1095 More manual code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgavrilov committed Oct 29, 2024
1 parent ef6258b commit c62d0ec
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/access/pg_tde_ddl.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static void
tdeheap_object_access_hook(ObjectAccessType access, Oid classId, Oid objectId,
int subId, void *arg)
{
Relation rel = NULL;
Relation rel = NULL;

if (prev_object_access_hook)
prev_object_access_hook(access, classId, objectId, subId, arg);
Expand Down
18 changes: 9 additions & 9 deletions src/access/pg_tde_slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,16 @@ static pg_attribute_always_inline void
tdeheap_slot_deform_heap_tuple(TupleTableSlot *slot, HeapTuple tuple, uint32 *offp,
int natts)
{
TupleDesc tupleDesc = slot->tts_tupleDescriptor;
Datum *values = slot->tts_values;
bool *isnull = slot->tts_isnull;
TupleDesc tupleDesc = slot->tts_tupleDescriptor;
Datum *values = slot->tts_values;
bool *isnull = slot->tts_isnull;
HeapTupleHeader tup = tuple->t_data;
bool hasnulls = HeapTupleHasNulls(tuple);
int attnum;
char *tp; /* ptr to tuple data */
uint32 off; /* offset in tuple data */
bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
bool slow; /* can we use/set attcacheoff? */
bool hasnulls = HeapTupleHasNulls(tuple);
int attnum;
char *tp; /* ptr to tuple data */
uint32 off; /* offset in tuple data */
bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
bool slow; /* can we use/set attcacheoff? */

/* We can only fetch as many attributes as the tuple has. */
natts = Min(HeapTupleHeaderGetNatts(tuple->t_data), natts);
Expand Down
29 changes: 14 additions & 15 deletions src/access/pg_tde_tdemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,29 +66,29 @@

typedef struct TDEFileHeader
{
int32 file_version;
int32 file_version;
TDEPrincipalKeyInfo principal_key_info;
} TDEFileHeader;

typedef struct TDEMapEntry
{
RelFileNumber relNumber;
uint32 flags;
int32 key_index;
uint32 flags;
int32 key_index;
} TDEMapEntry;

typedef struct TDEMapFilePath
{
char map_path[MAXPGPATH];
char keydata_path[MAXPGPATH];
char map_path[MAXPGPATH];
char keydata_path[MAXPGPATH];
} TDEMapFilePath;


typedef struct RelKeyCacheRec
{
RelFileNumber rel_number;
uint32 key_type;
RelKeyData key;
uint32 key_type;
RelKeyData key;
} RelKeyCacheRec;

/*
Expand All @@ -106,10 +106,9 @@ typedef struct RelKeyCacheRec
*/
typedef struct RelKeyCache
{
RelKeyCacheRec *data; /* must be a multiple of a memory page
* (usually 4Kb) */
int len; /* num of RelKeyCacheRecs currenty in cache */
int cap; /* max amount of RelKeyCacheRec data can fit */
RelKeyCacheRec *data; /* must be a multiple of a memory page (usually 4Kb) */
int len; /* num of RelKeyCacheRecs currenty in cache */
int cap; /* max amount of RelKeyCacheRec data can fit */
} RelKeyCache;

RelKeyCache *tde_rel_key_cache = NULL;
Expand Down Expand Up @@ -248,7 +247,7 @@ RelKeyData *
tde_encrypt_rel_key(TDEPrincipalKey *principal_key, RelKeyData *rel_key_data, const RelFileLocator *rlocator)
{
RelKeyData *enc_rel_key_data;
size_t enc_key_bytes;
size_t enc_key_bytes;

AesEncryptKey(principal_key, rlocator, rel_key_data, &enc_rel_key_data, &enc_key_bytes);

Expand Down Expand Up @@ -1088,10 +1087,10 @@ tde_decrypt_rel_key(TDEPrincipalKey *principal_key, RelKeyData *enc_rel_key_data
static int
pg_tde_open_file(char *tde_filename, TDEPrincipalKeyInfo *principal_key_info, bool should_fill_info, int fileFlags, bool *is_new_file, off_t *curr_pos)
{
int fd = -1;
int fd = -1;
TDEFileHeader fheader;
off_t bytes_read = 0;
off_t bytes_written = 0;
off_t bytes_read = 0;
off_t bytes_written = 0;

/*
* Ensuring that we always open the file in binary mode. The caller must
Expand Down
4 changes: 2 additions & 2 deletions src/access/pg_tde_xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
void
tdeheap_rmgr_redo(XLogReaderState *record)
{
uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;

if (info == XLOG_TDE_ADD_RELATION_KEY)
{
Expand Down Expand Up @@ -82,7 +82,7 @@ tdeheap_rmgr_redo(XLogReaderState *record)
void
tdeheap_rmgr_desc(StringInfo buf, XLogReaderState *record)
{
uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;

if (info == XLOG_TDE_ADD_RELATION_KEY)
{
Expand Down
10 changes: 5 additions & 5 deletions src/catalog/tde_global_space.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ static void init_default_keyring(void);
static TDEPrincipalKey *create_principal_key(const char *key_name,
GenericKeyring *keyring, Oid dbOid,
Oid spcOid);
#endif /* !FRONTEND */
#endif /* !FRONTEND */


void
TDEInitGlobalKeys(const char *dir)
{
#ifndef FRONTEND
char db_map_path[MAXPGPATH] = {0};
char db_map_path[MAXPGPATH] = {0};

pg_tde_set_db_file_paths(GLOBAL_DATA_TDE_OID, GLOBALTABLESPACE_OID, db_map_path, NULL);
if (access(db_map_path, F_OK) == -1)
Expand Down Expand Up @@ -177,7 +177,7 @@ create_principal_key(const char *key_name, GenericKeyring *keyring,
Oid dbOid, Oid spcOid)
{
TDEPrincipalKey *principalKey;
keyInfo *keyInfo = NULL;
keyInfo *keyInfo = NULL;

principalKey = palloc(sizeof(TDEPrincipalKey));
principalKey->keyInfo.databaseId = dbOid;
Expand All @@ -203,6 +203,6 @@ create_principal_key(const char *key_name, GenericKeyring *keyring,

return principalKey;
}
#endif /* FRONTEND */
#endif /* FRONTEND */

#endif /* PERCONA_EXT */
#endif /* PERCONA_EXT */
4 changes: 2 additions & 2 deletions src/catalog/tde_keyring.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ load_vaultV2_keyring_provider_options(char *keyring_options)
static void
debug_print_kerying(GenericKeyring *keyring)
{
int debug_level = DEBUG2;
int debug_level = DEBUG2;

elog(debug_level, "Keyring type: %d", keyring->type);
elog(debug_level, "Keyring name: %s", keyring->provider_name);
Expand All @@ -648,7 +648,7 @@ debug_print_kerying(GenericKeyring *keyring)
static char *
get_keyring_infofile_path(char *resPath, Oid dbOid, Oid spcOid)
{
char *db_path = pg_tde_get_tde_file_dir(dbOid, spcOid);
char *db_path = pg_tde_get_tde_file_dir(dbOid, spcOid);

Assert(db_path != NULL);
join_path_components(resPath, db_path, PG_TDE_KEYRING_FILENAME);
Expand Down
8 changes: 4 additions & 4 deletions src/catalog/tde_keyring_parse_opts.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef enum JsonKeringSemState
{
JK_EXPECT_TOP_FIELD,
JK_EXPECT_EXTERN_VAL,
} JsonKeringSemState;
} JsonKeringSemState;

#define KEYRING_REMOTE_FIELD_TYPE "remote"
#define KEYRING_FILE_FIELD_TYPE "file"
Expand All @@ -71,7 +71,7 @@ typedef enum JsonKeyringField

/* must be the last */
JK_FIELDS_TOTAL
} JsonKeyringField;
} JsonKeyringField;

static const char *JK_FIELD_NAMES[JK_FIELDS_TOTAL] = {
[JK_FIELD_UNKNOWN] = "unknownField",
Expand Down Expand Up @@ -444,8 +444,8 @@ get_remote_kring_value(const char *url, const char *field_name)
static char *
get_file_kring_value(const char *path, const char *field_name)
{
int fd = -1;
char *val;
int fd = -1;
char *val;

fd = BasicOpenFile(path, O_RDONLY);
if (fd < 0)
Expand Down
2 changes: 1 addition & 1 deletion src/common/pg_tde_shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ TdeShmemInit(void)
static void
tde_shmem_shutdown(int code, Datum arg)
{
ListCell *lc;
ListCell *lc;

foreach(lc, registeredShmemRequests)
{
Expand Down

0 comments on commit c62d0ec

Please sign in to comment.