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

Commit7951d67

Browse files
committed
Merge branch 'REL9_5_STABLE' into PGPRO9_5
2 parents28ed493 +47e5969 commit7951d67

File tree

11 files changed

+196
-187
lines changed

11 files changed

+196
-187
lines changed

‎doc/src/sgml/release-9.5.sgml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ Add GUC and storage parameter to set the maximum size of GIN pending list.
22712271
-->
22722272
<para>
22732273
Add per-table autovacuum logging control via new
2274-
<varname>log_min_autovacuum_duration</> storage parameter
2274+
<varname>log_autovacuum_min_duration</> storage parameter
22752275
(Michael Paquier)
22762276
</para>
22772277
</listitem>

‎src/backend/commands/vacuum.c‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ vac_truncate_clog(TransactionId frozenXID,
10501050
TransactionIdlastSaneFrozenXid,
10511051
MultiXactIdlastSaneMinMulti)
10521052
{
1053-
TransactionIdmyXID=GetCurrentTransactionId();
1053+
TransactionIdnextXID=ReadNewTransactionId();
10541054
Relationrelation;
10551055
HeapScanDescscan;
10561056
HeapTupletuple;
@@ -1066,6 +1066,12 @@ vac_truncate_clog(TransactionId frozenXID,
10661066
/*
10671067
* Scan pg_database to compute the minimum datfrozenxid/datminmxid
10681068
*
1069+
* Since vac_update_datfrozenxid updates datfrozenxid/datminmxid in-place,
1070+
* the values could change while we look at them. Fetch each one just
1071+
* once to ensure sane behavior of the comparison logic. (Here, as in
1072+
* many other places, we assume that fetching or updating an XID in shared
1073+
* storage is atomic.)
1074+
*
10691075
* Note: we need not worry about a race condition with new entries being
10701076
* inserted by CREATE DATABASE. Any such entry will have a copy of some
10711077
* existing DB's datfrozenxid, and that source DB cannot be ours because
@@ -1081,10 +1087,12 @@ vac_truncate_clog(TransactionId frozenXID,
10811087

10821088
while ((tuple=heap_getnext(scan,ForwardScanDirection))!=NULL)
10831089
{
1084-
Form_pg_databasedbform= (Form_pg_database)GETSTRUCT(tuple);
1090+
volatileFormData_pg_database*dbform= (Form_pg_database)GETSTRUCT(tuple);
1091+
TransactionIddatfrozenxid=dbform->datfrozenxid;
1092+
TransactionIddatminmxid=dbform->datminmxid;
10851093

1086-
Assert(TransactionIdIsNormal(dbform->datfrozenxid));
1087-
Assert(MultiXactIdIsValid(dbform->datminmxid));
1094+
Assert(TransactionIdIsNormal(datfrozenxid));
1095+
Assert(MultiXactIdIsValid(datminmxid));
10881096

10891097
/*
10901098
* If things are working properly, no database should have a
@@ -1095,21 +1103,21 @@ vac_truncate_clog(TransactionId frozenXID,
10951103
* databases have been scanned and cleaned up. (We will issue the
10961104
* "already wrapped" warning if appropriate, though.)
10971105
*/
1098-
if (TransactionIdPrecedes(lastSaneFrozenXid,dbform->datfrozenxid)||
1099-
MultiXactIdPrecedes(lastSaneMinMulti,dbform->datminmxid))
1106+
if (TransactionIdPrecedes(lastSaneFrozenXid,datfrozenxid)||
1107+
MultiXactIdPrecedes(lastSaneMinMulti,datminmxid))
11001108
bogus= true;
11011109

1102-
if (TransactionIdPrecedes(myXID,dbform->datfrozenxid))
1110+
if (TransactionIdPrecedes(nextXID,datfrozenxid))
11031111
frozenAlreadyWrapped= true;
1104-
elseif (TransactionIdPrecedes(dbform->datfrozenxid,frozenXID))
1112+
elseif (TransactionIdPrecedes(datfrozenxid,frozenXID))
11051113
{
1106-
frozenXID=dbform->datfrozenxid;
1114+
frozenXID=datfrozenxid;
11071115
oldestxid_datoid=HeapTupleGetOid(tuple);
11081116
}
11091117

1110-
if (MultiXactIdPrecedes(dbform->datminmxid,minMulti))
1118+
if (MultiXactIdPrecedes(datminmxid,minMulti))
11111119
{
1112-
minMulti=dbform->datminmxid;
1120+
minMulti=datminmxid;
11131121
minmulti_datoid=HeapTupleGetOid(tuple);
11141122
}
11151123
}

‎src/backend/postmaster/pgstat.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5351,7 +5351,16 @@ pgstat_db_requested(Oid databaseid)
53515351
{
53525352
slist_iteriter;
53535353

5354-
/* Check the databases if they need to refresh the stats. */
5354+
/*
5355+
* If any requests are outstanding at all, we should write the stats for
5356+
* shared catalogs (the "database" with OID 0). This ensures that
5357+
* backends will see up-to-date stats for shared catalogs, even though
5358+
* they send inquiry messages mentioning only their own DB.
5359+
*/
5360+
if (databaseid==InvalidOid&& !slist_is_empty(&last_statrequests))
5361+
return true;
5362+
5363+
/* Search to see if there's an open request to write this database. */
53555364
slist_foreach(iter,&last_statrequests)
53565365
{
53575366
DBWriteRequest*req=slist_container(DBWriteRequest,next,iter.cur);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp