@ -97,6 +97,7 @@ ReplicationSlot *MyReplicationSlot = NULL;
int max_replication_slots = 0 ; /* the maximum number of replication
* slots */
static LWLockTranche ReplSlotIOLWLockTranche ;
static void ReplicationSlotDropAcquired ( void ) ;
/* internal persistency functions */
@ -137,6 +138,13 @@ ReplicationSlotsShmemInit(void)
ShmemInitStruct ( " ReplicationSlot Ctl " , ReplicationSlotsShmemSize ( ) ,
& found ) ;
ReplSlotIOLWLockTranche . name = " Replication Slot IO Locks " ;
ReplSlotIOLWLockTranche . array_base =
( ( char * ) ReplicationSlotCtl ) + offsetof ( ReplicationSlotCtlData , replication_slots ) + offsetof ( ReplicationSlot , io_in_progress_lock ) ;
ReplSlotIOLWLockTranche . array_stride = sizeof ( ReplicationSlot ) ;
LWLockRegisterTranche ( LWTRANCHE_REPLICATION_SLOT_IO_IN_PROGRESS ,
& ReplSlotIOLWLockTranche ) ;
if ( ! found )
{
int i ;
@ -150,7 +158,7 @@ ReplicationSlotsShmemInit(void)
/* everything else is zeroed by the memset above */
SpinLockInit ( & slot - > mutex ) ;
slot - > io_in_progress_lock = LWLockAssign ( ) ;
LWLockInitialize ( & slot - > io_in_progress_lock , LWTRANCHE_REPLICATION_SLOT_IO_IN_PROGRESS ) ;
}
}
}
@ -1008,7 +1016,7 @@ SaveSlotToPath(ReplicationSlot *slot, const char *dir, int elevel)
if ( ! was_dirty )
return ;
LWLockAcquire ( slot - > io_in_progress_lock , LW_EXCLUSIVE ) ;
LWLockAcquire ( & slot - > io_in_progress_lock , LW_EXCLUSIVE ) ;
/* silence valgrind :( */
memset ( & cp , 0 , sizeof ( ReplicationSlotOnDisk ) ) ;
@ -1101,7 +1109,7 @@ SaveSlotToPath(ReplicationSlot *slot, const char *dir, int elevel)
slot - > dirty = false ;
SpinLockRelease ( & slot - > mutex ) ;
LWLockRelease ( slot - > io_in_progress_lock ) ;
LWLockRelease ( & slot - > io_in_progress_lock ) ;
}
/*