Skip to content

Commit

Permalink
PG-951: Fixing an issue where we created two keys instead of one in c…
Browse files Browse the repository at this point in the history
…ertain

situations
  • Loading branch information
dutow committed Aug 5, 2024
1 parent 08fe848 commit 69c12a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/smgr/pg_tde_smgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ tde_smgr_get_key(SMgrRelation reln)

TdeCreateEvent* event = GetCurrentTdeCreateEvent();

// see if we have a key for the relation, and return if yes
RelKeyData* rkd = GetRelationKey(reln->smgr_rlocator.locator);

if(rkd != NULL)
{
recursion--;
return rkd;
}

// if this is a CREATE TABLE, we have to generate the key
if(event->encryptMode == true && event->eventType == TDE_TABLE_CREATE_EVENT)
{
Expand All @@ -58,12 +67,9 @@ tde_smgr_get_key(SMgrRelation reln)
return pg_tde_create_key_map_entry(&reln->smgr_rlocator.locator);
}

// otherwise, see if we have a key for the relation, and return if yes
RelKeyData* rkd = GetRelationKey(reln->smgr_rlocator.locator);

recursion--;

return rkd;
return NULL;
}

void
Expand Down

0 comments on commit 69c12a3

Please sign in to comment.