Skip to content

Commit

Permalink
Disable dump pax tables in pg_dump (apache#412)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jiaqizho authored and zhangwenchao committed Apr 28, 2024
1 parent a1741ad commit 2c61f05
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/bin/pg_dump/pg_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ static int extra_float_digits;
*/
#define DUMP_DEFAULT_ROWS_PER_INSERT 1

/*
* FIXME: CBDB should not know the am oid of PAX. We put here because the kernel
* can't distinguish the PAX and renamed heap(heap_psql) in test `psql`.
* The definition of temporary is here and should be consistent with util/rel.h
*/
#define PAX_AM_OID 7047

/*
* Macro for producing quoted, schema-qualified name of a dumpable object.
*/
Expand Down Expand Up @@ -2102,6 +2109,16 @@ selectDumpableTable(TableInfo *tbinfo, Archive *fout)
simple_oid_list_member(&table_exclude_oids,
tbinfo->dobj.catId.oid))
tbinfo->dobj.dump = DUMP_COMPONENT_NONE;

/*
* Pax not support pg_dump yet
*/
if (tbinfo->amoid == PAX_AM_OID) {
tbinfo->dobj.dump = DUMP_COMPONENT_NONE;

pg_log_warning("unsupport am pax yet, current relation \"%s\" will be ignore",
tbinfo->dobj.name);
}
}

/*
Expand Down Expand Up @@ -7391,6 +7408,7 @@ getTables(Archive *fout, int *numTables)
int i_ispartition;
int i_partbound;
int i_amname;
int i_amoid;
int i_isivm;

/*
Expand Down Expand Up @@ -7483,6 +7501,7 @@ getTables(Archive *fout, int *numTables)
"tc.relminmxid AS tminmxid, "
"c.relpersistence, c.relispopulated, "
"c.relreplident, c.relpages, am.amname, "
"am.oid AS amoid, "
"CASE WHEN c.relkind = 'f' THEN "
"(SELECT ftserver FROM pg_catalog.pg_foreign_table WHERE ftrelid = c.oid) "
"ELSE 0 END AS foreignserver, "
Expand Down Expand Up @@ -8080,6 +8099,7 @@ getTables(Archive *fout, int *numTables)
i_ispartition = PQfnumber(res, "ispartition");
i_partbound = PQfnumber(res, "partbound");
i_amname = PQfnumber(res, "amname");
i_amoid = PQfnumber(res, "amoid");
i_isivm = PQfnumber(res, "isivm");

if (dopt->lockWaitTimeout)
Expand Down Expand Up @@ -8171,6 +8191,11 @@ getTables(Archive *fout, int *numTables)
else
tblinfo[i].amname = pg_strdup(PQgetvalue(res, i, i_amname));

if (PQgetisnull(res, i, i_amoid))
tblinfo[i].amoid = InvalidOid;
else
tblinfo[i].amoid = atooid(PQgetvalue(res, i, i_amoid));

/* other fields were zeroed above */

/*
Expand Down
1 change: 1 addition & 0 deletions src/bin/pg_dump/pg_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ typedef struct _tableInfo
char *partbound; /* partition bound definition */
bool needs_override; /* has GENERATED ALWAYS AS IDENTITY */
char *amname; /* relation access method */
Oid amoid; /* relation access method oid */

/*
* Stuff computed only for dumpable tables.
Expand Down

0 comments on commit 2c61f05

Please sign in to comment.