pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15791: WalSndCtl->sync_standbys_defined modified too late
3+ messages / 3 participants
[nested] [flat]

* BUG #15791: WalSndCtl->sync_standbys_defined modified too late
@ 2019-05-05 08:56 PG Bug reporting form <noreply@postgresql.org>
  2019-05-06 01:16 ` Re: BUG #15791: WalSndCtl->sync_standbys_defined modified too late Euler Taveira <euler@timbira.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2019-05-05 08:56 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: zhq651@126.com

The following bug has been logged on the website:

Bug reference:      15791
Logged by:          DamionZ Zhao
Email address:      zhq651@126.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?



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15791: WalSndCtl->sync_standbys_defined modified too late
  2019-05-05 08:56 BUG #15791: WalSndCtl->sync_standbys_defined modified too late PG Bug reporting form <noreply@postgresql.org>
@ 2019-05-06 01:16 ` Euler Taveira <euler@timbira.com.br>
  2019-05-07 03:37   ` Re: BUG #15791: WalSndCtl->sync_standbys_defined modified too late Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 3+ messages in thread

From: Euler Taveira @ 2019-05-06 01:16 UTC (permalink / raw)
  To: zhq651@126.com; pgsql-bugs@lists.postgresql.org

Em dom, 5 de mai de 2019 às 05:57, PG Bug reporting form
<noreply@postgresql.org> escreveu:
>
> when modify synchronous_standby_names in postgres.conf, and no checkpoint
> happenes, will  synchronous_standby_names  take effect?
>
This is not a bug. This question is suitable for -hackers.

Short answer is: yes. When you modify synchronous_standby_names and
reload postgresql.conf, checkpointer get SIGHUP and it calls
UpdateSharedMemoryConfig() -- see CheckpointerMain() circa 'if
(got_SIGHUP)'.


-- 
   Euler Taveira                                   Timbira -
http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #15791: WalSndCtl->sync_standbys_defined modified too late
  2019-05-05 08:56 BUG #15791: WalSndCtl->sync_standbys_defined modified too late PG Bug reporting form <noreply@postgresql.org>
  2019-05-06 01:16 ` Re: BUG #15791: WalSndCtl->sync_standbys_defined modified too late Euler Taveira <euler@timbira.com.br>
@ 2019-05-07 03:37   ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2019-05-07 03:37 UTC (permalink / raw)
  To: Euler Taveira <euler@timbira.com.br>; +Cc: zhq651@126.com; pgsql-bugs@lists.postgresql.org

On Sun, May 05, 2019 at 10:16:39PM -0300, Euler Taveira wrote:
> This is not a bug. This question is suitable for -hackers.
> 
> Short answer is: yes. When you modify synchronous_standby_names and
> reload postgresql.conf, checkpointer get SIGHUP and it calls
> UpdateSharedMemoryConfig() -- see CheckpointerMain() circa 'if
> (got_SIGHUP)'.

There could be always some delay between the moments SIGHUP gets
processed across the different processes as we are talking mainly
about running ProcessConfigFile(OGC_SIGHUP) which can happen for
normal backends once every query, but the change will be effective.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-05-07 03:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-05-05 08:56 BUG #15791: WalSndCtl->sync_standbys_defined modified too late PG Bug reporting form <noreply@postgresql.org>
2019-05-06 01:16 ` Euler Taveira <euler@timbira.com.br>
2019-05-07 03:37   ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox