cmu-db / peloton

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

Unexpected catalog object might be obtained from CatalogCache #1373

Closed ksaito7 closed 6 years ago

ksaito7 commented 6 years ago

When we use a getter function in CatalogCache, an unexpected catalog object might be obtained from unexpected database. For example:

std::shared_ptr<TableCatalogObject> CatalogCache::GetCachedTableObject(
    oid_t table_oid) {
  for (auto it = database_objects_cache.begin();
       it != database_objects_cache.end(); ++it) {
    auto database_object = it->second;
    auto table_object = database_object->GetTableObject(table_oid, true);
    if (table_object) return table_object;
  }
  return nullptr;
}

In this function, same table_oid might be existed in an other database unexpected, because SystemCatalogs class allows each catalog to make same oid between databases. We need to add a database_oid argument to all getter functions.