diff options
author | unknown <monty@donna.mysql.com> | 2000-11-24 01:51:18 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-11-24 01:51:18 +0200 |
commit | e94b4ebf2bc64710336597445529887640908cc4 (patch) | |
tree | f7a94e9f7992838a96724db08a38f94bd9d50e27 /sql | |
parent | 681aeb58e6f58de62134c24630bba5de0f49705d (diff) | |
download | mariadb-git-e94b4ebf2bc64710336597445529887640908cc4.tar.gz |
All statements are now run in a sub transaction
Give warning if we are using non transactional tables and do ROLLBACK
Porting of crash-me and benchmarks to FrontBase
Docs/manual.texi:
Updates for 3.23.29
include/mysqld_error.h:
New error messages
sql-bench/Data/ATIS/fconnection.txt:
Name change because 'connection' was a reserved word in FrontBase
sql-bench/bench-init.pl.sh:
Port to FrontBase
sql-bench/crash-me.sh:
Port to FrontBase
sql-bench/server-cfg.sh:
Port to FrontBase
sql-bench/test-ATIS.sh:
Port to FrontBase
sql-bench/test-alter-table.sh:
Port to FrontBase
sql-bench/test-big-tables.sh:
Port to FrontBase
sql-bench/test-connect.sh:
Port to FrontBase
sql-bench/test-create.sh:
Port to FrontBase
sql-bench/test-insert.sh:
Port to FrontBase
sql-bench/test-select.sh:
Port to FrontBase
sql-bench/test-wisconsin.sh:
Port to FrontBase
sql/ha_berkeley.cc:
All statements are now run in a sub transaction
sql/ha_berkeley.h:
All statements are now run in a sub transaction
sql/handler.cc:
All statements are now run in a sub transaction
sql/handler.h:
All statements are now run in a sub transaction
sql/mysql_priv.h:
Moved QUERY_NO.. flags to unique numbers
sql/mysqld.cc:
All statements are now run in a sub transaction
sql/net_pkg.cc:
Added send_warning
sql/share/czech/errmsg.sys:
New error messages
sql/share/czech/errmsg.txt:
New error messages
sql/share/danish/errmsg.sys:
New error messages
sql/share/danish/errmsg.txt:
New error messages
sql/share/dutch/errmsg.sys:
New error messages
sql/share/dutch/errmsg.txt:
New error messages
sql/share/english/errmsg.sys:
New error messages
sql/share/english/errmsg.txt:
New error messages
sql/share/estonian/errmsg.sys:
New error messages
sql/share/estonian/errmsg.txt:
New error messages
sql/share/french/errmsg.sys:
New error messages
sql/share/french/errmsg.txt:
New error messages
sql/share/german/errmsg.sys:
New error messages
sql/share/german/errmsg.txt:
New error messages
sql/share/greek/errmsg.sys:
New error messages
sql/share/greek/errmsg.txt:
New error messages
sql/share/hungarian/errmsg.sys:
New error messages
sql/share/hungarian/errmsg.txt:
New error messages
sql/share/italian/errmsg.sys:
New error messages
sql/share/italian/errmsg.txt:
New error messages
sql/share/japanese/errmsg.sys:
New error messages
sql/share/japanese/errmsg.txt:
New error messages
sql/share/korean/errmsg.sys:
New error messages
sql/share/korean/errmsg.txt:
New error messages
sql/share/norwegian-ny/errmsg.txt:
New error messages
sql/share/norwegian/errmsg.txt:
New error messages
sql/share/polish/errmsg.sys:
New error messages
sql/share/polish/errmsg.txt:
New error messages
sql/share/portuguese/errmsg.sys:
New error messages
sql/share/portuguese/errmsg.txt:
New error messages
sql/share/romanian/errmsg.txt:
New error messages
sql/share/russian/errmsg.sys:
New error messages
sql/share/russian/errmsg.txt:
New error messages
sql/share/slovak/errmsg.sys:
New error messages
sql/share/slovak/errmsg.txt:
New error messages
sql/share/spanish/errmsg.sys:
New error messages
sql/share/spanish/errmsg.txt:
New error messages
sql/share/swedish/errmsg.OLD:
New error messages
sql/share/swedish/errmsg.sys:
New error messages
sql/share/swedish/errmsg.txt:
New error messages
sql/slave.cc:
All statements are now run in a sub transaction
sql/sql_class.cc:
All statements are now run in a sub transaction
sql/sql_class.h:
All statements are now run in a sub transaction
sql/sql_delete.cc:
Remember if we are using a non transactional table
sql/sql_insert.cc:
Remember if we are using a non transactional table
sql/sql_load.cc:
Remember if we are using a non transactional table
sql/sql_parse.cc:
All statements are now run in a sub transaction
sql/sql_select.cc:
Remember if we are using a non transactional table
sql/sql_table.cc:
All statements are now run in a sub transaction
sql/sql_update.cc:
All statements are now run in a sub transaction
sql/sql_yacc.yy:
All statements are now run in a sub transaction
Diffstat (limited to 'sql')
58 files changed, 201 insertions, 89 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index db5bff0c7b0..8545f5015bd 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -168,25 +168,23 @@ bool berkeley_flush_logs() } -int berkeley_commit(THD *thd) +int berkeley_commit(THD *thd, void *trans) { DBUG_ENTER("berkeley_commit"); DBUG_PRINT("trans",("ending transaction")); - int error=txn_commit((DB_TXN*) thd->transaction.bdb_tid,0); + int error=txn_commit((DB_TXN*) trans,0); #ifndef DBUG_OFF if (error) DBUG_PRINT("error",("error: %d",error)); #endif - thd->transaction.bdb_tid=0; DBUG_RETURN(error); } -int berkeley_rollback(THD *thd) +int berkeley_rollback(THD *thd, void *trans) { DBUG_ENTER("berkeley_rollback"); DBUG_PRINT("trans",("aborting transaction")); - int error=txn_abort((DB_TXN*) thd->transaction.bdb_tid); - thd->transaction.bdb_tid=0; + int error=txn_abort((DB_TXN*) trans); DBUG_RETURN(error); } @@ -1337,6 +1335,10 @@ int ha_berkeley::reset(void) /* As MySQL will execute an external lock for every new table it uses we can use this to start the transactions. + If we are in auto_commit mode we just need to start a transaction + for the statement to be able to rollback the statement. + If not, we have to start a master transaction if there doesn't exist + one from before. */ int ha_berkeley::external_lock(THD *thd, int lock_type) @@ -1345,16 +1347,34 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) DBUG_ENTER("ha_berkeley::external_lock"); if (lock_type != F_UNLCK) { - if (!thd->transaction.bdb_lock_count++ && !thd->transaction.bdb_tid) + if (!thd->transaction.bdb_lock_count++) { - /* Found first lock, start transaction */ - DBUG_PRINT("trans",("starting transaction")); - if ((error=txn_begin(db_env, 0, - (DB_TXN**) &thd->transaction.bdb_tid, + /* First table lock, start transaction */ + if (!(thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN)) && + !thd->transaction.all.bdb_tid) + { + /* We have to start a master transaction */ + DBUG_PRINT("trans",("starting transaction")); + if ((error=txn_begin(db_env, 0, + (DB_TXN**) &thd->transaction.all.bdb_tid, + 0))) + { + thd->transaction.bdb_lock_count--; // We didn't get the lock + DBUG_RETURN(error); + } + } + DBUG_PRINT("trans",("starting transaction for statement")); + if ((error=txn_begin(db_env, + (DB_TXN*) thd->transaction.all.bdb_tid, + (DB_TXN**) &thd->transaction.stmt.bdb_tid, 0))) - thd->transaction.bdb_lock_count--; + { + /* We leave the possible master transaction open */ + thd->transaction.bdb_lock_count--; // We didn't get the lock + DBUG_RETURN(error); + } } - transaction= (DB_TXN*) thd->transaction.bdb_tid; + transaction= (DB_TXN*) thd->transaction.stmt.bdb_tid; } else { @@ -1371,23 +1391,21 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) current_row.data=0; if (!--thd->transaction.bdb_lock_count) { - if (thd->transaction.bdb_tid && (thd->options & OPTION_AUTO_COMMIT) - && !(thd->options & OPTION_BEGIN)) + if (thd->transaction.stmt.bdb_tid) { /* F_UNLOCK is done without a transaction commit / rollback. - This happens if the thread didn't update any rows or if - something went wrong during an update. - We can in this case silenty abort the transaction. + This happens if the thread didn't update any rows + We must in this case commit the work to keep the row locks */ - DBUG_PRINT("trans",("aborting transaction")); - error=txn_abort((DB_TXN*) thd->transaction.bdb_tid); - thd->transaction.bdb_tid=0; + DBUG_PRINT("trans",("commiting non-updating transaction")); + error=txn_commit((DB_TXN*) thd->transaction.stmt.bdb_tid,0); + thd->transaction.stmt.bdb_tid=0; } } } DBUG_RETURN(error); -} +} THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to, diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 1d1de613ce0..3cfcab82ecf 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -156,5 +156,5 @@ extern TYPELIB berkeley_lock_typelib; bool berkeley_init(void); bool berkeley_end(void); bool berkeley_flush_logs(void); -int berkeley_commit(THD *thd); -int berkeley_rollback(THD *thd); +int berkeley_commit(THD *thd, void *trans); +int berkeley_rollback(THD *thd, void *trans); diff --git a/sql/handler.cc b/sql/handler.cc index 8987bed4157..6f3d243394e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -174,78 +174,83 @@ int ha_panic(enum ha_panic_function flag) } /* ha_panic */ +/* + This is used to commit or rollback a single statement depending + on the value of error +*/ + int ha_autocommit_or_rollback(THD *thd, int error) { DBUG_ENTER("ha_autocommit_or_rollback"); -#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) - if ((thd->options & OPTION_AUTO_COMMIT) && !(thd->options & OPTION_BEGIN) - && !thd->locked_tables) +#ifdef USING_TRANSACTIONS + if (!(thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN)) && + !thd->locked_tables) { if (!error) { - if (ha_commit(thd)) + if (ha_commit_stmt(thd)) error=1; - } + } else - (void) ha_rollback(thd); + (void) ha_rollback_stmt(thd); } #endif DBUG_RETURN(error); } -int ha_commit(THD *thd) + +int ha_commit_trans(THD *thd, THD_TRANS* trans) { int error=0; DBUG_ENTER("ha_commit"); #ifdef HAVE_BERKELEY_DB - if (thd->transaction.bdb_tid) + if (trans->bdb_tid) { - int error=berkeley_commit(thd); - if (error) + if ((error=berkeley_commit(thd,trans->bdb_tid))) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); error=1; } + trans->bdb_tid=0; } #endif #ifdef HAVE_INNOBASE_DB - if (thd->transaction.innobase_tid) { - int error=innobase_commit(thd); - if (error) + if ((error=innobase_commit(thd,trans->innobase_tid)) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); error=1; } + trans->innobase_tid=0; } #endif DBUG_RETURN(error); } -int ha_rollback(THD *thd) +int ha_rollback_trans(THD *thd, THD_TRANS *trans) { int error=0; DBUG_ENTER("ha_rollback"); #ifdef HAVE_BERKELEY_DB - if (thd->transaction.bdb_tid) + if (trans->bdb_tid) { - int error=berkeley_rollback(thd); - if (error) + if ((error=berkeley_rollback(thd, trans->bdb_tid))) { my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), error); error=1; } + trans->bdb_tid=0; } #endif #ifdef HAVE_INNOBASE_DB - if (thd->transaction.innobase_tid) + if (trans->innobase_tid) { - int error=innobase_rollback(thd); - if (error) + if ((error=innobase_rollback(thd))) { my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), error); error=1; } + trans->innobase_tid=0; } #endif DBUG_RETURN(error); diff --git a/sql/handler.h b/sql/handler.h index bdc58ee7356..259a3ad6405 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -25,6 +25,10 @@ #define NO_HASH /* Not yet implemented */ #endif +#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB) +#define USING_TRANSACTIONS +#endif + // the following is for checking tables #define HA_ADMIN_ALREADY_DONE 1 @@ -114,6 +118,12 @@ enum row_type { ROW_TYPE_DEFAULT, ROW_TYPE_FIXED, ROW_TYPE_DYNAMIC, #define HA_CREATE_USED_AUTO 1 #define HA_CREATE_USED_RAID 2 +typedef struct st_thd_trans { + void *bdb_tid; + void *innobase_tid; + void *gemeni_tid; +} THD_TRANS; + typedef struct st_ha_create_information { ulong table_options; @@ -294,6 +304,12 @@ public: extern const char *ha_row_type[]; extern TYPELIB ha_table_typelib; + /* Wrapper functions */ +#define ha_commit_stmt(thd) (ha_commit_trans((thd), &((thd)->transaction.stmt))) +#define ha_rollback_stmt(thd) (ha_rollback_trans((thd), &((thd)->transaction.stmt))) +#define ha_commit(thd) (ha_commit_trans((thd), &((thd)->transaction.all))) +#define ha_rollback(thd) (ha_rollback_trans((thd), &((thd)->transaction.all))) + handler *get_new_handler(TABLE *table, enum db_type db_type); my_off_t ha_get_ptr(byte *ptr, uint pack_length); void ha_store_ptr(byte *buff, uint pack_length, my_off_t pos); @@ -304,8 +320,8 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info, bool update_create_info); int ha_delete_table(enum db_type db_type, const char *path); void ha_key_cache(void); -int ha_commit(THD *thd); -int ha_rollback(THD *thd); +int ha_commit_trans(THD *thd, THD_TRANS *trans); +int ha_rollback_trans(THD *thd, THD_TRANS *trans); int ha_autocommit_or_rollback(THD *thd, int error); bool ha_flush_logs(void); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index eca9eca56c4..10e470ffc78 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -134,7 +134,7 @@ void kill_one_thread(THD *thd, ulong id); #define TEST_NO_EXTRA 128 #define TEST_CORE_ON_SIGNAL 256 /* Give core if signal */ -/* options for select set by the yacc parser */ +/* options for select set by the yacc parser (stored in lex->options) */ #define SELECT_DISTINCT 1 #define SELECT_STRAIGHT_JOIN 2 #define SELECT_DESCRIBE 4 @@ -155,14 +155,17 @@ void kill_one_thread(THD *thd, ulong id); #define OPTION_SAFE_UPDATES OPTION_ANSI_MODE*2 #define OPTION_BUFFER_RESULT OPTION_SAFE_UPDATES*2 #define OPTION_BIN_LOG OPTION_BUFFER_RESULT*2 -#define OPTION_AUTO_COMMIT OPTION_BIN_LOG*2 -#define OPTION_BEGIN OPTION_AUTO_COMMIT*2 +#define OPTION_NOT_AUTO_COMMIT OPTION_BIN_LOG*2 +#define OPTION_BEGIN OPTION_NOT_AUTO_COMMIT*2 #define OPTION_QUICK OPTION_BEGIN*2 #define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2 +/* Set if we are updating a non-transaction safe table */ +#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_QUOTE_SHOW_CREATE*2 + /* The following is set when parsing the query */ -#define OPTION_NO_INDEX_USED OPTION_QUOTE_SHOW_CREATE*2 -#define OPTION_NO_GOOD_INDEX_USED OPTION_NO_INDEX_USED*2 +#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2 +#define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2 #define RAID_BLOCK_SIZE 1024 @@ -255,6 +258,7 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* table_list, /* net_pkg.c */ void send_error(NET *net,uint sql_errno=0, const char *err=0); +void send_warning(NET *net, uint sql_errno, const char *err=0); void net_printf(NET *net,uint sql_errno, ...); void send_ok(NET *net,ha_rows affected_rows=0L,ulonglong id=0L, const char *info=0); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ef0d9050097..316b97f5c52 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -192,8 +192,7 @@ uint test_flags, select_errors=0, dropping_tables=0,ha_open_options=0; uint volatile thread_count=0, thread_running=0, kill_cached_threads=0, wake_thread=0, global_read_lock=0; ulong thd_startup_options=(OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL | - OPTION_BIN_LOG | OPTION_AUTO_COMMIT | - OPTION_QUOTE_SHOW_CREATE ); + OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE ); uint protocol_version=PROTOCOL_VERSION; ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size, max_join_size,join_buff_size,tmp_table_size,thread_stack, diff --git a/sql/net_pkg.cc b/sql/net_pkg.cc index d412b71b363..590168930fd 100644 --- a/sql/net_pkg.cc +++ b/sql/net_pkg.cc @@ -73,6 +73,18 @@ void send_error(NET *net, uint sql_errno, const char *err) DBUG_VOID_RETURN; } +/* + At some point we need to be able to distinguish between warnings and + errors; The following function will help make this easier. +*/ + +void send_warning(NET *net, uint sql_errno, const char *err) +{ + DBUG_ENTER("send_warning"); + send_error(net,sql_errno,err); + DBUG_VOID_RETURN; +} + /** ** write error package and flush to client ** It's a little too low level, but I don't want to allow another buffer diff --git a/sql/share/czech/errmsg.sys b/sql/share/czech/errmsg.sys Binary files differindex 39221d1ab69..8fb8d9630c2 100644 --- a/sql/share/czech/errmsg.sys +++ b/sql/share/czech/errmsg.sys diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 2a61de73ba1..ae0369e3f17 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -211,3 +211,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/danish/errmsg.sys b/sql/share/danish/errmsg.sys Binary files differindex 88d1508e210..d55c0ada743 100644 --- a/sql/share/danish/errmsg.sys +++ b/sql/share/danish/errmsg.sys diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index e42b9d0e854..b1faff2fffb 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -200,3 +200,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/dutch/errmsg.sys b/sql/share/dutch/errmsg.sys Binary files differindex 92a5833e2c6..7a35b102cf1 100644 --- a/sql/share/dutch/errmsg.sys +++ b/sql/share/dutch/errmsg.sys diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 8b5c6c0e23e..18029c32a97 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -197,3 +197,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/english/errmsg.sys b/sql/share/english/errmsg.sys Binary files differindex 65496eae040..903f2958129 100644 --- a/sql/share/english/errmsg.sys +++ b/sql/share/english/errmsg.sys diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 67357b2c054..6395180f4fd 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -197,3 +197,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/estonian/errmsg.sys b/sql/share/estonian/errmsg.sys Binary files differindex 42015a12c22..fe9b221ce58 100644 --- a/sql/share/estonian/errmsg.sys +++ b/sql/share/estonian/errmsg.sys diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 953c435887d..b90b5d205ec 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -201,3 +201,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/french/errmsg.sys b/sql/share/french/errmsg.sys Binary files differindex e8f430cdf3e..75c1c8328f1 100644 --- a/sql/share/french/errmsg.sys +++ b/sql/share/french/errmsg.sys diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index a8b5da897c6..e5d90a93733 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -197,3 +197,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/german/errmsg.sys b/sql/share/german/errmsg.sys Binary files differindex 7bfaa5b5b98..46a68a5ef7f 100644 --- a/sql/share/german/errmsg.sys +++ b/sql/share/german/errmsg.sys diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 19b91670b8f..4ebd1ffe751 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -200,3 +200,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/greek/errmsg.sys b/sql/share/greek/errmsg.sys Binary files differindex b1eaca8eaf4..bed966bdab4 100644 --- a/sql/share/greek/errmsg.sys +++ b/sql/share/greek/errmsg.sys diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 3a1e2fb8c6f..d5ff3d1253f 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -197,3 +197,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/hungarian/errmsg.sys b/sql/share/hungarian/errmsg.sys Binary files differindex 6d990595420..da976080e27 100644 --- a/sql/share/hungarian/errmsg.sys +++ b/sql/share/hungarian/errmsg.sys diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index f69e8ea4ce2..f864fe7ff0d 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -199,3 +199,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/italian/errmsg.sys b/sql/share/italian/errmsg.sys Binary files differindex a3f51791820..045e64ce093 100644 --- a/sql/share/italian/errmsg.sys +++ b/sql/share/italian/errmsg.sys diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 8fd4358784e..a88df6dcc0e 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -197,3 +197,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/japanese/errmsg.sys b/sql/share/japanese/errmsg.sys Binary files differindex 78fe9fba669..41618a4ffea 100644 --- a/sql/share/japanese/errmsg.sys +++ b/sql/share/japanese/errmsg.sys diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 71335336cd3..c2650178002 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -199,3 +199,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/korean/errmsg.sys b/sql/share/korean/errmsg.sys Binary files differindex da8df0b02aa..c94649378f4 100644 --- a/sql/share/korean/errmsg.sys +++ b/sql/share/korean/errmsg.sys diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index f884a1b13f2..e49eead2210 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -197,3 +197,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 8de66328a05..0dd18ba9ecb 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -199,3 +199,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index e5554e0bb43..eb12dafbd6d 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -199,3 +199,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/polish/errmsg.sys b/sql/share/polish/errmsg.sys Binary files differindex 547e5a5d60d..551ff4d81a6 100644 --- a/sql/share/polish/errmsg.sys +++ b/sql/share/polish/errmsg.sys diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 4338fc49971..84991513129 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -201,3 +201,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/portuguese/errmsg.sys b/sql/share/portuguese/errmsg.sys Binary files differindex 35b3ba1d3cd..5a6e038c1ce 100644 --- a/sql/share/portuguese/errmsg.sys +++ b/sql/share/portuguese/errmsg.sys diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index ea9346be023..dbb881f21d5 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -197,3 +197,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 7e301bc9b4d..4b48d4347a9 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -201,3 +201,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/russian/errmsg.sys b/sql/share/russian/errmsg.sys Binary files differindex 3d32c61bd35..e2497d5e356 100644 --- a/sql/share/russian/errmsg.sys +++ b/sql/share/russian/errmsg.sys diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 79f113030e5..9f9d34b9d05 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -200,3 +200,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/slovak/errmsg.sys b/sql/share/slovak/errmsg.sys Binary files differindex d2a4c792794..8e0c6ab4b79 100644 --- a/sql/share/slovak/errmsg.sys +++ b/sql/share/slovak/errmsg.sys diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 0dbac3a4d98..1ca1632bd57 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -205,3 +205,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/spanish/errmsg.sys b/sql/share/spanish/errmsg.sys Binary files differindex ebc069aefbd..bb301f89d3e 100644 --- a/sql/share/spanish/errmsg.sys +++ b/sql/share/spanish/errmsg.sys diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 9393238c365..7a76c438bad 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -198,3 +198,4 @@ "Unknown system variable '%-.64'", "Table '%-.64s' is marked as crashed and should be repaired", "Table '%-.64s' is marked as crashed and last (automatic?) repair failed", +"Warning: Some non-transactional changed tables couldn't be rolled back", diff --git a/sql/share/swedish/errmsg.OLD b/sql/share/swedish/errmsg.OLD index 6f315fb456b..f1a8062e390 100644 --- a/sql/share/swedish/errmsg.OLD +++ b/sql/share/swedish/errmsg.OLD @@ -195,7 +195,7 @@ "Hittar inte ett FULLTEXT index i kolumnlistan", "Kan inte exekvera kommandot emedan du har en låst tabell eller an aktiv transaktion", "Okänd system variabel '%-.64'", -#ER_CRASHED_ON_USAGE "Tabell '%-.64s' är crashad och bör repareras med REPAIR TABLE", -#ER_CRASHED_ON_REPAIR "Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades", +#ER_WARNING_NOT_COMPLETE_ROLLBACK +"Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK", diff --git a/sql/share/swedish/errmsg.sys b/sql/share/swedish/errmsg.sys Binary files differindex cf773e61228..011968008e8 100644 --- a/sql/share/swedish/errmsg.sys +++ b/sql/share/swedish/errmsg.sys diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index eb4ded6cfb0..78dfa51a806 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -197,3 +197,4 @@ "Okänd system variabel '%-.64'", "Tabell '%-.64s' är crashad och bör repareras med REPAIR TABLE", "Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades", +"Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK", diff --git a/sql/slave.cc b/sql/slave.cc index 87ce4b24e8a..174d3f15c5b 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -548,8 +548,7 @@ static int init_slave_thread(THD* thd) thd->master_access= ~0; thd->priv_user = 0; thd->slave_thread = 1; - thd->options = (((opt_log_slave_updates) ? OPTION_BIN_LOG:0) - | OPTION_AUTO_COMMIT | OPTION_AUTO_IS_NULL) ; + thd->options = (((opt_log_slave_updates) ? OPTION_BIN_LOG:0) | OPTION_AUTO_IS_NULL) ; thd->system_thread = 1; thd->client_capabilities = CLIENT_LOCAL_FILES; slave_real_id=thd->real_id=pthread_self(); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c7d50ee182e..696c111c01a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -79,8 +79,8 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), bootstrap(0),in_lock_tables(0), global_read_lock(0) { - host=user=db=query=ip=0; proc_info="login"; + host=user=db=query=ip=0; locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password= query_start_used=0; query_length=col_access=0; @@ -117,13 +117,12 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), ull=0; system_thread=0; bzero((char*) &mem_root,sizeof(mem_root)); -#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB) +#ifdef USING_TRANSACTIONS + bzero((char*) &transaction,sizeof(transaction)); if (open_cached_file(&transaction.trans_log, mysql_tmpdir,LOG_PREFIX,0,MYF(MY_WME))) killed=1; - transaction.bdb_lock_count=0; #endif - transaction.bdb_tid=0; #ifdef __WIN__ real_id = 0 ; @@ -146,7 +145,7 @@ THD::~THD() close_thread_tables(this); } close_temporary_tables(this); -#if defined(HAVE_BERKELEY_DB) || defined(HAVE_INNOBASE_DB) || defined(HAVE_GEMENI_DB) +#ifdef USING_TRANSACTIONS close_cached_file(&transaction.trans_log); #endif if (global_read_lock) diff --git a/sql/sql_class.h b/sql/sql_class.h index af5dcc65688..4003b057c06 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -244,7 +244,8 @@ public: delayed_insert *di; struct st_transactions { IO_CACHE trans_log; - void *bdb_tid; + THD_TRANS all; /* Trans since BEGIN WORK */ + THD_TRANS stmt; /* Trans for current statement */ uint bdb_lock_count; } transaction; Item *free_list; @@ -293,7 +294,12 @@ public: } return last_insert_id; } - inline bool active_transaction() { return transaction.bdb_tid != 0; } + inline bool active_transaction() + { + return (transaction.all.bdb_tid != 0 || + transaction.all.innobase_tid != 0 || + transaction.all.gemeni_tid != 0); + } inline gptr alloc(unsigned int size) { return alloc_root(&mem_root,size); } inline gptr calloc(unsigned int size) { diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index c01ea67424f..1159fc56ee6 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -34,7 +34,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, thd->proc_info="generate_table"; - if(global_read_lock) + if (global_read_lock) { if(thd->global_read_lock) { @@ -141,8 +141,8 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, use_generate_table= (!using_limit && !conds && !(specialflag & (SPECIAL_NO_NEW_FUNC | SPECIAL_SAFE_MODE)) && - (thd->options & OPTION_AUTO_COMMIT) && - !(thd->options & OPTION_BEGIN)); + !(thd->options & + (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN))); if (use_generate_table && ! thd->open_tables) { error=generate_table(thd,table_list,(TABLE*) 0); @@ -175,7 +175,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, /* If running in safe sql mode, don't allow updates without keys */ if (!table->quick_keys) { - thd->lex.options|=OPTION_NO_INDEX_USED; + thd->lex.options|=QUERY_NO_INDEX_USED; if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR) { delete select; @@ -223,6 +223,8 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit, Query_log_event qinfo(thd, thd->query); mysql_bin_log.write(&qinfo); } + if (!table->file->has_transactions()) + thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; } if (ha_autocommit_or_rollback(thd,error >= 0)) error=1; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 25ca7d76e03..b1ae918a791 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -222,7 +222,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, break; } } - if (lock_type == TL_WRITE_DELAYED) + if (lock_type == TL_WRITE_DELAYED && ! table->file->has_transactions()) { error=write_delayed(thd,table,duplic,query, thd->query_length, log_on); query=0; @@ -262,6 +262,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, Query_log_event qinfo(thd, thd->query); mysql_bin_log.write(&qinfo); } + if (!table->file->has_transactions()) + thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; } error=ha_autocommit_or_rollback(thd,error); if (thd->lock) @@ -282,7 +284,8 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields, if (values_list.elements == 1 && (!(thd->options & OPTION_WARNINGS) || !thd->cuted_fields)) send_ok(&thd->net,info.copied+info.deleted,id); - else { + else + { char buff[160]; if (duplic == DUP_IGNORE) sprintf(buff,ER(ER_INSERT_INFO),info.records,info.records-info.copied, diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 9bf3346e61d..de6d006a80e 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -241,6 +241,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, send_ok(&thd->net,info.copied+info.deleted,0L,name); mysql_update_log.write(thd,thd->query,thd->query_length); + if (!table->file->has_transactions()) + thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; if (!read_file_from_client) { ex->skip_lines = save_skip_lines; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8e9584bc9d7..195a7a4f525 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -73,13 +73,12 @@ static void init_signals(void) static inline bool end_active_trans(THD *thd) { - if (!(thd->options & OPTION_AUTO_COMMIT) || - (thd->options & OPTION_BEGIN)) + if (thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN)) { + thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); + thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (ha_commit(thd)) return 1; - thd->options&= ~(ulong) (OPTION_BEGIN); - thd->server_status&= ~SERVER_STATUS_IN_TRANS; } return 0; } @@ -576,6 +575,7 @@ bool do_command(THD *thd) thread_running++; VOID(pthread_mutex_unlock(&LOCK_thread_count)); thd->set_time(); + thd->lex.options=0; // We store status here switch(command) { case COM_INIT_DB: if (!mysql_change_db(thd,packet+1)) @@ -827,7 +827,7 @@ bool do_command(THD *thd) { if ((ulong) (thd->start_time - thd->time_after_lock) > long_query_time || ((thd->lex.options & - (OPTION_NO_INDEX_USED | OPTION_NO_GOOD_INDEX_USED)) && + (QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED)) && (specialflag & SPECIAL_LONG_LOG_FORMAT))) { long_query_count++; @@ -1560,12 +1560,12 @@ mysql_execute_command(void) thd->options,(long) thd->default_select_limit)); /* Check if auto_commit mode changed */ - if ((org_options ^ lex->options) & OPTION_AUTO_COMMIT) + if ((org_options ^ lex->options) & OPTION_NOT_AUTO_COMMIT) { - if (!(org_options & OPTION_AUTO_COMMIT)) + if ((org_options & OPTION_NOT_AUTO_COMMIT)) { /* We changed to auto_commit mode */ - thd->options&= ~(ulong) (OPTION_BEGIN); + thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); thd->server_status|= SERVER_STATUS_AUTOCOMMIT; if (ha_commit(thd)) { @@ -1750,7 +1750,7 @@ mysql_execute_command(void) even if there is a problem with the OPTION_AUTO_COMMIT flag (Which of course should never happen...) */ - thd->options&= ~(ulong) (OPTION_BEGIN); + thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (!ha_commit(thd)) send_ok(&thd->net); @@ -1758,12 +1758,17 @@ mysql_execute_command(void) res= -1; break; case SQLCOM_ROLLBACK: - thd->options&= ~(ulong) (OPTION_BEGIN); thd->server_status&= ~SERVER_STATUS_IN_TRANS; if (!ha_rollback(thd)) - send_ok(&thd->net); + { + if (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) + send_warning(&thd->net,ER_WARNING_NOT_COMPLETE_ROLLBACK,0); + else + send_ok(&thd->net); + } else res= -1; + thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE); break; default: /* Impossible */ send_ok(&thd->net); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 60f6a6299cf..7e668d60876 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2420,7 +2420,7 @@ make_join_readinfo(JOIN *join,uint options) /* These init changes read_record */ if (tab->use_quick == 2) { - join->thd->lex.options|=OPTION_NO_GOOD_INDEX_USED; + join->thd->lex.options|=QUERY_NO_GOOD_INDEX_USED; tab->read_first_record= join_init_quick_read_record; statistic_increment(select_range_check_count, &LOCK_status); } @@ -2435,7 +2435,7 @@ make_join_readinfo(JOIN *join,uint options) } else { - join->thd->lex.options|=OPTION_NO_INDEX_USED; + join->thd->lex.options|=QUERY_NO_INDEX_USED; statistic_increment(select_scan_count, &LOCK_status); } } @@ -2447,7 +2447,7 @@ make_join_readinfo(JOIN *join,uint options) } else { - join->thd->lex.options|=OPTION_NO_INDEX_USED; + join->thd->lex.options|=QUERY_NO_INDEX_USED; statistic_increment(select_full_join_count, &LOCK_status); } } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index d1be84b4143..2c59f4b3482 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1543,7 +1543,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, goto err; } } - if ((error = ha_commit(thd))) + /* The ALTER TABLE is always in it's own transaction */ + error = ha_commit_stmt(thd); + if (ha_commit(thd)) + error=1; + if (error) { VOID(pthread_cond_broadcast(&COND_refresh)); VOID(pthread_mutex_unlock(&LOCK_open)); @@ -1666,7 +1670,16 @@ copy_data_between_tables(TABLE *from,TABLE *to, } if (to->file->activate_all_index(thd)) error=1; - if (ha_commit(thd) || to->file->external_lock(thd,F_UNLCK)) + + /* + Ensure that the new table is saved properly to disk so that we + can do a rename + */ + if (ha_commit_stmt(thd)) + error=1; + if (ha_commit(thd)) + error=1; + if (to->file->external_lock(thd,F_UNLCK)) error=1; err: free_io_cache(from); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 709702142e1..25e990e9f62 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -102,7 +102,7 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields, /* If running in safe sql mode, don't allow updates without keys */ if (!table->quick_keys) { - thd->lex.options|=OPTION_NO_INDEX_USED; + thd->lex.options|=QUERY_NO_INDEX_USED; if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR) { delete select; @@ -245,6 +245,8 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields, Query_log_event qinfo(thd, thd->query); mysql_bin_log.write(&qinfo); } + if (!table->file->has_transactions()) + thd->options|=OPTION_STATUS_NO_TRANS_UPDATE; } if (ha_autocommit_or_rollback(thd, error >= 0)) error=1; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index bfa35750f8a..6735498b8f2 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1943,7 +1943,7 @@ opt_into: */ drop: - DROP TABLE_SYM if_exists table_list + DROP TABLE_SYM if_exists table_list opt_restrict { Lex->sql_command = SQLCOM_DROP_TABLE; Lex->drop_if_exists = $3; @@ -2573,6 +2573,13 @@ option_value: else Lex->options|= $1; } + | AUTOCOMMIT equal NUM + { + if (atoi($3.str) != 0) /* Test NOT AUTOCOMMIT */ + Lex->options&= ~(OPTION_NOT_AUTO_COMMIT); + else + Lex->options|= OPTION_NOT_AUTO_COMMIT; + } | SQL_SELECT_LIMIT equal ULONG_NUM { Lex->select_limit= $3; @@ -2656,7 +2663,6 @@ text_or_password: set_option: SQL_BIG_TABLES { $$= OPTION_BIG_TABLES; } - | AUTOCOMMIT { $$= OPTION_AUTO_COMMIT; } | SQL_BIG_SELECTS { $$= OPTION_BIG_SELECTS; } | SQL_LOG_OFF { $$= OPTION_LOG_OFF; } | SQL_LOG_UPDATE |