Skip to content

Commit 5d3274d

Browse files
committed
Fix PGPPRO-717 correctly restore name/schema of local tables
1 parent 6c4ad7f commit 5d3274d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

contrib/mmts/multimaster.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,7 +2522,7 @@ MtmCreateLocalTableMap(void)
25222522
return htab;
25232523
}
25242524

2525-
void MtmMakeRelationLocal(Oid relid)
2525+
static void MtmMakeRelationLocal(Oid relid)
25262526
{
25272527
if (OidIsValid(relid)) {
25282528
MtmLock(LW_EXCLUSIVE);
@@ -2532,17 +2532,17 @@ void MtmMakeRelationLocal(Oid relid)
25322532
}
25332533

25342534

2535-
static void MtmMakeTableLocal(char* schema, char* name)
2535+
void MtmMakeTableLocal(char const* schema, char const* name)
25362536
{
2537-
RangeVar* rv = makeRangeVar(schema, name, -1);
2537+
RangeVar* rv = makeRangeVar((char*)schema, (char*)name, -1);
25382538
Oid relid = RangeVarGetRelid(rv, NoLock, true);
25392539
MtmMakeRelationLocal(relid);
25402540
}
25412541

25422542

25432543
typedef struct {
2544-
NameData schema;
2545-
NameData name;
2544+
text schema;
2545+
text name;
25462546
} MtmLocalTablesTuple;
25472547

25482548
static void MtmLoadLocalTables(void)
@@ -2562,7 +2562,7 @@ static void MtmLoadLocalTables(void)
25622562
while (HeapTupleIsValid(tuple = systable_getnext(scan)))
25632563
{
25642564
MtmLocalTablesTuple *t = (MtmLocalTablesTuple*) GETSTRUCT(tuple);
2565-
MtmMakeTableLocal(NameStr(t->schema), NameStr(t->name));
2565+
MtmMakeTableLocal(text_to_cstring(&t->schema), text_to_cstring(&t->name));
25662566
}
25672567

25682568
systable_endscan(scan);

contrib/mmts/multimaster.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ extern void MtmCheckQuorum(void);
403403
extern bool MtmRecoveryCaughtUp(int nodeId, lsn_t walEndPtr);
404404
extern void MtmCheckRecoveryCaughtUp(int nodeId, lsn_t slotLSN);
405405
extern void MtmRecoveryCompleted(void);
406-
extern void MtmMakeRelationLocal(Oid relid);
406+
extern void MtmMakeTableLocal(char const* schema, char const* name);
407407
extern void MtmHandleApplyError(void);
408408
extern void MtmUpdateLsnMapping(int nodeId, lsn_t endLsn);
409409
extern lsn_t MtmGetFlushPosition(int nodeId);

contrib/mmts/pglogical_apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ process_remote_insert(StringInfo s, Relation rel)
860860
if (strcmp(RelationGetRelationName(rel), MULTIMASTER_LOCAL_TABLES_TABLE) == 0 &&
861861
strcmp(get_namespace_name(RelationGetNamespace(rel)), MULTIMASTER_SCHEMA_NAME) == 0)
862862
{
863-
MtmMakeRelationLocal(RelationGetRelid(rel));
863+
MtmMakeTableLocal(TextDatumGetCString(new_tuple.values[0]), TextDatumGetCString(new_tuple.values[1]));
864864
}
865865

866866
ExecResetTupleTable(estate->es_tupleTable, true);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy