11
2+ #include < include/catalog/catalog.h>
23#include " index/index_factory.h"
34
45#include " catalog/index_catalog.h"
56#include " catalog/column_catalog.h"
67#include " catalog/table_catalog.h"
78#include " catalog/database_catalog.h"
9+ #include " catalog/system_catalogs.h"
810#include " concurrency/transaction_manager_factory.h"
911#include " catalog/catalog_defaults.h"
1012#include " type/ephemeral_pool.h"
@@ -322,7 +324,7 @@ void WalRecovery::ReplaySingleTxn(txn_id_t txn_id){
322324 InstallCatalogTuple (record_type, tuple.get (), table, commit_id, location);
323325
324326 // update table oid to prevent oid reuse after recovery
325- catalog::TableCatalog ::GetInstance ()->GetNextOid (); // TODO(graghura): This is a hack, rewrite !!!
327+ catalog::Catalog ::GetInstance ()->GetSystemCatalogs (CATALOG_DATABASE_OID)-> GetTableCatalog ()-> GetNextOid ();
326328 tuple_table_create = std::move (tuple);
327329 pending_table_create = true ;
328330
@@ -334,7 +336,7 @@ void WalRecovery::ReplaySingleTxn(txn_id_t txn_id){
334336 InstallCatalogTuple (record_type, tuple.get (), table, commit_id, location);
335337
336338 // update column oid to prevent oid reuse after recovery
337- catalog::ColumnCatalog ::GetInstance ()->GetNextOid (); // TODO(graghura): This is a hack, rewrite !!!
339+ catalog::Catalog ::GetInstance ()->GetSystemCatalogs (CATALOG_DATABASE_OID)-> GetColumnCatalog ()-> GetNextOid ();
338340
339341 bool is_inline = true ;
340342
@@ -361,7 +363,7 @@ void WalRecovery::ReplaySingleTxn(txn_id_t txn_id){
361363 } else if (table_id == INDEX_CATALOG_OID) {
362364 LOG_INFO (" REPLAYING INSERT TO PG_INDEX" );
363365 indexes.push_back (std::move (tuple));
364- catalog::IndexCatalog ::GetInstance ()->GetNextOid (); // TODO(graghura): This is a hack, rewrite !!!
366+ catalog::Catalog ::GetInstance ()->GetSystemCatalogs (CATALOG_DATABASE_OID)-> GetIndexCatalog ()-> GetNextOid ();
365367 }
366368 } else {
367369
@@ -469,7 +471,8 @@ void WalRecovery::ReplaySingleTxn(txn_id_t txn_id){
469471 auto txn = concurrency::TransactionManagerFactory::GetInstance ().BeginTransaction (
470472 IsolationLevelType::SERIALIZABLE);
471473
472- auto table_catalog = catalog::TableCatalog::GetInstance ();
474+ auto table_catalog = catalog::Catalog::GetInstance ()->
475+ GetSystemCatalogs (CATALOG_DATABASE_OID)->GetTableCatalog ();
473476 auto table_object = table_catalog->GetTableObject (tup->GetValue (2 ).GetAs <oid_t >(), txn);
474477 auto database_oid = table_object->GetDatabaseOid ();
475478 auto table = storage::StorageManager::GetInstance ()->GetTableWithOid (
0 commit comments