Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e1bacb7

Browse files
committed
Enforce REPEATABLE READ since currently we export snap only once in xact
There is also no distribute predicate locking support, so SERIALIZABLE is not the way to go too.
1 parent 221220a commit e1bacb7

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

contrib/postgres_fdw/connection.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,15 @@ begin_remote_xact(ConnCacheEntry *entry)
501501
elog(DEBUG3, "starting remote transaction on connection %p",
502502
entry->conn);
503503

504+
if (UseGlobalSnapshots && (!IsolationUsesXactSnapshot() ||
505+
IsolationIsSerializable()))
506+
elog(ERROR, "Global snapshots support only REPEATABLE READ");
507+
504508
sprintf(sql, "START TRANSACTION %s; set application_name='pgfdw:%lld:%d';",
505509
IsolationIsSerializable() ? "ISOLATION LEVEL SERIALIZABLE" :
506510
UseRepeatableRead ? "ISOLATION LEVEL REPEATABLE READ" : "",
507511
(long long) GetSystemIdentifier(), MyProcPid);
512+
508513
entry->changing_xact_state = true;
509514
do_sql_command(entry, sql);
510515
entry->xact_depth = 1;

contrib/postgres_fdw/t/001_bank_coordinator.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
log_checkpoints = true
1313
postgres_fdw.use_global_snapshots = on
1414
track_global_snapshots = on
15+
default_transaction_isolation = 'REPEATABLE READ'
1516
));
1617
$master->start;
1718

contrib/postgres_fdw/t/002_bank_participant.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
postgres_fdw.use_global_snapshots = on
1313
global_snapshot_defer_time = 15
1414
track_global_snapshots = on
15+
default_transaction_isolation = 'REPEATABLE READ'
1516
));
1617
$shard1->start;
1718

@@ -22,6 +23,7 @@
2223
postgres_fdw.use_global_snapshots = on
2324
global_snapshot_defer_time = 15
2425
track_global_snapshots = on
26+
default_transaction_isolation = 'REPEATABLE READ'
2527
));
2628
$shard2->start;
2729

0 commit comments

Comments
 (0)