Skip to content

Commit f73e8c6

Browse files
authored
Disable dump pax tables in pg_dump (#412)
Pax is not working properly in pg_dump/pg_restore. There are several problems: The pax relative table in namespace pg_ext_aux won't be dump. The table access method pax have not been setting in pg_dump. Current change ignore pax table in pg_dump.
1 parent 23fece7 commit f73e8c6

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ static int extra_float_digits;
173173
*/
174174
#define DUMP_DEFAULT_ROWS_PER_INSERT 1
175175

176+
/*
177+
* FIXME: CBDB should not know the am oid of PAX. We put here because the kernel
178+
* can't distinguish the PAX and renamed heap(heap_psql) in test `psql`.
179+
* The definition of temporary is here and should be consistent with util/rel.h
180+
*/
181+
#define PAX_AM_OID 7047
182+
176183
/*
177184
* Macro for producing quoted, schema-qualified name of a dumpable object.
178185
*/
@@ -2098,6 +2105,16 @@ selectDumpableTable(TableInfo *tbinfo, Archive *fout)
20982105
simple_oid_list_member(&table_exclude_oids,
20992106
tbinfo->dobj.catId.oid))
21002107
tbinfo->dobj.dump = DUMP_COMPONENT_NONE;
2108+
2109+
/*
2110+
* Pax not support pg_dump yet
2111+
*/
2112+
if (tbinfo->amoid == PAX_AM_OID) {
2113+
tbinfo->dobj.dump = DUMP_COMPONENT_NONE;
2114+
2115+
pg_log_warning("unsupport am pax yet, current relation \"%s\" will be ignore",
2116+
tbinfo->dobj.name);
2117+
}
21012118
}
21022119

21032120
/*
@@ -7387,6 +7404,7 @@ getTables(Archive *fout, int *numTables)
73877404
int i_ispartition;
73887405
int i_partbound;
73897406
int i_amname;
7407+
int i_amoid;
73907408
int i_isivm;
73917409

73927410
/*
@@ -7479,6 +7497,7 @@ getTables(Archive *fout, int *numTables)
74797497
"tc.relminmxid AS tminmxid, "
74807498
"c.relpersistence, c.relispopulated, "
74817499
"c.relreplident, c.relpages, am.amname, "
7500+
"am.oid AS amoid, "
74827501
"CASE WHEN c.relkind = 'f' THEN "
74837502
"(SELECT ftserver FROM pg_catalog.pg_foreign_table WHERE ftrelid = c.oid) "
74847503
"ELSE 0 END AS foreignserver, "
@@ -8076,6 +8095,7 @@ getTables(Archive *fout, int *numTables)
80768095
i_ispartition = PQfnumber(res, "ispartition");
80778096
i_partbound = PQfnumber(res, "partbound");
80788097
i_amname = PQfnumber(res, "amname");
8098+
i_amoid = PQfnumber(res, "amoid");
80798099
i_isivm = PQfnumber(res, "isivm");
80808100

80818101
if (dopt->lockWaitTimeout)
@@ -8167,6 +8187,11 @@ getTables(Archive *fout, int *numTables)
81678187
else
81688188
tblinfo[i].amname = pg_strdup(PQgetvalue(res, i, i_amname));
81698189

8190+
if (PQgetisnull(res, i, i_amoid))
8191+
tblinfo[i].amoid = InvalidOid;
8192+
else
8193+
tblinfo[i].amoid = atooid(PQgetvalue(res, i, i_amoid));
8194+
81708195
/* other fields were zeroed above */
81718196

81728197
/*

src/bin/pg_dump/pg_dump.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ typedef struct _tableInfo
383383
char *partbound; /* partition bound definition */
384384
bool needs_override; /* has GENERATED ALWAYS AS IDENTITY */
385385
char *amname; /* relation access method */
386+
Oid amoid; /* relation access method oid */
386387

387388
/*
388389
* Stuff computed only for dumpable tables.

0 commit comments

Comments
 (0)