cmu-db / peloton

The Self-Driving Database Management System
http://pelotondb.io
Apache License 2.0
2.03k stars 623 forks source link

Catalog OID collision in checkpoint recovery #1320

Closed ksaito7 closed 6 years ago

ksaito7 commented 6 years ago

Some catalog objects have OID as primary key. OID is incremented automatically when a new catalog record is inserted. The OID value never distinguish built-in catalog records (e.g. built-in function, and catalog table info in pg_table) with user created catalog records (e.g. UDF, and user table info in pg_table).

In checkpoints, all catalog tables is kept with same values including OID. However, for support to add new built-in catalog records, the checkpoint recovery prioritize built-in catalog records initialized by catalog bootstrap. This means that only user created catalog records is recovered. If new built-in catalog records is added in this case, OIDs of the catalog is incremented as mentioned above. Then, these OIDs of the new catalog records conflict with OIDs of user created catalog records recovered from the checkpoint.

To avoid this collision, the OID should distinguish between built-in catalog records and user created catalog records.