From 1bcc8a3052d9dd53a14b457121216d86e3db41c1 Mon Sep 17 00:00:00 2001 From: Ravi Prakash Date: Sat, 28 Apr 2018 14:48:13 -0700 Subject: [PATCH] MCOL-1229 - IS.columnstore_columns crashes when DDL is simultaneously executing. The crash was due to an attempt to iterate over the columns of a recently dropped table. Such a table will now be ignored. --- dbcon/mysql/is_columnstore_columns.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dbcon/mysql/is_columnstore_columns.cpp b/dbcon/mysql/is_columnstore_columns.cpp index 21c9e748e..13f9b9485 100644 --- a/dbcon/mysql/is_columnstore_columns.cpp +++ b/dbcon/mysql/is_columnstore_columns.cpp @@ -27,6 +27,8 @@ #include #include "calpontsystemcatalog.h" #include "dataconvert.h" +#include "exceptclasses.h" +using namespace logging; // Required declaration as it isn't in a MairaDB include @@ -70,7 +72,22 @@ static int is_columnstore_columns_fill(THD *thd, TABLE_LIST *tables, COND *cond) for (std::vector >::const_iterator it = catalog_tables.begin(); it != catalog_tables.end(); ++it) { - execplan::CalpontSystemCatalog::RIDList column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true); + execplan::CalpontSystemCatalog::RIDList column_rid_list; + // Note a table may get dropped as you iterate over the list of tables. + // So simply ignore the dropped table. + try { + column_rid_list = systemCatalogPtr->columnRIDs((*it).second, true); + } + catch (IDBExcept& ex) + { + if (ex.errorCode() == ERR_TABLE_NOT_IN_CATALOG) { + continue; + } + else { + throw; + } + } + for (size_t col_num = 0; col_num < column_rid_list.size(); col_num++) { execplan::CalpontSystemCatalog::TableColName tcn = systemCatalogPtr->colName(column_rid_list[col_num].objnum);