Merge pull request #5711 from citusdata/clean_up_gpid

Prevent any monitoring view/udf to show already exited backends
pull/5715/head
Önder Kalacı 2022-02-15 15:40:05 +01:00 committed by GitHub
commit bf5aa1e223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -513,6 +513,9 @@ CitusCleanupConnectionsAtExit(int code, Datum arg)
* are already given away.
*/
DeallocateReservedConnections();
/* we don't want any monitoring view/udf to show already exited backends */
UnSetGlobalPID();
}

View File

@ -90,7 +90,6 @@ static BackendData *MyBackendData = NULL;
static void BackendManagementShmemInit(void);
static size_t BackendManagementShmemSize(void);
static void UnSetGlobalPID(void);
PG_FUNCTION_INFO_V1(assign_distributed_transaction_id);
@ -674,7 +673,7 @@ UnSetDistributedTransactionId(void)
/*
* UnSetGlobalPID resets the global pid for the current backend.
*/
static void
void
UnSetGlobalPID(void)
{
/* backend does not exist if the extension is not created */

View File

@ -62,6 +62,7 @@ extern void InitializeBackendData(void);
extern void LockBackendSharedMemory(LWLockMode lockMode);
extern void UnlockBackendSharedMemory(void);
extern void UnSetDistributedTransactionId(void);
extern void UnSetGlobalPID(void);
extern void AssignDistributedTransactionId(void);
extern void MarkCitusInitiatedCoordinatorBackend(void);
extern void AssignGlobalPID(void);