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

Commit cb882d6

Browse files
committed
Revert "Built-in support of local table"
This reverts commit 3e4fed0.
1 parent 577adc1 commit cb882d6

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

multimaster--1.0.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ CREATE FUNCTION mtm.referee_poll(xid bigint) RETURNS bigint
112112
AS 'MODULE_PATHNAME','mtm_referee_poll'
113113
LANGUAGE C;
114114

115-
CREATE LOCAL TABLE IF NOT EXISTS mtm.local_tables(rel_schema name, rel_name name, primary key(rel_schema, rel_name));
115+
CREATE TABLE IF NOT EXISTS mtm.local_tables(rel_schema name, rel_name name, primary key(rel_schema, rel_name));
116116

117-
CREATE LOCAL TABLE mtm.referee_decision(key text primary key not null, node_id int);
117+
CREATE TABLE mtm.referee_decision(key text primary key not null, node_id int);
118118

119119
CREATE OR REPLACE FUNCTION mtm.alter_sequences() RETURNS boolean AS
120120
$$

multimaster.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3860,7 +3860,12 @@ MtmReplicationRowFilterHook(struct PGLogicalRowFilterArgs* args)
38603860
{
38613861
bool isDistributed;
38623862

3863-
if (args->changed_rel->rd_islocal)
3863+
/*
3864+
* We have several built-in local tables that shouldn't be replicated.
3865+
* It is hard to insert them into MtmLocalTables properly on extension
3866+
* creation so we just list them here.
3867+
*/
3868+
if (strcmp(args->changed_rel->rd_rel->relname.data, "referee_decision") == 0)
38643869
return false;
38653870

38663871
/*

pglogical_apply.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,12 @@ process_remote_insert(StringInfo s, Relation rel)
10431043
if (ActiveSnapshotSet())
10441044
PopActiveSnapshot();
10451045

1046+
if (strcmp(RelationGetRelationName(rel), MULTIMASTER_LOCAL_TABLES_TABLE) == 0 &&
1047+
strcmp(get_namespace_name(RelationGetNamespace(rel)), MULTIMASTER_SCHEMA_NAME) == 0)
1048+
{
1049+
MtmMakeTableLocal((char*)DatumGetPointer(new_tuple.values[0]), (char*)DatumGetPointer(new_tuple.values[1]));
1050+
}
1051+
10461052
ExecResetTupleTable(estate->es_tupleTable, true);
10471053
FreeExecutorState(estate);
10481054

0 commit comments

Comments
 (0)