Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e04843

Browse files
committed
Comments about GetFreeXLBuffer().
GetFreeXLBuffer(): use Insert->LgwrResult instead of private LgwrResultcopy if it's more fresh (attempt to avoid acquiring info_lck/lgwr_lck).
1 parent3d21bf8 commit7e04843

File tree

1 file changed

+18
-1
lines changed
  • src/backend/access/transam

1 file changed

+18
-1
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.52 2001/02/1308:44:09 vadim Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.53 2001/02/1320:40:25 vadim Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -612,6 +612,7 @@ begin:;
612612
if (updrqst)
613613
{
614614
S_LOCK(&(XLogCtl->info_lck));
615+
LgwrResult=XLogCtl->LgwrResult;
615616
if (XLByteLT(XLogCtl->LgwrRqst.Write,LgwrRqst.Write))
616617
XLogCtl->LgwrRqst.Write=LgwrRqst.Write;
617618
S_UNLOCK(&(XLogCtl->info_lck));
@@ -760,6 +761,10 @@ XLogFlush(XLogRecPtr record)
760761

761762
}
762763

764+
/*
765+
* We use this routine when Insert->curridx block is full and the next XLOG
766+
* buffer looks as unwritten to OS' cache. insert_lck is assumed here.
767+
*/
763768
staticvoid
764769
GetFreeXLBuffer()
765770
{
@@ -768,12 +773,24 @@ GetFreeXLBuffer()
768773
uint16curridx=NextBufIdx(Insert->curridx);
769774
unsignedspins=0;
770775

776+
/* Use Insert->LgwrResult copy if it's more fresh */
777+
if (XLByteLT(LgwrResult.Write,Insert->LgwrResult.Write))
778+
{
779+
LgwrResult=Insert->LgwrResult;
780+
if (XLByteLE(XLogCtl->xlblocks[curridx],LgwrResult.Write))
781+
{
782+
InitXLBuffer(curridx);
783+
return;
784+
}
785+
}
786+
771787
LgwrRqst.Write=XLogCtl->xlblocks[Insert->curridx];
772788
for (;;)
773789
{
774790
if (!TAS(&(XLogCtl->info_lck)))
775791
{
776792
LgwrResult=XLogCtl->LgwrResult;
793+
/* LgwrRqst.Write GE XLogCtl->LgwrRqst.Write */
777794
XLogCtl->LgwrRqst.Write=LgwrRqst.Write;
778795
S_UNLOCK(&(XLogCtl->info_lck));
779796
if (XLByteLE(XLogCtl->xlblocks[curridx],LgwrResult.Write))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp