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

Commit0bc1a10

Browse files
committed
fix prepared ddl/chrckpoint deadlock
1 parentc128307 commit0bc1a10

File tree

4 files changed

+17
-93
lines changed

4 files changed

+17
-93
lines changed

‎src/backend/storage/ipc/standby.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid)
607607
/* Already processed? */
608608
if (!TransactionIdIsValid(xid)||
609609
TransactionIdDidCommit(xid)||
610-
TransactionIdDidAbort(xid))
610+
TransactionIdDidAbort(xid)||
611+
StandbyTransactionIdIsPrepared(xid))
611612
return;
612613

613614
elog(trace_recovery(DEBUG4),

‎src/test/recovery/t/007_twophase.pl‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
use warnings;
33
use PostgresNode;
44
use TestLib;
5-
use Test::Moretests=>11;
5+
use Test::Moretests=>12;
66

77
# Setup master node
88
my$node_master = get_new_node("master");
99
$node_master->init(allows_streaming=> 1);
1010
$node_master->append_conf('postgresql.conf',qq(
11-
max_prepared_transactions = 10
11+
max_prepared_transactions = 10
1212
));
1313
$node_master->start;
1414
$node_master->backup('master_backup');
@@ -224,13 +224,20 @@
224224

225225

226226
###############################################################################
227-
# Commit prepared on master while slave is down.
227+
# Check for a lock confcict between prepared tx with DDL inside and replay of
228+
# XLOG_STANDBY_LOCK wal record.
228229
###############################################################################
229230

230-
# Switch to asynchronous replication
231-
#$node_master->append_conf('postgresql.conf', qq(
232-
#synchronous_standby_names = ''
233-
#));
234-
#$node_master->psql('postgres', "select pg_reload_conf()");
231+
$node_master->psql('postgres',"
232+
begin;
233+
create table t2(id int);
234+
prepare transaction 'x';
235+
-- checkpoint will issue XLOG_STANDBY_LOCK that can conflict with lock
236+
-- held by 'create table' statement
237+
checkpoint;
238+
commit prepared 'x';
239+
");
235240

241+
$node_slave->psql('postgres',"select count(*) from pg_prepared_xacts",stdout=> \$psql_out);
242+
is($psql_out,'0',"Replay tx with DDL");
236243

‎src/test/recovery/t/twophase_recovery_bug.pl‎

Lines changed: 0 additions & 45 deletions
This file was deleted.

‎src/test/recovery/t/twophase_recovery_bug_2.pl‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp