diff options
author | Seppo Jaakola <seppo.jaakola@codership.com> | 2013-07-13 13:30:03 +0300 |
---|---|---|
committer | Seppo Jaakola <seppo.jaakola@codership.com> | 2013-07-13 13:30:03 +0300 |
commit | db0cfba638383569b1e30765e2d36e0707bfb930 (patch) | |
tree | d56bf3ec5c5804b2bd15a5eceddb14b5520b3d2e /sql/handler.cc | |
parent | 0a9216835f406947fb4d492616da4cda75e5e113 (diff) | |
parent | a057b504904c3e6ab1e3006c081b4fb23faaf1d4 (diff) | |
download | mariadb-git-db0cfba638383569b1e30765e2d36e0707bfb930.tar.gz |
Merged with lp:maria revision #3766
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 8c8089a61fb..ec30057758c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2012, Monty Program Ab. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. + Copyright (c) 2009, 2013, Monty Program Ab. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,6 +40,7 @@ #include "probes_mysql.h" #include <mysql/psi/mysql_table.h> #include "debug_sync.h" // DEBUG_SYNC +#include "sql_audit.h" #ifdef WITH_PARTITION_STORAGE_ENGINE #include "ha_partition.h" @@ -275,7 +276,8 @@ handler *get_ha_partition(partition_info *part_info) } else { - my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(ha_partition))); + my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), + static_cast<int>(sizeof(ha_partition))); } DBUG_RETURN(((handler*) partition)); } @@ -2260,7 +2262,7 @@ handle_condition(THD *, { *cond_hdl= NULL; /* Grab the error message */ - strmake(buff, msg, sizeof(buff)-1); + strmake_buf(buff, msg); return TRUE; } @@ -3778,6 +3780,9 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt) } if ((error= check(thd, check_opt))) return error; + /* Skip updating frm version if not main handler. */ + if (table->file != this) + return error; return update_frm_version(table); } @@ -4030,7 +4035,6 @@ int handler::ha_delete_table(const char *name) { mark_trx_read_write(); - return delete_table(name); } @@ -4063,8 +4067,11 @@ int handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info) { mark_trx_read_write(); - - return create(name, form, info); + int error= create(name, form, info); + if (!error && + !(info->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER))) + mysql_audit_create_table(form); + return error; } @@ -5575,7 +5582,11 @@ int handler::ha_external_lock(THD *thd, int lock_type) { error= external_lock(thd, lock_type); }) if (error == 0) + { cached_table_flags= table_flags(); + if (table_share->tmp_table == NO_TMP_TABLE) + mysql_audit_external_lock(thd, table_share, lock_type); + } if (MYSQL_HANDLER_RDLOCK_DONE_ENABLED() || MYSQL_HANDLER_WRLOCK_DONE_ENABLED() || @@ -5630,6 +5641,8 @@ int handler::ha_write_row(uchar *buf) Log_func *log_func= Write_rows_log_event::binlog_row_logging_function; DBUG_ENTER("handler::ha_write_row"); DEBUG_SYNC_C("ha_write_row_start"); + DBUG_EXECUTE_IF("inject_error_ha_write_row", + DBUG_RETURN(HA_ERR_INTERNAL_ERROR); ); MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str); mark_trx_read_write(); @@ -5660,6 +5673,7 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data) (and the old record is in record[1]). */ DBUG_ASSERT(new_data == table->record[0]); + DBUG_ASSERT(old_data == table->record[1]); MYSQL_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str); mark_trx_read_write(); @@ -5681,6 +5695,13 @@ int handler::ha_delete_row(const uchar *buf) { int error; Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function; + /* + Normally table->record[0] is used, but sometimes table->record[1] is used. + */ + DBUG_ASSERT(buf == table->record[0] || + buf == table->record[1]); + DBUG_EXECUTE_IF("inject_error_ha_delete_row", + return HA_ERR_INTERNAL_ERROR; ); MYSQL_DELETE_ROW_START(table_share->db.str, table_share->table_name.str); mark_trx_read_write(); |