diff options
author | monty@mysql.com <> | 2004-03-04 18:16:10 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2004-03-04 18:16:10 +0200 |
commit | b9c4ee353df8eb5257202fac419298b469e624e3 (patch) | |
tree | 23e1c598bde21cc2cb86a6228f23c9965a8633f5 | |
parent | 9c4b9e6df1576fad4fa2cb7e89da2614c282449f (diff) | |
download | mariadb-git-b9c4ee353df8eb5257202fac419298b469e624e3.tar.gz |
Rollback UPDATE/DELETE statements on kill
nsure that rows in a multi-row INSERT DELAYED are inserted atomicly
-rw-r--r-- | mysql-test/mysql-test-run.sh | 9 | ||||
-rw-r--r-- | sql/sql_delete.cc | 9 | ||||
-rw-r--r-- | sql/sql_insert.cc | 11 | ||||
-rw-r--r-- | sql/sql_list.h | 5 | ||||
-rw-r--r-- | sql/sql_update.cc | 4 |
5 files changed, 31 insertions, 7 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 5b39b167d7d..cbb4987040d 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -17,7 +17,14 @@ MY_TZ=GMT-3 TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work # For query_cache test -ulimit -n 1024 +case "$SYSTEM" in + SCO_SV | UnixWare | OpenUNIX ) + # do nothing (Causes strange behavior) + ;; + * ) + ulimit -n 1024 + ;; +esac #++ # Program Definitions diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index c8b85d57c0e..b568166a766 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -167,6 +167,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, else table->file->unlock_row(); // Row failed selection, release lock on it } + if (thd->killed && !error) + error= 1; // Aborted thd->proc_info="end"; end_read_record(&info); free_io_cache(table); // Will not do any harm @@ -366,6 +368,7 @@ bool multi_delete::send_data(List<Item> &values) DBUG_RETURN(0); } + void multi_delete::send_error(uint errcode,const char *err) { DBUG_ENTER("multi_delete::send_error"); @@ -450,15 +453,13 @@ int multi_delete::do_deletes(bool from_send_error) if ((local_error=table->file->delete_row(table->record[0]))) { table->file->print_error(local_error,MYF(0)); - if (transactional_tables) - { - DBUG_RETURN(local_error); - } break; } deleted++; } end_read_record(&info); + if (thd->killed && !local_error) + local_error= 1; if (local_error == -1) // End of file local_error = 0; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index bf3112bdf10..c6dcfd2c7dd 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1236,8 +1236,15 @@ bool delayed_insert::handle_inserts(void) pthread_mutex_lock(&mutex); delete row; - /* Let READ clients do something once in a while */ - if (group_count++ == max_rows) + /* + Let READ clients do something once in a while + We should however not break in the middle of a multi-line insert + if we have binary logging enabled as we don't want other commands + on this table until all entries has been processed + */ + if (group_count++ >= max_rows && (row= rows.head()) && + (!(row->log_query & DELAYED_LOG_BIN && using_bin_log) || + row->query)) { group_count=0; if (stacked_inserts || tables_in_use) // Let these wait a while diff --git a/sql/sql_list.h b/sql/sql_list.h index 102fbe8eb93..370642df2d0 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -322,6 +322,10 @@ class base_ilist first_link->unlink(); // Unlink from list return first_link; } + inline struct ilink *head() + { + return (first != &last) ? first : 0; + } friend class base_list_iterator; }; @@ -353,6 +357,7 @@ public: inline void append(T* a) { base_ilist::append(a); } inline void push_back(T* a) { base_ilist::push_back(a); } inline T* get() { return (T*) base_ilist::get(); } + inline T* head() { return (T*) base_ilist::head(); } #ifndef _lint friend class I_List_iterator<T>; #endif diff --git a/sql/sql_update.cc b/sql/sql_update.cc index d2ccd02051b..0a8530aa141 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -238,6 +238,8 @@ int mysql_update(THD *thd, } } } + if (thd->killed && !error) + error= 1; // Aborted limit= tmp_limit; end_read_record(&info); /* Change select to use tempfile */ @@ -309,6 +311,8 @@ int mysql_update(THD *thd, else table->file->unlock_row(); } + if (thd->killed && !error) + error= 1; // Aborted end_read_record(&info); free_io_cache(table); // If ORDER BY thd->proc_info="end"; |