Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2407,7 +2407,7 @@ void Metadata::InternalData::update_indexes(int protocol_version, const VersionN
std::string index_name;

KeyspaceMetadata* keyspace = NULL;
TableMetadata::Ptr table;
TableMetadata::Ptr table(NULL);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to init it by NULL due to default constructor of the object:
explicit SharedRefPtr(T* ptr = NULL)
So, please undo the change.


while (rows.next()) {
std::string temp_keyspace_name;
Expand All @@ -2434,7 +2434,9 @@ void Metadata::InternalData::update_indexes(int protocol_version, const VersionN
table->clear_indexes();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main problem is here. If the table is not found the 'table_name' must be reset!
So, the line
if (!table) continue;
must be changed into:
if (!table) { table_name.clear(); continue; }

}

table->add_index(IndexMetadata::from_row(index_name, buffer, row));
if (table) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree.
(Just for rare case when 'temp_table_name' is empty string.)

table->add_index(IndexMetadata::from_row(index_name, buffer, row));
}
}
}

Expand Down