BUG #15791: WalSndCtl->sync_standbys_defined modified too late

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zhq651(at)126(dot)com
Subject: BUG #15791: WalSndCtl->sync_standbys_defined modified too late
Date: 2019-05-05 08:56:08
Message-ID: 15791-eac704d9ebfbdfea@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15791
Logged by: DamionZ Zhao
Email address: zhq651(at)126(dot)com
PostgreSQL version: 11.2
Operating system: linux
Description:

1.when commit transaction, we need to kwow it is sync or async . There is a
step : call function SyncRepWaitForLSN in function
RecordTransactionCommit.

void SyncRepWaitForLSN(XLogRecPtr lsn, bool commit)
{
....
if (!WalSndCtl->sync_standbys_defined ||
lsn <= WalSndCtl->lsn[mode] )
{
...
return;
}
}

2.when modify WalSndCtl->sync_standbys_defined?

2.1 in function SyncRepUpdateSyncStandbysDefined,
WalSndCtl->sync_standbys_defined will be modified.
----------------------------------------------------
void SyncRepUpdateSyncStandbysDefined(void)
{
bool sync_standbys_defined = SyncStandbysDefined();

if (sync_standbys_defined != WalSndCtl->sync_standbys_defined)
{

WalSndCtl->sync_standbys_defined = sync_standbys_defined;
LWLockRelease(SyncRepLock);
}
}

2.2 SyncRepUpdateSyncStandbysDefined call stack is:
------------------------------------------
(1)CheckpointerMain(start checkpoint)-
UpdateSharedMemoryConfig
SyncRepUpdateSyncStandbysDefined
(2)CheckPointGuts -- Flush all data in shared memory to disk, and fsync
CheckPointBuffers --Flush all dirty blocks in buffer pool to disk at
checkpoint time.
BufferSync -- Write out all dirty buffers in the pool.
CheckpointWriteDelay
UpdateSharedMemoryConfig
SyncRepUpdateSyncStandbysDefined

2.3 when any checkpoint situation happened, WalSndCtl->sync_standbys_defined
will be modified.

3.my question:
----------------

when modify synchronous_standby_names in postgres.conf, and no checkpoint
happenes, will synchronous_standby_names take effect?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-05-05 09:31:12 Re: identity not working with inherited table
Previous Message Michael Paquier 2019-05-04 12:32:21 Re: BUG #15788: 'pg_dump --create' orders database GRANTs incorrectly