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

Commit444c1a3

Browse files
committed
pg_rollback_prepared_xacts() function
1 parentb43b2e3 commit444c1a3

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,3 +2267,30 @@ GetLockedGlobalTransactionId(void)
22672267
{
22682268
returnMyLockedGxact ?MyLockedGxact->gid :NULL;
22692269
}
2270+
2271+
int
2272+
FinishAllPreparedTransactions(boolisCommit)
2273+
{
2274+
inti,count=0;
2275+
2276+
for (i=0;i<TwoPhaseState->numPrepXacts;i++)
2277+
{
2278+
GlobalTransactiongxact=TwoPhaseState->prepXacts[i];
2279+
2280+
if (gxact->valid)
2281+
{
2282+
FinishPreparedTransaction(gxact->gid,isCommit);
2283+
count++;
2284+
}
2285+
}
2286+
2287+
returncount;
2288+
}
2289+
2290+
Datum
2291+
pg_rollback_prepared_xacts(PG_FUNCTION_ARGS)
2292+
{
2293+
intcount;
2294+
count=FinishAllPreparedTransactions(0);
2295+
PG_RETURN_INT32(count);
2296+
}

‎src/include/access/twophase.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ extern void FinishPreparedTransaction(const char *gid, bool isCommit);
6161

6262
externconstchar*GetLockedGlobalTransactionId(void);
6363

64+
externintFinishAllPreparedTransactions(boolisCommit);
65+
6466
#endif/* TWOPHASE_H */

‎src/include/catalog/pg_proc.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,6 +3052,8 @@ DATA(insert OID = 2561 ( pg_blocking_pids PGNSP PGUID 12 1 0 0 0 f f f f t f v
30523052
DESCR("get array of PIDs of sessions blocking specified backend PID");
30533053
DATA(insert OID = 1065 ( pg_prepared_xact PGNSP PGUID 12 1 1000 0 0 f f f f t t v s 0 0 2249 "" "{28,25,1184,26,26}" "{o,o,o,o,o}" "{transaction,gid,prepared,ownerid,dbid}" _null_ _null_ pg_prepared_xact _null_ _null_ _null_ ));
30543054
DESCR("view two-phase transactions");
3055+
DATA(insert OID = 4014 ( pg_rollback_prepared_xacts PGNSP PGUID 12 1 0 0 0 f f f f t f s u 0 0 23 "" _null_ _null_ _null_ _null_ _null_ pg_rollback_prepared_xacts _null_ _null_ _null_ ));
3056+
DESCR("rollback all two-phase transactions");
30553057
DATA(insert OID = 3819 ( pg_get_multixact_members PGNSP PGUID 12 1 1000 0 0 f f f f t t v s 1 0 2249 "28" "{28,28,25}" "{i,o,o}" "{multixid,xid,mode}" _null_ _null_ pg_get_multixact_members _null_ _null_ _null_ ));
30563058
DESCR("view members of a multixactid");
30573059

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp