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

Commit2622114

Browse files
committed
Merge branch 'PGPROEE9_6' into mm_2pc_cleanup
2 parents8dd49c9 +d4cd07d commit2622114

File tree

6 files changed

+85
-32
lines changed

6 files changed

+85
-32
lines changed

‎doc/src/sgml/ref/pgbench.sgml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -472,18 +472,18 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
472472
transaction scheduled start time, not the actual transaction beginning
473473
time. Thus, the latency also includes the average schedule lag time. If
474474
any transactions have been rolled back and retried after a
475-
serialization/deadlockfailure since the last report, the report
475+
serialization/deadlockerror since the last report, the report
476476
includes the number of such transactions and the sum of all retries. Use
477477
the <option>--max-tries</> to enable transactions retries after
478-
serialization/deadlockfailures.
478+
serialization/deadlockerrors.
479479
</para>
480480
<note>
481481
<para>
482482
If a custom script contains multiple transactions, its run is reported
483483
as failed if any of its transactions ended with a
484484
serialization/deadlock failure. The run of this script is reported as
485485
retried if any of its transactions was retried after a
486-
serialization/deadlockfailure. The total sum of retries includes the
486+
serialization/deadlockerror. The total sum of retries includes the
487487
retries for all transactions in this script.
488488
</para>
489489
</note>
@@ -639,7 +639,7 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
639639
<listitem>
640640
<para>
641641
Set the maximum number of tries for transactions with
642-
serialization/deadlockfailures. The default is 1.
642+
serialization/deadlockerrors. The default is 1.
643643
</para>
644644

645645
<note>
@@ -655,8 +655,8 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
655655
<note>
656656
<para>
657657
Transactions that span over more than one script are not rolled back
658-
and will not be retried in case ofa failure. In such cases, the script
659-
in which thefailure occurred is reported as failed.
658+
and will not be retried in case ofan error. In such cases, the script
659+
in which theerror occurred is reported as failed.
660660
</para>
661661
</note>
662662
</listitem>
@@ -1234,7 +1234,7 @@ END;
12341234
the <replaceable>time</> for a skipped transaction will be reported as
12351235
<literal>skipped</>.
12361236
<replaceable>serialization_retries</> and <replaceable>deadlock_retries</>
1237-
are the sums of all the retries after the correspondingfailures during the
1237+
are the sums of all the retries after the correspondingerrors during the
12381238
current script execution. They are only present when the maximum number of
12391239
tries for transactions is more than 1 (<option>--max-tries</>).
12401240
If the transaction ended with a serialization/deadlock failure, its
@@ -1322,7 +1322,7 @@ END;
13221322
serialization/deadlock failures within the interval (see
13231323
<xref linkend="failures-and-retries" endterm="failures-and-retries-title">
13241324
for more information). A transaction is counted into the interval when it was
1325-
committed. The fieldsin the end, <replaceable>lag_sum</>,
1325+
committed. The fieldsnear the end, <replaceable>lag_sum</>,
13261326
<replaceable>lag_2_sum</>, <replaceable>min_lag</>, and
13271327
<replaceable>max_lag</>, are only present if the <option>--rate</> option is
13281328
used. The next field, <replaceable>skipped_transactions</>, is only
@@ -1333,7 +1333,7 @@ END;
13331333
<replaceable>serialization_retries</>, and <replaceable>deadlock_retries</>
13341334
fields are only present if the maximum number of tries for transactions is
13351335
more than 1 (<option>--max-tries</>). They report the number of retried
1336-
transactions and the sum of all the retries after the correspondingfailures
1336+
transactions and the sum of all the retries after the correspondingerrors
13371337
within the interval.
13381338
</para>
13391339

@@ -1346,7 +1346,7 @@ END;
13461346
statistics is increased by one, regardless of the number of retried
13471347
transactions. However, the <replaceable>serialization_retries</> and
13481348
<replaceable>deadlock_retries</> include the sum of all retries after the
1349-
correspondingfailures for all transactions in this script.
1349+
correspondingerrors for all transactions in this script.
13501350
</para>
13511351
</note>
13521352

@@ -1384,14 +1384,14 @@ END;
13841384
</listitem>
13851385
<listitem>
13861386
<para>
1387-
The number of serialization and deadlock failures that did not cause a
1388-
retry. See<xref linkend="failures-and-retries"
1387+
The number of serialization and deadlock failures. See
1388+
<xref linkend="failures-and-retries"
13891389
endterm="failures-and-retries-title"> for more information.
13901390
</para>
13911391
</listitem>
13921392
<listitem>
13931393
<para>
1394-
The number of retries after a serialization/deadlockfailure in this
1394+
The number of retries after a serialization/deadlockerror in this
13951395
statement; they are reported as serialization/deadlock retries,
13961396
respectively.
13971397
</para>
@@ -1513,16 +1513,16 @@ script statistics:
15131513
<title id="failures-and-retries-title">Serialization/Deadlock Failures and Retries</title>
15141514

15151515
<para>
1516-
Transactions with serialization or deadlockfailures are rolled back and
1516+
Transactions with serialization or deadlockerrors are rolled back and
15171517
repeated until they complete successfully or reach the maximum number of
15181518
tries specified by the <option>--max-tries</> option. If the last transaction
15191519
run fails, this transaction will be reported as failed.
15201520
</para>
15211521

15221522
<para>
15231523
Transactions that span over more than one script are not rolled back and will
1524-
not be retried in case ofa failure. In such cases, the script in which the
1525-
failure occurred is reported as failed.
1524+
not be retried in case ofan error. In such cases, the script in which the
1525+
error occurred is reported as failed.
15261526
</para>
15271527

15281528
<para>
@@ -1536,15 +1536,15 @@ script statistics:
15361536
If the total number of retried transactions is non-zero, the main report also
15371537
contains the statistics related to retries: the total number of retried
15381538
transactions, the total number of retries, and the number of retries after
1539-
each kind offailure (use option <option>--max-tries</> to make it possible).
1539+
each kind oferror (use option <option>--max-tries</> to make it possible).
15401540
The per-statement report inherits all columns from the main report.
15411541
</para>
15421542
<note>
15431543
<para>
15441544
If a custom script contains multiple transactions, its run is reported as
15451545
failed if any of its transactions ended with a serialization/deadlock
15461546
failure. The run of this script is reported as retried if any of its
1547-
transactions was retried after a serialization/deadlockfailure. The total
1547+
transactions was retried after a serialization/deadlockerror. The total
15481548
sum of retries includes the retries for all transactions in this script.
15491549
</para>
15501550
</note>

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,6 +1855,8 @@ typedef struct {
18551855
void*TriggerState;
18561856
void*SPIState;
18571857
void*SnapshotState;
1858+
void*PredicateState;
1859+
void*StorageState;
18581860
structTransInvalidationInfo*InvalidationInfo;
18591861

18601862
List*on_commit_actions;
@@ -2196,19 +2198,16 @@ CommitTransaction(void)
21962198
RESOURCE_RELEASE_AFTER_LOCKS,
21972199
true, true);
21982200

2199-
if (!is_autonomous_transaction)
2200-
{
2201-
/*
2202-
* Likewise, dropping of files deleted during the transaction is best done
2203-
* after releasing relcache and buffer pins. (This is not strictly
2204-
* necessary during commit, since such pins should have been released
2205-
* already, but this ordering is definitely critical during abort.) Since
2206-
* this may take many seconds, also delay until after releasing locks.
2207-
* Other backends will observe the attendant catalog changes and not
2208-
* attempt to access affected files.
2209-
*/
2210-
smgrDoPendingDeletes(true);
2211-
}
2201+
/*
2202+
* Likewise, dropping of files deleted during the transaction is best done
2203+
* after releasing relcache and buffer pins. (This is not strictly
2204+
* necessary during commit, since such pins should have been released
2205+
* already, but this ordering is definitely critical during abort.) Since
2206+
* this may take many seconds, also delay until after releasing locks.
2207+
* Other backends will observe the attendant catalog changes and not
2208+
* attempt to access affected files.
2209+
*/
2210+
smgrDoPendingDeletes(true);
22122211

22132212
AtCommit_Notify();
22142213
AtEOXact_GUC(true,s->gucNestLevel);
@@ -3530,7 +3529,9 @@ void SuspendTransaction(void)
35303529
sus->TopTransactionStateData=TopTransactionStateData;
35313530

35323531
sus->SnapshotState=SuspendSnapshot();/* only before the resource-owner stuff */
3533-
3532+
sus->PredicateState=SuspendPredicate();
3533+
sus->StorageState=SuspendStorage();
3534+
35343535
if (HasCatcacheInvalidationMessages())
35353536
{
35363537
ResetCatalogCaches();
@@ -3652,6 +3653,8 @@ bool ResumeTransaction(void)
36523653
TopTransactionResourceOwner=sus->TopTransactionResourceOwner;
36533654

36543655
ResumeSnapshot(sus->SnapshotState);/* only after the resource-owner stuff */
3656+
ResumePredicate(sus->PredicateState);
3657+
ResumeStorage(sus->StorageState);
36553658
ResumeInvalidationInfo(sus->InvalidationInfo);
36563659
if (xactHasCatcacheInvalidationMessages)
36573660
{

‎src/backend/catalog/storage.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,3 +563,15 @@ smgr_redo(XLogReaderState *record)
563563
else
564564
elog(PANIC,"smgr_redo: unknown op code %u",info);
565565
}
566+
567+
void*SuspendStorage(void)
568+
{
569+
PendingRelDelete*pending=pendingDeletes;
570+
pendingDeletes=NULL;
571+
returnpending;
572+
}
573+
574+
voidResumeStorage(void*ctx)
575+
{
576+
pendingDeletes= (PendingRelDelete*)ctx;
577+
}

‎src/backend/storage/lmgr/predicate.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
#include"utils/rel.h"
203203
#include"utils/snapmgr.h"
204204
#include"utils/tqual.h"
205+
#include"utils/memutils.h"
205206

206207
/* Uncomment the next line to test the graceful degradation code. */
207208
/* #define TEST_OLDSERXID */
@@ -4963,3 +4964,34 @@ predicatelock_twophase_recover(TransactionId xid, uint16 info,
49634964
CreatePredicateLock(&lockRecord->target,targettaghash,sxact);
49644965
}
49654966
}
4967+
4968+
typedefstructSuspendedPredicateState
4969+
{
4970+
HTAB*LocalPredicateLockHash;
4971+
SERIALIZABLEXACT*MySerializableXact;
4972+
boolMyXactDidWrite;
4973+
}SuspendedPredicateState;
4974+
4975+
4976+
void*SuspendPredicate(void)
4977+
{
4978+
SuspendedPredicateState*s= (SuspendedPredicateState*)MemoryContextAlloc(TopMemoryContext,sizeof(SuspendedPredicateState));
4979+
s->LocalPredicateLockHash=LocalPredicateLockHash;
4980+
s->MySerializableXact=MySerializableXact;
4981+
s->MyXactDidWrite=MyXactDidWrite;
4982+
4983+
LocalPredicateLockHash=NULL;
4984+
MySerializableXact=InvalidSerializableXact;
4985+
MyXactDidWrite= false;
4986+
4987+
returns;
4988+
}
4989+
4990+
voidResumePredicate(void*data)
4991+
{
4992+
SuspendedPredicateState*s= (SuspendedPredicateState*)data;
4993+
LocalPredicateLockHash=s->LocalPredicateLockHash;
4994+
MySerializableXact=s->MySerializableXact;
4995+
MyXactDidWrite=s->MyXactDidWrite;
4996+
pfree(s);
4997+
}

‎src/include/catalog/storage.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ extern void AtSubCommit_smgr(void);
3333
externvoidAtSubAbort_smgr(void);
3434
externvoidPostPrepare_smgr(void);
3535

36+
externvoid*SuspendStorage(void);
37+
externvoidResumeStorage(void*ctx);
38+
3639
#endif/* STORAGE_H */

‎src/include/storage/predicate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,7 @@ extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit);
7070
externvoidpredicatelock_twophase_recover(TransactionIdxid,uint16info,
7171
void*recdata,uint32len);
7272

73+
externvoid*SuspendPredicate(void);
74+
externvoidResumePredicate(void*data);
75+
7376
#endif/* PREDICATE_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp