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

Commit 7cb2205

Browse files
committed
Global snapshots in postgres_fdw cosmetic improvements.
* s/snaphot/snapshot adapted. * GUC renamed from postgres_fdw.use_tsdtm to postgres_fdw.use_global_snapshots. * Set track_global_snapshots = true in tests everywhere. * Makefile niceties. * 003_bank_shared.pl test is removed. In current shape it is useless, and if we bombard both nodes, deadlock surely appears. In general, global snaphots are not needed for such multimaster-like setup -- either there are no conflicts and we are fine, or there is a conflict, in which case we get a deadlock. (cherry picked from commit e73c9b6)
1 parent 57233f8 commit 7cb2205

File tree

6 files changed

+15
-166
lines changed

6 files changed

+15
-166
lines changed

contrib/postgres_fdw/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ include $(top_builddir)/src/Makefile.global
2424
include $(top_srcdir)/contrib/contrib-global.mk
2525
endif
2626

27+
# Global makefile will do temp-install for 'check'. Since REGRESS is defined,
28+
# PGXS (included from contrib-global.mk or directly) will care to add
29+
# postgres_fdw to it as EXTRA_INSTALL and build pg_regress. It will also
30+
# actually run pg_regress, so the only thing left is tap tests.
2731
check: tapcheck
2832

29-
tapcheck:
30-
env DESTDIR='$(abs_top_builddir)'/tmp_install $(MAKE) install
33+
tapcheck: temp-install
3134
$(prove_check)

contrib/postgres_fdw/connection.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ begin_remote_xact(ConnCacheEntry *entry)
505505
fdwTransState->global_csn = ExportGlobalSnapshot();
506506

507507
snprintf(import_sql, sizeof(import_sql),
508-
"SELECT pg_global_snaphot_import("UINT64_FORMAT")",
508+
"SELECT pg_global_snapshot_import("UINT64_FORMAT")",
509509
fdwTransState->global_csn);
510510

511511
do_sql_command(entry, import_sql);
@@ -857,11 +857,11 @@ pgfdw_xact_callback(XactEvent event, void *arg)
857857
if (!res)
858858
goto error;
859859

860-
/* Broadcast pg_global_snaphot_prepare() */
860+
/* Broadcast pg_global_snapshot_prepare() */
861861
if (include_local_tx)
862862
my_csn = GlobalSnapshotPrepareCurrent();
863863

864-
sql = psprintf("SELECT pg_global_snaphot_prepare('%s')",
864+
sql = psprintf("SELECT pg_global_snapshot_prepare('%s')",
865865
fdwTransState->gid);
866866
res = BroadcastStmt(sql, PGRES_TUPLES_OK, MaxCsnCB, &max_csn);
867867
if (!res)
@@ -871,10 +871,10 @@ pgfdw_xact_callback(XactEvent event, void *arg)
871871
if (include_local_tx && my_csn > max_csn)
872872
max_csn = my_csn;
873873

874-
/* Broadcast pg_global_snaphot_assign() */
874+
/* Broadcast pg_global_snapshot_assign() */
875875
if (include_local_tx)
876876
GlobalSnapshotAssignCsnCurrent(max_csn);
877-
sql = psprintf("SELECT pg_global_snaphot_assign('%s',"UINT64_FORMAT")",
877+
sql = psprintf("SELECT pg_global_snapshot_assign('%s',"UINT64_FORMAT")",
878878
fdwTransState->gid, max_csn);
879879
res = BroadcastFunc(sql);
880880

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5825,7 +5825,7 @@ find_em_expr_for_rel(EquivalenceClass *ec, RelOptInfo *rel)
58255825
void
58265826
_PG_init(void)
58275827
{
5828-
DefineCustomBoolVariable("postgres_fdw.use_tsdtm",
5828+
DefineCustomBoolVariable("postgres_fdw.use_global_snapshots",
58295829
"Use global snapshots for FDW transactions", NULL,
58305830
&UseGlobalSnapshots, false, PGC_USERSET, 0, NULL,
58315831
NULL, NULL);

contrib/postgres_fdw/t/001_bank_coordinator.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
$master->append_conf('postgresql.conf', qq(
1111
max_prepared_transactions = 30
1212
log_checkpoints = true
13-
postgres_fdw.use_tsdtm = on
13+
postgres_fdw.use_global_snapshots = on
14+
track_global_snapshots = on
1415
));
1516
$master->start;
1617

contrib/postgres_fdw/t/002_bank_participant.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$shard1->init;
1010
$shard1->append_conf('postgresql.conf', qq(
1111
max_prepared_transactions = 30
12-
postgres_fdw.use_tsdtm = on
12+
postgres_fdw.use_global_snapshots = on
1313
global_snapshot_defer_time = 15
1414
track_global_snapshots = on
1515
));
@@ -19,7 +19,7 @@
1919
$shard2->init;
2020
$shard2->append_conf('postgresql.conf', qq(
2121
max_prepared_transactions = 30
22-
postgres_fdw.use_tsdtm = on
22+
postgres_fdw.use_global_snapshots = on
2323
global_snapshot_defer_time = 15
2424
track_global_snapshots = on
2525
));

contrib/postgres_fdw/t/003_bank_shared.pl

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

0 commit comments

Comments
 (0)