-
Notifications
You must be signed in to change notification settings - Fork 623
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic solves the problems. Remove the dead code, use macro names to make it more readable, and don't introduce changes if unnecessary.
src/catalog/catalog.cpp
Outdated
@@ -169,22 +169,22 @@ void Catalog::BootstrapSystemCatalogs(storage::Database *database, | |||
// pg_database record is shared across different databases | |||
system_catalogs->GetTableCatalog()->InsertTable( | |||
DATABASE_CATALOG_OID, DATABASE_CATALOG_NAME, CATALOG_SCHEMA_NAME, | |||
CATALOG_DATABASE_OID, pool_.get(), txn); | |||
CATALOG_DATABASE_OID, 0, pool_.get(), txn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 0
with its macro name ROW_STORE_OID
. The same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved macros defined in layout.h
into catalog_defaults.h
and modify all raw values with these macros.
src/catalog/catalog.cpp
Outdated
system_catalogs->GetTableCatalog()->InsertTable( | ||
SCHEMA_CATALOG_OID, SCHEMA_CATALOG_NAME, CATALOG_SCHEMA_NAME, | ||
database_oid, pool_.get(), txn); | ||
database_oid, 0, pool_.get(), txn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 0
with its macro name ROW_STORE_OID
.
src/catalog/catalog.cpp
Outdated
system_catalogs->GetTableCatalog()->InsertTable( | ||
TABLE_CATALOG_OID, TABLE_CATALOG_NAME, CATALOG_SCHEMA_NAME, database_oid, | ||
pool_.get(), txn); | ||
0, pool_.get(), txn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 0
with its macro name ROW_STORE_OID
.
src/catalog/catalog.cpp
Outdated
system_catalogs->GetTableCatalog()->InsertTable( | ||
INDEX_CATALOG_OID, INDEX_CATALOG_NAME, CATALOG_SCHEMA_NAME, database_oid, | ||
pool_.get(), txn); | ||
0, pool_.get(), txn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 0
with its macro name ROW_STORE_OID
.
src/catalog/catalog.cpp
Outdated
system_catalogs->GetTableCatalog()->InsertTable( | ||
COLUMN_CATALOG_OID, COLUMN_CATALOG_NAME, CATALOG_SCHEMA_NAME, | ||
database_oid, pool_.get(), txn); | ||
database_oid, 0, pool_.get(), txn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 0
with its macro name ROW_STORE_OID
.
test/catalog/catalog_test.cpp
Outdated
// Change default layout. | ||
// Check the first default layout | ||
auto first_default_layout = table->GetDefaultLayout(); | ||
EXPECT_EQ(0, first_default_layout->GetOid()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 0
with its macro name ROW_STORE_OID
.
auto default_layout_oid = default_layout->GetOid(); | ||
EXPECT_EQ(default_layout_oid, table->GetDefaultLayout()->GetOid()); | ||
EXPECT_FALSE(default_layout->IsColumnStore()); | ||
EXPECT_FALSE(default_layout->IsRowStore()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we test if its type is HYBRID
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there was not a function to access the layout type directly. These two EXPECT_FALSE
tests match HYBRID actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just adding a function like IsHybridStore()
to make it more clear?
|
||
// Check the created layout | ||
EXPECT_FALSE(other_layout->IsColumnStore()); | ||
EXPECT_FALSE(other_layout->IsRowStore()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same question as before. Can we test if its type is HYBRID
directly?
test/catalog/catalog_test.cpp
Outdated
EXPECT_TRUE(table->GetDefaultLayout().IsRowStore()); | ||
EXPECT_NE(default_layout, table->GetDefaultLayout()); | ||
EXPECT_TRUE(table->GetDefaultLayout()->IsRowStore()); | ||
EXPECT_EQ(0, table->GetDefaultLayout()->GetOid()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the macro name of 0
.
test/catalog/catalog_test.cpp
Outdated
EXPECT_EQ(nullptr, | ||
pg_layout->GetLayoutWithOid(table_oid, default_layout_oid, txn)); | ||
EXPECT_EQ(0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace 0
with nullptr
.
@aaron-tian Thanks for a lot of comments! I modified them and reply each comments. Please check them again. |
Thanks for the nice work. |
I update them you mentioned. thanks. |
Catalog updates for checkpoints
This PR updates some issues related to catalog stuff for checkpoints.
- Related Issues
- Fix Points
column_length
feild within pg_attribute and ColumnCatalogObject, and modify related functions in ColumnCatalog.UpdateOid()
function within catalogs using oid_ in order to avoid collision between catalog values added by system and users. And addOID_FOR_USER_OFFSET
(= 10000) variable within catalog_default.cpp to be used forUpdateOid()
function. These are called in last of bootstraps of Catalog and SystemCatalog.GetChachedTableObject()
function andGetChachedIndexObject()
function in order to avoid to acquire an unexpected table from other database. Also fix related functions,GetTableObject()
in TableCatalog andGetIndexObject()
in IndexCatalog.Layout(num_columns, layout_type)
to set appropriate layout oid.CreateTable()
andCreateLayout()
in Catalog class to insert all Layout information including row layout and column layout into pg_layout, LayoutCatalog. These avoid to insert same layout. And also modifyDropLayout()
in Catalog to recreate default layout in pg_catalog in case that it is deleted.default_layout_oid
field within pg_table and TableCatalogObject, and modify related functions in TableCatalog. To support for updating default layout, addUpdateDefaultLayoutOid()
function within TableCatalog. It is used inCreateDefaultLayout()
function andDropLayout()
function.