1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-4109 Error out instead of sending a warning

when a non-existing table is dropped.

This patch accomodates the changes made to server 10.5 as part
of MDEV-11412, where the server now tries to drop the table from
all storage engines when a .frm table does not exist.

We were earlier retuning a warning to the client and setting the
return code to 0. We now instead return ER_NO_SUCH_TABLE_IN_ENGINE
error code to the server if the table does not exist in
ColumnStore.
This commit is contained in:
Gagan Goel
2020-06-25 22:57:05 -04:00
parent 53e144cb90
commit bdf1336ad7
3 changed files with 9 additions and 7 deletions

View File

@ -88,7 +88,7 @@ public:
*/ */
enum ResultCode { NO_ERROR, CREATE_ERROR, ALTER_ERROR, DROP_ERROR, TRUNC_ERROR, enum ResultCode { NO_ERROR, CREATE_ERROR, ALTER_ERROR, DROP_ERROR, TRUNC_ERROR,
TOKENIZATION_ERROR, NOT_ACCEPTING_PACKAGES, PK_NOTNULL_ERROR, WARNING, USER_ERROR, NETWORK_ERROR, PARTITION_WARNING, TOKENIZATION_ERROR, NOT_ACCEPTING_PACKAGES, PK_NOTNULL_ERROR, WARNING, USER_ERROR, NETWORK_ERROR, PARTITION_WARNING,
WARN_NO_PARTITION WARN_NO_PARTITION, DROP_TABLE_NOT_IN_CATALOG_ERROR
}; };
enum DebugLevel /** @brief Debug level type enumeration */ enum DebugLevel /** @brief Debug level type enumeration */

View File

@ -151,12 +151,9 @@ DropTableProcessor::DDLResult DropTableProcessor::processPackage(ddlpackage::Dro
{ {
Message::Args args; Message::Args args;
Message message(1); Message message(1);
args.add("Table dropped with warning "); args.add("Table does not exist in ColumnStore.");
args.add("Table does not exist in columnstore engine.");
args.add("");
args.add("");
message.format(args); message.format(args);
result.result = WARNING; result.result = DROP_TABLE_NOT_IN_CATALOG_ERROR;
result.message = message; result.message = message;
fSessionManager.rolledback(txnID); fSessionManager.rolledback(txnID);
return result; return result;

View File

@ -2128,6 +2128,11 @@ int ProcessDDLStatement(string& ddlStatement, string& schema, const string& tabl
ci->isAlter = false; ci->isAlter = false;
} }
if (b == ddlpackageprocessor::DDLPackageProcessor::DROP_TABLE_NOT_IN_CATALOG_ERROR)
{
return ER_NO_SUCH_TABLE_IN_ENGINE;
}
if ((b != 0) && (b != ddlpackageprocessor::DDLPackageProcessor::WARNING)) if ((b != 0) && (b != ddlpackageprocessor::DDLPackageProcessor::WARNING))
{ {
thd->get_stmt_da()->set_overwrite_status(true); thd->get_stmt_da()->set_overwrite_status(true);
@ -2583,7 +2588,7 @@ int ha_mcs_impl_delete_table_(const char* db, const char* name, cal_connection_i
stmt += ";"; stmt += ";";
int rc = ProcessDDLStatement(stmt, schema, tbl, tid2sid(thd->thread_id), emsg); int rc = ProcessDDLStatement(stmt, schema, tbl, tid2sid(thd->thread_id), emsg);
if (rc != 0) if (rc != 0 && rc != ER_NO_SUCH_TABLE_IN_ENGINE)
{ {
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, emsg.c_str()); push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, emsg.c_str());
} }