@@ -126,7 +126,7 @@ static InternalKey *pg_tde_create_local_key(const RelFileLocator *newrlocator, u
126
126
static void pg_tde_generate_internal_key (InternalKey * int_key , uint32 entry_type );
127
127
static int pg_tde_file_header_write (const char * tde_filename , int fd , const TDESignedPrincipalKeyInfo * signed_key_info , off_t * bytes_written );
128
128
static void pg_tde_sign_principal_key_info (TDESignedPrincipalKeyInfo * signed_key_info , const TDEPrincipalKey * principal_key );
129
- static off_t pg_tde_write_one_map_entry (int fd , const TDEMapEntry * map_entry , off_t * offset , const char * db_map_path );
129
+ static void pg_tde_write_one_map_entry (int fd , const TDEMapEntry * map_entry , off_t * offset , const char * db_map_path );
130
130
static void pg_tde_write_key_map_entry (const RelFileLocator * rlocator , InternalKey * rel_key_data , TDEPrincipalKey * principal_key , bool write_xlog );
131
131
static int keyrotation_init_file (const TDESignedPrincipalKeyInfo * signed_key_info , char * rotated_filename , const char * filename , off_t * curr_pos );
132
132
static void finalize_key_rotation (const char * path_old , const char * path_new );
@@ -380,7 +380,7 @@ pg_tde_initialize_map_entry(TDEMapEntry *map_entry, const TDEPrincipalKey *princ
380
380
/*
381
381
* Based on the given arguments,write the entry into the key map file.
382
382
*/
383
- static off_t
383
+ static void
384
384
pg_tde_write_one_map_entry (int fd , const TDEMapEntry * map_entry , off_t * offset , const char * db_map_path )
385
385
{
386
386
int bytes_written = 0 ;
@@ -401,7 +401,7 @@ pg_tde_write_one_map_entry(int fd, const TDEMapEntry *map_entry, off_t *offset,
401
401
errmsg ("could not fsync file \"%s\": %m" , db_map_path ));
402
402
}
403
403
404
- return ( * offset + bytes_written ) ;
404
+ * offset += bytes_written ;
405
405
}
406
406
407
407
/*
@@ -633,7 +633,6 @@ pg_tde_perform_rotate_key(TDEPrincipalKey *principal_key, TDEPrincipalKey *new_p
633
633
while (1 )
634
634
{
635
635
InternalKey * rel_key_data ;
636
- off_t new_prev_pos ;
637
636
TDEMapEntry read_map_entry ,
638
637
write_map_entry ;
639
638
RelFileLocator rloc ;
@@ -652,9 +651,7 @@ pg_tde_perform_rotate_key(TDEPrincipalKey *principal_key, TDEPrincipalKey *new_p
652
651
rel_key_data = tde_decrypt_rel_key (principal_key , & read_map_entry );
653
652
pg_tde_initialize_map_entry (& write_map_entry , new_principal_key , & rloc , rel_key_data );
654
653
655
- /* Write the given entry at the location pointed by prev_pos */
656
- new_prev_pos = new_curr_pos ;
657
- new_curr_pos = pg_tde_write_one_map_entry (new_fd , & write_map_entry , & new_prev_pos , new_path );
654
+ pg_tde_write_one_map_entry (new_fd , & write_map_entry , & new_curr_pos , new_path );
658
655
659
656
pfree (rel_key_data );
660
657
}
0 commit comments