mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Remove more volatile qualifiers.
Prior to commit0709b7ee72
, access to variables within a spinlock-protected critical section had to be done through a volatile pointer, but that should no longer be necessary. This continues work begun indf4077cda2
and6ba4ecbf47
. Thomas Munro and Michael Paquier
This commit is contained in:
@@ -641,8 +641,7 @@ StartReplication(StartReplicationCmd *cmd)
|
||||
|
||||
/* Initialize shared memory status, too */
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = MyWalSnd;
|
||||
WalSnd *walsnd = MyWalSnd;
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
walsnd->sentPtr = sentPtr;
|
||||
@@ -990,8 +989,7 @@ StartLogicalReplication(StartReplicationCmd *cmd)
|
||||
|
||||
/* Also update the sent position status in shared memory */
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = MyWalSnd;
|
||||
WalSnd *walsnd = MyWalSnd;
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
walsnd->sentPtr = MyReplicationSlot->data.restart_lsn;
|
||||
@@ -1494,9 +1492,7 @@ static void
|
||||
PhysicalConfirmReceivedLocation(XLogRecPtr lsn)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile ReplicationSlot *slot = MyReplicationSlot;
|
||||
ReplicationSlot *slot = MyReplicationSlot;
|
||||
|
||||
Assert(lsn != InvalidXLogRecPtr);
|
||||
SpinLockAcquire(&slot->mutex);
|
||||
@@ -1554,8 +1550,7 @@ ProcessStandbyReplyMessage(void)
|
||||
* standby.
|
||||
*/
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = MyWalSnd;
|
||||
WalSnd *walsnd = MyWalSnd;
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
walsnd->write = writePtr;
|
||||
@@ -1584,7 +1579,7 @@ static void
|
||||
PhysicalReplicationSlotNewXmin(TransactionId feedbackXmin)
|
||||
{
|
||||
bool changed = false;
|
||||
volatile ReplicationSlot *slot = MyReplicationSlot;
|
||||
ReplicationSlot *slot = MyReplicationSlot;
|
||||
|
||||
SpinLockAcquire(&slot->mutex);
|
||||
MyPgXact->xmin = InvalidTransactionId;
|
||||
@@ -1934,8 +1929,7 @@ InitWalSenderSlot(void)
|
||||
*/
|
||||
for (i = 0; i < max_wal_senders; i++)
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
|
||||
@@ -2145,8 +2139,7 @@ retry:
|
||||
*/
|
||||
if (am_cascading_walsender)
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = MyWalSnd;
|
||||
WalSnd *walsnd = MyWalSnd;
|
||||
bool reload;
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
@@ -2384,8 +2377,7 @@ XLogSendPhysical(void)
|
||||
|
||||
/* Update shared memory status */
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = MyWalSnd;
|
||||
WalSnd *walsnd = MyWalSnd;
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
walsnd->sentPtr = sentPtr;
|
||||
@@ -2447,8 +2439,7 @@ XLogSendLogical(void)
|
||||
|
||||
/* Update shared memory status */
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = MyWalSnd;
|
||||
WalSnd *walsnd = MyWalSnd;
|
||||
|
||||
SpinLockAcquire(&walsnd->mutex);
|
||||
walsnd->sentPtr = sentPtr;
|
||||
@@ -2539,8 +2530,7 @@ WalSndRqstFileReload(void)
|
||||
|
||||
for (i = 0; i < max_wal_senders; i++)
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
|
||||
if (walsnd->pid == 0)
|
||||
continue;
|
||||
@@ -2692,8 +2682,7 @@ WalSndWakeup(void)
|
||||
void
|
||||
WalSndSetState(WalSndState state)
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = MyWalSnd;
|
||||
WalSnd *walsnd = MyWalSnd;
|
||||
|
||||
Assert(am_walsender);
|
||||
|
||||
@@ -2777,8 +2766,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
|
||||
|
||||
for (i = 0; i < max_wal_senders; i++)
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
XLogRecPtr sentPtr;
|
||||
XLogRecPtr write;
|
||||
XLogRecPtr flush;
|
||||
@@ -2934,8 +2922,7 @@ GetOldestWALSendPointer(void)
|
||||
|
||||
for (i = 0; i < max_wal_senders; i++)
|
||||
{
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
WalSnd *walsnd = &WalSndCtl->walsnds[i];
|
||||
XLogRecPtr recptr;
|
||||
|
||||
if (walsnd->pid == 0)
|
||||
|
Reference in New Issue
Block a user