Skip to content

Commit 21a3794

Browse files
committed
PG-1437 Clean up definition of special TDE oids
The oids worked as-is, in general any reserved catalog oid which is frefers to an object of another type will work as a special magical oid. Here we decide to use tablespce oids for special database values and a database oid, 1, for the relation value. But in the latter case anything would have worked since we are guarnteed to have no collissions due to the database oid not being and actual database. The old solution which use a mix worked too but this is more consistent.
1 parent 9ea86cc commit 21a3794

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

contrib/pg_tde/src/include/catalog/tde_global_space.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@
1515
#include "catalog/pg_tablespace_d.h"
1616

1717
/*
18-
* Needed for global data (WAL etc) keys identification in caches and storage.
19-
* We take Oids of the sql operators, so there is no overlap with the "real"
20-
* catalog objects possible.
18+
* We pick magical database oids from the tablespace oid which avoids
19+
* collissions with any real database oid.
2120
*/
22-
#define GLOBAL_DATA_TDE_OID 607 // TODO: why not repeat GLOBALTABLESPACE_OID ?
23-
#define XLOG_TDE_OID 608
21+
#define GLOBAL_DATA_TDE_OID GLOBALTABLESPACE_OID
22+
#define DEFAULT_DATA_TDE_OID DEFAULTTABLESPACE_OID
23+
24+
/*
25+
* This oid can be anything since the database oid is gauranteed to not be a
26+
* real database.
27+
*/
28+
#define XLOG_TDE_OID 1
2429

2530
#define GLOBAL_SPACE_RLOCATOR(_obj_oid) (RelFileLocator) { \
2631
GLOBALTABLESPACE_OID, \
2732
GLOBAL_DATA_TDE_OID, \
2833
_obj_oid \
2934
}
3035

31-
/* Needed for using the same default key for multiple databases */
32-
#define DEFAULT_DATA_TDE_OID DEFAULTTABLESPACE_OID
33-
3436
#define TDEisInGlobalSpace(dbOid) (dbOid == GLOBAL_DATA_TDE_OID)
3537

3638
#endif /* TDE_GLOBAL_CATALOG_H */

0 commit comments

Comments
 (0)