Skip to content

Commit d8cc666

Browse files
committed
Remove key_type argument which is the same for all callers
All callers call pg_tde_free_key_map_entry() with MAP_ENTRY_VALID so we can move it down to the place where it is used instead of passing it as an argument.
1 parent 36739e0 commit d8cc666

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

contrib/pg_tde/src/access/pg_tde_tdemap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static void pg_tde_generate_internal_key(InternalKey *int_key, uint32 entry_type
128128
static int pg_tde_file_header_write(const char *tde_filename, int fd, TDEPrincipalKeyInfo *principal_key_info, off_t *bytes_written);
129129
static off_t pg_tde_write_one_map_entry(int fd, const TDEMapEntry *map_entry, off_t *offset, const char *db_map_path);
130130
static void pg_tde_write_key_map_entry(const RelFileLocator *rlocator, InternalKey *rel_key_data, TDEPrincipalKey *principal_key, bool write_xlog);
131-
static bool pg_tde_delete_map_entry(const RelFileLocator *rlocator, uint32 key_type, char *db_map_path, off_t offset);
131+
static bool pg_tde_delete_map_entry(const RelFileLocator *rlocator, char *db_map_path, off_t offset);
132132
static int keyrotation_init_file(TDEPrincipalKeyInfo *new_principal_key_info, char *rotated_filename, char *filename, off_t *curr_pos);
133133
static void finalize_key_rotation(const char *path_old, const char *path_new);
134134
static int pg_tde_open_file_write(const char *tde_filename, TDEPrincipalKeyInfo *principal_key_info, bool truncate, off_t *curr_pos);
@@ -514,7 +514,7 @@ pg_tde_write_key_map_entry_redo(const TDEMapEntry *write_map_entry, TDEPrincipal
514514
}
515515

516516
static bool
517-
pg_tde_delete_map_entry(const RelFileLocator *rlocator, uint32 key_type, char *db_map_path, off_t offset)
517+
pg_tde_delete_map_entry(const RelFileLocator *rlocator, char *db_map_path, off_t offset)
518518
{
519519
File map_fd;
520520
bool found = false;
@@ -551,7 +551,7 @@ pg_tde_delete_map_entry(const RelFileLocator *rlocator, uint32 key_type, char *d
551551
TDEMapEntry read_map_entry;
552552
off_t prev_pos = curr_pos;
553553

554-
found = pg_tde_read_one_map_entry(map_fd, rlocator, key_type, &read_map_entry, &curr_pos);
554+
found = pg_tde_read_one_map_entry(map_fd, rlocator, MAP_ENTRY_VALID, &read_map_entry, &curr_pos);
555555

556556
/* We've reached EOF */
557557
if (curr_pos == prev_pos)
@@ -591,7 +591,7 @@ pg_tde_delete_map_entry(const RelFileLocator *rlocator, uint32 key_type, char *d
591591
* as MAP_ENTRY_FREE without needing any further processing.
592592
*/
593593
void
594-
pg_tde_free_key_map_entry(const RelFileLocator *rlocator, uint32 key_type, off_t offset)
594+
pg_tde_free_key_map_entry(const RelFileLocator *rlocator, off_t offset)
595595
{
596596
bool found;
597597
char db_map_path[MAXPGPATH] = {0};
@@ -604,7 +604,7 @@ pg_tde_free_key_map_entry(const RelFileLocator *rlocator, uint32 key_type, off_t
604604
LWLockAcquire(tde_lwlock_enc_keys(), LW_EXCLUSIVE);
605605

606606
/* Remove the map entry if found */
607-
found = pg_tde_delete_map_entry(rlocator, key_type, db_map_path, offset);
607+
found = pg_tde_delete_map_entry(rlocator, db_map_path, offset);
608608

609609
LWLockRelease(tde_lwlock_enc_keys());
610610

contrib/pg_tde/src/access/pg_tde_xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ tdeheap_rmgr_redo(XLogReaderState *record)
9090
{
9191
RelFileLocator *xlrec = (RelFileLocator *) XLogRecGetData(record);
9292

93-
pg_tde_free_key_map_entry(xlrec, MAP_ENTRY_VALID, 0);
93+
pg_tde_free_key_map_entry(xlrec, 0);
9494
}
9595
else
9696
{

contrib/pg_tde/src/include/access/pg_tde_tdemap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ extern void pg_tde_wal_last_key_set_lsn(XLogRecPtr lsn, const char *keyfile_path
9090

9191
extern InternalKey *pg_tde_create_smgr_key(const RelFileLocatorBackend *newrlocator);
9292
extern void pg_tde_create_wal_key(InternalKey *rel_key_data, const RelFileLocator *newrlocator, uint32 flags);
93-
extern void pg_tde_free_key_map_entry(const RelFileLocator *rlocator, uint32 key_type, off_t offset);
93+
extern void pg_tde_free_key_map_entry(const RelFileLocator *rlocator, off_t offset);
9494
extern void pg_tde_write_key_map_entry_redo(const TDEMapEntry *write_map_entry, TDEPrincipalKeyInfo *principal_key_info);
9595

9696
#define PG_TDE_MAP_FILENAME "pg_tde_%d_map"

contrib/pg_tde/src/transam/pg_tde_xact_handler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ do_pending_deletes(bool isCommit)
133133
ereport(LOG,
134134
(errmsg("pg_tde_xact_callback: deleting entry at offset %d",
135135
(int) (pending->map_entry_offset))));
136-
pg_tde_free_key_map_entry(&pending->rlocator, MAP_ENTRY_VALID, pending->map_entry_offset);
136+
pg_tde_free_key_map_entry(&pending->rlocator, pending->map_entry_offset);
137137
}
138138
pfree(pending);
139139
/* prev does not change */

0 commit comments

Comments
 (0)