summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-07-25 22:46:28 +0300
committerunknown <monty@mashka.mysql.fi>2002-07-25 22:46:28 +0300
commit6ba1aefe909df2651fcace1fe184e3f093d07ab4 (patch)
treef38c137c73206e3d059517b2bcab6a4a43c957f9 /sql
parent29cec51551b7a6be66ebf2048f9045eeb0f59d94 (diff)
parent714e9c881e5af8bbb54c336d0327bae8e4559019 (diff)
downloadmariadb-git-6ba1aefe909df2651fcace1fe184e3f093d07ab4.tar.gz
Merge with 3.23.51
Fixed wrong usage of sprintf() in ha_innodb.cc BitKeeper/etc/logging_ok: auto-union BitKeeper/deleted/.del-global.h~e80d28157acfdcb5: Auto merged Docs/manual.ja.texi: Auto merged include/config-os2.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/btr/btr0sea.c: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/data/data0data.c: Auto merged innobase/dict/dict0crea.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/fil/fil0fil.c: Auto merged innobase/fsp/fsp0fsp.c: Auto merged innobase/ibuf/ibuf0ibuf.c: Auto merged innobase/include/buf0buf.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0log.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0file.c: Auto merged innobase/page/page0cur.c: Auto merged innobase/page/page0page.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0umod.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/sync/sync0arr.c: Auto merged innobase/sync/sync0sync.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/trx/trx0undo.c: Auto merged innobase/ut/ut0ut.c: Auto merged isam/pack_isam.c: Auto merged mysys/Makefile.am: Auto merged sql/ha_innodb.h: Auto merged sql/key.cc: Auto merged sql/mini_client.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged sql/table.cc: Auto merged support-files/my-huge.cnf.sh: Auto merged support-files/my-large.cnf.sh: Auto merged support-files/my-medium.cnf.sh: Auto merged support-files/my-small.cnf.sh: Auto merged Docs/manual.texi: Merge with 3.23.51 configure.in: Merge with 3.23.51 include/Makefile.am: Merge with 3.23.51 innobase/dict/dict0load.c: Merge with 3.23.51 innobase/include/univ.i: Merge with 3.23.51 innobase/row/row0mysql.c: Merge with 3.23.51 innobase/srv/srv0srv.c: Merge with 3.23.51 innobase/srv/srv0start.c: Merge with 3.23.51 myisam/mi_cache.c: Merge with 3.23.51 myisammrg/myrg_rnext.c: Merge with 3.23.51 myisammrg/myrg_rprev.c: Merge with 3.23.51 sql/ha_innodb.cc: Merge with 3.23.51 Changed used of sprintf() to make code portable. sql/handler.cc: Indentation change sql/lex.h: Comment cleanup sql/log.cc: Merge with 3.23.51 sql/log_event.h: Merge with 3.23.51 sql/mysql_priv.h: Merge with 3.23.51 sql/mysqld.cc: Merge with 3.23.51 Cleaned up handling of innodb_flush_log_at_trx_commit sql/share/portuguese/errmsg.txt: Merge with 3.23.51 sql/slave.cc: Not merged as this affects many files; Will be fixed in next changeset sql/slave.h: Merge with 3.23.51 sql/sql_acl.cc: Merge with 3.23.51 (no changes) sql/sql_db.cc: Merge with 3.23.51 sql/sql_parse.cc: Merge with 3.23.51 sql/sql_yacc.yy: Merge with 3.23.51 (Renamed NO_FOREIGN_KEY_CHECKS and RELAXED_UNIQUE_CHECKS) support-files/mysql.spec.sh: Merge with 3.23.51
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_innodb.cc307
-rw-r--r--sql/ha_innodb.h1
-rw-r--r--sql/handler.cc31
-rw-r--r--sql/lex.h4
-rw-r--r--sql/log.cc40
-rw-r--r--sql/mini_client.cc5
-rw-r--r--sql/mysql_priv.h14
-rw-r--r--sql/mysqld.cc19
-rw-r--r--sql/share/portuguese/errmsg.txt144
-rw-r--r--sql/slave.cc1
-rw-r--r--sql/slave.h9
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_table.cc6
-rw-r--r--sql/sql_yacc.yy4
16 files changed, 453 insertions, 151 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index e85965de60c..11ebc108874 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -27,6 +27,7 @@
#endif
#include "mysql_priv.h"
+#include "slave.h"
#ifdef HAVE_INNOBASE_DB
#include <m_ctype.h>
#include <assert.h>
@@ -53,10 +54,12 @@ typedef byte mysql_byte;
/* Include necessary InnoDB headers */
extern "C" {
#include "../innobase/include/univ.i"
+#include "../innobase/include/os0file.h"
#include "../innobase/include/srv0start.h"
#include "../innobase/include/srv0srv.h"
#include "../innobase/include/trx0roll.h"
#include "../innobase/include/trx0trx.h"
+#include "../innobase/include/trx0sys.h"
#include "../innobase/include/row0ins.h"
#include "../innobase/include/row0mysql.h"
#include "../innobase/include/row0sel.h"
@@ -188,7 +191,8 @@ int
convert_error_code_to_mysql(
/*========================*/
/* out: MySQL error code */
- int error) /* in: InnoDB error code */
+ int error, /* in: InnoDB error code */
+ THD* thd) /* in: user thread handle or NULL */
{
if (error == DB_SUCCESS) {
@@ -207,11 +211,27 @@ convert_error_code_to_mysql(
return(HA_ERR_NO_ACTIVE_RECORD);
} else if (error == (int) DB_DEADLOCK) {
+ /* Since we roll back the whole transaction, we must
+ tell it also to MySQL so that MySQL knows to empty the
+ cached binlog for this transaction */
+
+ if (thd) {
+ ha_rollback(thd);
+ }
return(HA_ERR_LOCK_DEADLOCK);
} else if (error == (int) DB_LOCK_WAIT_TIMEOUT) {
+ /* Since we roll back the whole transaction, we must
+ tell it also to MySQL so that MySQL knows to empty the
+ cached binlog for this transaction */
+
+
+ if (thd) {
+ ha_rollback(thd);
+ }
+
return(HA_ERR_LOCK_WAIT_TIMEOUT);
} else if (error == (int) DB_NO_REFERENCED_ROW) {
@@ -242,8 +262,6 @@ convert_error_code_to_mysql(
return(HA_ERR_TO_BIG_ROW);
} else {
- DBUG_ASSERT(0);
-
return(-1); // Unknown error
}
}
@@ -257,35 +275,49 @@ the prototype for this function! */
void
innobase_mysql_print_thd(
/*=====================*/
+ char* buf, /* in/out: buffer where to print, must be at least
+ 300 bytes */
void* input_thd)/* in: pointer to a MySQL THD object */
{
THD* thd;
thd = (THD*) input_thd;
- printf("MySQL thread id %lu, query id %lu",
- thd->thread_id, thd->query_id);
- if (thd->host) {
- printf(" %s", thd->host);
+ /* We can't use value of sprintf() as this is not portable */
+ sprintf(buf, "MySQL thread id %lu, query id %lu",
+ thd->thread_id, thd->query_id);
+ buf=strend(buf);
+
+ if (thd->host)
+ {
+ *buf++=' ';
+ buf=strnmov(buf, thd->host, 30);
}
- if (thd->ip) {
- printf(" %s", thd->ip);
+ if (thd->ip)
+ {
+ *buf++=' ';
+ buf=strnmov(buf, thd->ip, 20);
}
- if (thd->user) {
- printf(" %s", thd->user);
+ if (thd->user)
+ {
+ *buf++=' ';
+ buf=strnmov(buf, thd->user, 20);
}
- if (thd->proc_info) {
- printf(" %s", thd->proc_info);
+ if (thd->proc_info)
+ {
+ *buf++=' ';
+ buf=strnmov(buf, thd->procinfo, 50);
}
- if (thd->query) {
- printf("\n%-.100s", thd->query);
+ if (thd->query)
+ {
+ *buf++=' ';
+ buf=strnmov(buf, thd->query, 150);
}
-
- printf("\n");
+ *buf='\n';
}
}
@@ -302,6 +334,8 @@ check_trx_exists(
{
trx_t* trx;
+ ut_a(thd == current_thd);
+
trx = (trx_t*) thd->transaction.all.innobase_tid;
if (trx == NULL) {
@@ -321,7 +355,23 @@ check_trx_exists(
thd->transaction.stmt.innobase_tid =
(void*)&innodb_dummy_stmt_trx_handle;
} else {
- ut_a(trx->magic_n == TRX_MAGIC_N);
+ if (trx->magic_n != TRX_MAGIC_N) {
+ mem_analyze_corruption((byte*)trx);
+
+ ut_a(0);
+ }
+ }
+
+ if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) {
+ trx->check_foreigns = FALSE;
+ } else {
+ trx->check_foreigns = TRUE;
+ }
+
+ if (thd->options & OPTION_RELAXED_UNIQUE_CHECKS) {
+ trx->check_unique_secondary = FALSE;
+ } else {
+ trx->check_unique_secondary = TRUE;
}
return(trx);
@@ -340,7 +390,7 @@ ha_innobase::update_thd(
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
-
+
trx = check_trx_exists(thd);
if (prebuilt->trx != trx) {
@@ -361,13 +411,15 @@ innobase_init(void)
/*===============*/
/* out: TRUE if error */
{
- static char current_lib[3]; // Set if using current lib
+ static char current_dir[3]; // Set if using current lib
int err;
bool ret;
char *default_path;
DBUG_ENTER("innobase_init");
+ os_innodb_umask = (ulint)my_umask;
+
/*
When using the embedded server, the datadirectory is not
in the current directory.
@@ -377,10 +429,10 @@ innobase_init(void)
else
{
/* It's better to use current lib, to keep path's short */
- current_lib[0] = FN_CURLIB;
- current_lib[1] = FN_LIBCHAR;
- current_lib[2] = 0;
- default_path=current_lib;
+ current_dir[0] = FN_CURLIB;
+ current_dir[1] = FN_LIBCHAR;
+ current_dir[2] = 0;
+ default_path=current_dir;
}
if (specialflag & SPECIAL_NO_PRIOR) {
@@ -441,11 +493,12 @@ innobase_init(void)
srv_log_archive_on = (ulint) innobase_log_archive;
srv_log_buffer_size = (ulint) innobase_log_buffer_size;
- srv_flush_log_at_trx_commit = (ibool) innobase_flush_log_at_trx_commit;
+ srv_flush_log_at_trx_commit = (ulint) innobase_flush_log_at_trx_commit;
srv_use_native_aio = 0;
srv_pool_size = (ulint) innobase_buffer_pool_size;
+
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
@@ -477,6 +530,22 @@ innobase_init(void)
(void) hash_init(&innobase_open_tables,32,0,0,
(hash_get_key) innobase_get_key,0,0);
pthread_mutex_init(&innobase_mutex,MY_MUTEX_INIT_FAST);
+
+ /* If this is a replication slave and we needed to do a crash recovery,
+ set the master binlog position to what InnoDB internally knew about
+ how far we got transactions durable inside InnoDB. There is a
+ problem here: if the user used also MyISAM tables, InnoDB might not
+ know the right position for them.
+
+ THIS DOES NOT WORK CURRENTLY because replication seems to initialize
+ glob_mi also after innobase_init. */
+
+/* if (trx_sys_mysql_master_log_pos != -1) {
+ ut_memcpy(glob_mi.log_file_name, trx_sys_mysql_master_log_name,
+ 1 + ut_strlen(trx_sys_mysql_master_log_name));
+ glob_mi.pos = trx_sys_mysql_master_log_pos;
+ }
+*/
DBUG_RETURN(0);
}
@@ -536,6 +605,27 @@ innobase_get_free_space(void)
/*********************************************************************
Commits a transaction in an InnoDB database. */
+void
+innobase_commit_low(
+/*================*/
+ trx_t* trx) /* in: transaction handle */
+{
+ if (current_thd->slave_thread) {
+
+ /* Update the replication position info inside InnoDB */
+
+ trx->mysql_master_log_file_name = glob_mi.log_file_name;
+ trx->mysql_master_log_pos = (ib_longlong)
+ (glob_mi.pos + glob_mi.event_len
+ + glob_mi.pending);
+ }
+
+ trx_commit_for_mysql(trx);
+}
+
+/*********************************************************************
+Commits a transaction in an InnoDB database. */
+
int
innobase_commit(
/*============*/
@@ -555,8 +645,7 @@ innobase_commit(
trx = check_trx_exists(thd);
if (trx_handle != (void*)&innodb_dummy_stmt_trx_handle) {
-
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
}
/* Release possible statement level resources */
@@ -596,6 +685,8 @@ innobase_report_binlog_offset_and_commit(
trx = (trx_t*)trx_handle;
+ ut_a(trx != NULL);
+
trx->mysql_log_file_name = log_file_name;
trx->mysql_log_offset = (ib_longlong)end_offset;
@@ -636,7 +727,7 @@ innobase_rollback(
trx_mark_sql_stat_end(trx);
- DBUG_RETURN(convert_error_code_to_mysql(error));
+ DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
}
/*********************************************************************
@@ -798,7 +889,6 @@ ha_innobase::open(
ib_table = dict_table_get_and_increment_handle_count(
norm_name, NULL);
-
if (NULL == ib_table) {
sql_print_error("InnoDB error:\n\
@@ -855,6 +945,9 @@ have moved .frm files to another database?",
auto_inc_counter_for_this_stat = 0;
+ block_size = 16 * 1024; /* Index block size in InnoDB: used by MySQL
+ in query optimization */
+
/* Init table lock structure */
thr_lock_data_init(&share->lock,&lock,(void*) 0);
@@ -1134,7 +1227,7 @@ ha_innobase::store_key_val_for_row(
keys to see if they are equal
*/
bzero(buff, (ref_length- (uint) (buff - buff_start)));
- return ref_length;
+ DBUG_RETURN(ref_length);
}
/******************************************************************
@@ -1312,6 +1405,9 @@ ha_innobase::write_row(
DBUG_ENTER("ha_innobase::write_row");
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
statistic_increment(ha_write_count, &LOCK_status);
if (table->time_stamp) {
@@ -1379,7 +1475,8 @@ ha_innobase::write_row(
if (error != DB_SUCCESS) {
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error,
+ user_thd);
goto func_exit;
}
@@ -1395,7 +1492,7 @@ ha_innobase::write_row(
srv_conc_exit_innodb(prebuilt->trx);
error = convert_error_code_to_mysql(
- error);
+ error, user_thd);
goto func_exit;
}
}
@@ -1426,7 +1523,8 @@ ha_innobase::write_row(
if (error != DB_SUCCESS) {
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error,
+ user_thd);
goto func_exit;
}
@@ -1466,7 +1564,7 @@ ha_innobase::write_row(
prebuilt->trx->ignore_duplicates_in_insert = FALSE;
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, user_thd);
/* Tell InnoDB server that there might be work for
utility threads: */
@@ -1650,6 +1748,9 @@ ha_innobase::update_row(
DBUG_ENTER("ha_innobase::update_row");
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
if (table->time_stamp) {
update_timestamp(new_row + table->time_stamp - 1);
}
@@ -1683,7 +1784,7 @@ ha_innobase::update_row(
srv_conc_exit_innodb(prebuilt->trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, user_thd);
/* Tell InnoDB server that there might be work for
utility threads: */
@@ -1707,6 +1808,9 @@ ha_innobase::delete_row(
DBUG_ENTER("ha_innobase::delete_row");
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
last_query_id = user_thd->query_id;
@@ -1728,7 +1832,7 @@ ha_innobase::delete_row(
srv_conc_exit_innodb(prebuilt->trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, user_thd);
/* Tell the InnoDB server that there might be work for
utility threads: */
@@ -1820,6 +1924,10 @@ ha_innobase::index_read(
ulint ret;
DBUG_ENTER("index_read");
+
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
statistic_increment(ha_read_key_count, &LOCK_status);
if (last_query_id != user_thd->query_id) {
@@ -1886,7 +1994,7 @@ ha_innobase::index_read(
error = HA_ERR_KEY_NOT_FOUND;
table->status = STATUS_NOT_FOUND;
} else {
- error = convert_error_code_to_mysql(ret);
+ error = convert_error_code_to_mysql(ret, user_thd);
table->status = STATUS_NOT_FOUND;
}
@@ -1924,7 +2032,6 @@ ha_innobase::change_active_index(
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
KEY* key=0;
-
statistic_increment(ha_read_key_count, &LOCK_status);
DBUG_ENTER("change_active_index");
@@ -2009,6 +2116,9 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
srv_conc_enter_innodb(prebuilt->trx);
ret = row_search_for_mysql((byte*)buf, 0, prebuilt, match_mode,
@@ -2027,7 +2137,7 @@ ha_innobase::general_fetch(
error = HA_ERR_END_OF_FILE;
table->status = STATUS_NOT_FOUND;
} else {
- error = convert_error_code_to_mysql(ret);
+ error = convert_error_code_to_mysql(ret, user_thd);
table->status = STATUS_NOT_FOUND;
}
@@ -2220,6 +2330,9 @@ ha_innobase::rnd_pos(
statistic_increment(ha_read_rnd_count, &LOCK_status);
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
generated the clustered index from the row id: the
@@ -2262,6 +2375,9 @@ ha_innobase::position(
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
uint len;
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
generated the clustered index from row id: the
@@ -2334,7 +2450,7 @@ create_table_def(
error = row_create_table_for_mysql(table, trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, NULL);
DBUG_RETURN(error);
}
@@ -2392,7 +2508,7 @@ create_index(
error = row_create_index_for_mysql(index, trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, NULL);
DBUG_RETURN(error);
}
@@ -2418,7 +2534,7 @@ create_clustered_index_when_no_primary(
0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, NULL);
return(error);
}
@@ -2444,22 +2560,41 @@ ha_innobase::create(
uint i;
char name2[FN_REFLEN];
char norm_name[FN_REFLEN];
+ THD *thd= current_thd;
DBUG_ENTER("ha_innobase::create");
+ DBUG_ASSERT(thd != NULL);
+
trx = trx_allocate_for_mysql();
+ if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) {
+ trx->check_foreigns = FALSE;
+ }
+
+ if (thd->options & OPTION_RELAXED_UNIQUE_CHECKS) {
+ trx->check_unique_secondary = FALSE;
+ }
+
+
fn_format(name2, name, "", "",2); // Remove the .frm extension
normalize_table_name(norm_name, name2);
- /* Create the table definition in InnoDB */
+ /* Latch the InnoDB data dictionary exclusive so that no deadlocks
+ or lock waits can happen in it during a table create operation.
+ (Drop table etc. do this latching in row0mysql.c.) */
+
+ row_mysql_lock_data_dictionary();
+
+ /* Create the table definition in InnoDB */
error = create_table_def(trx, form, norm_name);
if (error) {
+ innobase_commit_low(trx);
- trx_commit_for_mysql(trx);
+ row_mysql_unlock_data_dictionary();
trx_free_for_mysql(trx);
@@ -2487,7 +2622,9 @@ ha_innobase::create(
error = create_clustered_index_when_no_primary(trx,
norm_name);
if (error) {
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
+
+ row_mysql_unlock_data_dictionary();
trx_free_for_mysql(trx);
@@ -2500,7 +2637,9 @@ ha_innobase::create(
first */
if ((error = create_index(trx, form, norm_name,
(uint) primary_key_no))) {
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
+
+ row_mysql_unlock_data_dictionary();
trx_free_for_mysql(trx);
@@ -2514,7 +2653,9 @@ ha_innobase::create(
if ((error = create_index(trx, form, norm_name, i))) {
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
+
+ row_mysql_unlock_data_dictionary();
trx_free_for_mysql(trx);
@@ -2526,17 +2667,21 @@ ha_innobase::create(
error = row_table_add_foreign_constraints(trx,
create_info->create_statement, norm_name);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, NULL);
if (error) {
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
+
+ row_mysql_unlock_data_dictionary();
trx_free_for_mysql(trx);
DBUG_RETURN(error);
}
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
+
+ row_mysql_unlock_data_dictionary();
/* Flush the log to reduce probability that the .frm files and
the InnoDB data dictionary get out-of-sync if the user runs
@@ -2604,11 +2749,11 @@ ha_innobase::delete_table(
srv_active_wake_master_thread();
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
trx_free_for_mysql(trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, NULL);
DBUG_RETURN(error);
}
@@ -2661,10 +2806,10 @@ innobase_drop_database(
srv_active_wake_master_thread();
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
trx_free_for_mysql(trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, NULL);
return(error);
}
@@ -2714,10 +2859,10 @@ ha_innobase::rename_table(
srv_active_wake_master_thread();
- trx_commit_for_mysql(trx);
+ innobase_commit_low(trx);
trx_free_for_mysql(trx);
- error = convert_error_code_to_mysql(error);
+ error = convert_error_code_to_mysql(error, NULL);
DBUG_RETURN(error);
}
@@ -2980,6 +3125,8 @@ ha_innobase::check(
ulint ret;
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
if (prebuilt->mysql_template == NULL) {
/* Build the template; we will use a dummy template
@@ -3216,6 +3363,51 @@ ha_innobase::external_lock(
}
/****************************************************************************
+Implements the SHOW INNODB STATUS command. Send the output of the InnoDB
+Monitor to the client. */
+
+int
+innodb_show_status(
+/*===============*/
+ THD* thd) /* in: the MySQL query thread of the caller */
+{
+ String* packet = &thd->packet;
+ char* buf;
+
+ DBUG_ENTER("innodb_show_status");
+
+ /* We let the InnoDB Monitor to output at most 100 kB of text */
+ buf = (char*)ut_malloc(100 * 1024);
+
+ srv_sprintf_innodb_monitor(buf, 100 * 1024);
+
+ List<Item> field_list;
+
+ field_list.push_back(new Item_empty_string("Status", strlen(buf)));
+
+ if(send_fields(thd, field_list, 1)) {
+ DBUG_RETURN(-1);
+ }
+
+ packet->length(0);
+
+ net_store_data(packet, buf);
+
+ if (my_net_write(&thd->net, (char*)thd->packet.ptr(),
+ packet->length())) {
+ ut_free(buf);
+
+ DBUG_RETURN(-1);
+ }
+
+ ut_free(buf);
+
+ send_eof(&thd->net);
+
+ DBUG_RETURN(0);
+}
+
+/****************************************************************************
Handling the shared INNOBASE_SHARE structure that is needed to provide table
locking.
****************************************************************************/
@@ -3338,6 +3530,9 @@ ha_innobase::get_auto_increment()
longlong nr;
int error;
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
/* Also SHOW TABLE STATUS calls this function. Previously, when we did
always read the max autoinc key value, setting x-locks, users were
surprised that SHOW TABLE STATUS could end up in a deadlock with
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index 4924056f5d2..7ea297cc362 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -202,4 +202,5 @@ int innobase_report_binlog_offset_and_commit(
int innobase_rollback(THD *thd, void* trx_handle);
int innobase_close_connection(THD *thd);
int innobase_drop_database(char *path);
+int innodb_show_status(THD* thd);
diff --git a/sql/handler.cc b/sql/handler.cc
index 95f238260db..4180d98245c 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -218,6 +218,7 @@ int ha_autocommit_or_rollback(THD *thd, int error)
}
else
(void) ha_rollback_stmt(thd);
+
thd->variables.tx_isolation=thd->session_tx_isolation;
}
#endif
@@ -278,6 +279,36 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
if (trans == &thd->transaction.all && mysql_bin_log.is_open() &&
my_b_tell(&thd->transaction.trans_log))
{
+ /* We write the command "COMMIT" as the last SQL command in the
+ binlog segment cached for this transaction */
+
+ int save_query_length = thd->query_length;
+
+ thd->query_length = 6; /* length of 'COMMIT'; note that we may come
+ here because a DROP TABLE, for instance,
+ makes an implicit commit, and then
+ thd->query is not 'COMMIT'! */
+
+ Query_log_event qinfo(thd, "COMMIT", TRUE);
+
+ /* When we come here, and the user wrapped the transaction into
+ BEGIN and COMMIT, then qinfo got above the field cache_stmt
+ erroneously set to 0. Let us set it to 1: */
+
+ qinfo.cache_stmt = 1;
+
+ /* Write the 'COMMIT' entry to the cache */
+
+ if (mysql_bin_log.write(&qinfo)) {
+ my_error(ER_ERROR_DURING_COMMIT, MYF(0), 5000);
+ error=1;
+ }
+
+ thd->query_length = save_query_length;
+
+ /* Now we write the binlog segment cached for this transaction to
+ the real binlog */
+
mysql_bin_log.write(thd, &thd->transaction.trans_log);
reinit_io_cache(&thd->transaction.trans_log,
WRITE_CACHE, (my_off_t) 0, 0, 1);
diff --git a/sql/lex.h b/sql/lex.h
index 9d2411d6a0d..b13b68d7858 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -30,7 +30,7 @@
#endif
/*
- Symbols are breaked in to separated arrays to allow field names with
+ Symbols are broken into separated arrays to allow field names with
same name as functions.
These are kept sorted for human lookup (the symbols are hashed).
*/
@@ -251,6 +251,7 @@ static SYMBOL symbols[] = {
{ "NEW", SYM(NEW_SYM),0,0},
{ "NCHAR", SYM(NCHAR_SYM),0,0},
{ "NO", SYM(NO_SYM),0,0},
+ { "NO_FOREIGN_KEY_CHECKS", SYM(NO_FOREIGN_KEY_CHECKS), 0, 0},
{ "NOT", SYM(NOT),0,0},
{ "NULL", SYM(NULL_SYM),0,0},
{ "NUMERIC", SYM(NUMERIC_SYM),0,0},
@@ -284,6 +285,7 @@ static SYMBOL symbols[] = {
{ "RELAY_LOG_POS", SYM(RELAY_LOG_POS_SYM),0,0},
{ "RELOAD", SYM(RELOAD),0,0},
{ "REGEXP", SYM(REGEXP),0,0},
+ { "RELAXED_UNIQUE_CHECKS", SYM(RELAXED_UNIQUE_CHECKS), 0, 0},
{ "RENAME", SYM(RENAME),0,0},
{ "REPAIR", SYM(REPAIR),0,0},
{ "REPLACE", SYM(REPLACE),0,0},
diff --git a/sql/log.cc b/sql/log.cc
index 95f6319231d..6d9e8215105 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -616,8 +616,8 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
#ifdef HAVE_FTRUNCATE
if (ftruncate(index_file,0))
{
- sql_print_error("Could not truncate the binlog index file \
-during log purge for write");
+ sql_print_error(
+"Could not truncate the binlog index file during log purge for write");
error = LOG_INFO_FATAL;
goto err;
}
@@ -629,8 +629,8 @@ during log purge for write");
O_CREAT | O_BINARY | O_RDWR | O_APPEND,
MYF(MY_WME)))<0)
{
- sql_print_error("Could not re-open the binlog index file \
-during log purge for write");
+ sql_print_error(
+"Could not re-open the binlog index file during log purge for write");
error = LOG_INFO_FATAL;
goto err;
}
@@ -915,6 +915,38 @@ bool MYSQL_LOG::write(Log_event* event_info)
}
error=1;
+ if (file == &thd->transaction.trans_log
+ && !my_b_tell(&thd->transaction.trans_log)) {
+
+ /* Add the "BEGIN" and "COMMIT" in the binlog around transactions
+ which may contain more than 1 SQL statement. If we run with
+ AUTOCOMMIT=1, then MySQL immediately writes each SQL statement to
+ the binlog when the statement has been completed. No need to add
+ "BEGIN" ... "COMMIT" around such statements. Otherwise, MySQL uses
+ thd->transaction.trans_log to cache the SQL statements until the
+ explicit commit, and at the commit writes the contents in .trans_log
+ to the binlog.
+
+ We write the "BEGIN" mark first in the buffer (.trans_log) where we
+ store the SQL statements for a transaction. At the transaction commit
+ we will add the "COMMIT mark and write the buffer to the binlog.
+ The function my_b_tell above returns != 0 if there already is data
+ in the buffer. */
+
+ int save_query_length = thd->query_length;
+
+ thd->query_length = 5; /* length of string BEGIN */
+
+ Query_log_event qinfo(thd, "BEGIN", TRUE);
+
+ error = ((&qinfo)->write(file));
+
+ thd->query_length = save_query_length;
+
+ if (error)
+ goto err;
+ }
+
/*
No check for auto events flag here - this write method should
never be called if auto-events are enabled
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index a50bef4bbca..f6a5d6af8ae 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -107,6 +107,8 @@ static my_bool is_NT(void)
}
#endif
+extern ulong slave_net_timeout;
+
/*
** Create a named pipe connection
*/
@@ -197,6 +199,7 @@ MYSQL *mc_mysql_init(MYSQL *mysql)
#ifdef __WIN__
mysql->options.connect_timeout=20;
#endif
+ mysql->net.timeout = slave_net_timeout;
return mysql;
}
@@ -652,7 +655,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
goto error;
}
vio_keepalive(net->vio,TRUE);
-
+ net->timeout=slave_net_timeout;
/* Get version info */
mysql->protocol_version= PROTOCOL_VERSION; /* Assume this */
if ((pkt_length=mc_net_safe_read(mysql)) == packet_error)
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 6dc70d0a86c..712107a0074 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -162,6 +162,7 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define OPTION_BIG_SELECTS 1024 /* for SQL OPTION */
#define OPTION_LOG_OFF 2048
#define OPTION_UPDATE_LOG 4096 /* update log flag */
+#define TMP_TABLE_ALL_COLUMNS 8192
#define OPTION_WARNINGS 16384
#define OPTION_AUTO_IS_NULL 32768
#define OPTION_FOUND_COMMENT 65536L
@@ -176,14 +177,19 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define OPTION_INTERNAL_SUBTRANSACTIONS OPTION_QUOTE_SHOW_CREATE*2
/* Set if we are updating a non-transaction safe table */
-#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_INTERNAL_SUBTRANSACTIONS*2
+#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_INTERNAL_SUBTRANSACTIONS*2
/* The following is set when parsing the query */
#define QUERY_NO_INDEX_USED OPTION_STATUS_NO_TRANS_UPDATE*2
#define QUERY_NO_GOOD_INDEX_USED QUERY_NO_INDEX_USED*2
-
-#define SELECT_NO_UNLOCK (QUERY_NO_GOOD_INDEX_USED*2)
-#define TMP_TABLE_ALL_COLUMNS (SELECT_NO_UNLOCK*2)
+/* The following can be set when importing tables in a 'wrong order'
+ to suppress foreign key checks */
+#define OPTION_NO_FOREIGN_KEY_CHECKS QUERY_NO_GOOD_INDEX_USED*2
+/* The following speeds up inserts to InnoDB tables by suppressing unique
+ key checks in some cases */
+#define OPTION_RELAXED_UNIQUE_CHECKS OPTION_NO_FOREIGN_KEY_CHECKS*2
+#define SELECT_NO_UNLOCK ((ulong) OPTION_RELAXED_UNIQUE_CHECKS*2)
+/* NOTE: we have now used up all 32 bits of the OPTION flag! */
/* Bits for different SQL modes modes (including ANSI mode) */
#define MODE_REAL_AS_FLOAT 1
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6c520ffe9ed..6c9e934071d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -101,14 +101,14 @@ extern "C" { // Because of SCO 3.2V4.2
int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
-#ifdef __linux__
-#define my_fromhost(A) fromhost()
-#define my_hosts_access(A) hosts_access()
-#define my_eval_client(A) eval_client()
-#else
+#ifdef __STDC__
#define my_fromhost(A) fromhost(A)
#define my_hosts_access(A) hosts_access(A)
#define my_eval_client(A) eval_client(A)
+#else
+#define my_fromhost(A) fromhost()
+#define my_hosts_access(A) hosts_access()
+#define my_eval_client(A) eval_client()
#endif
#endif /* HAVE_LIBWRAP */
@@ -2967,8 +2967,9 @@ struct my_option my_long_options[] =
"Set to 1 if you want to have logs archived", 0, 0, 0, GET_LONG, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"innodb_flush_log_at_trx_commit", OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT,
- "Set to 0 if you don't want to flush logs", 0, 0, 0, GET_LONG, OPT_ARG,
- 0, 0, 0, 0, 0, 0},
+ "Set to 0 if you don't want to flush logs",
+ &innobase_flush_log_at_trx_commit, &innobase_flush_log_at_trx_commit,
+ 0, GET_LONG, OPT_ARG, 0, 0, 10, 0, 0, 0},
{"innodb_flush_method", OPT_INNODB_FLUSH_METHOD,
"With which method to flush data", (gptr*) &innobase_unix_file_flush_method,
(gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,
@@ -3654,6 +3655,7 @@ struct show_var_st status_vars[]= {
{"Com_show_slave_hosts", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_HOSTS),SHOW_LONG},
{"Com_show_slave_status", (char*) (com_stat+(uint) SQLCOM_SHOW_SLAVE_STAT),SHOW_LONG},
{"Com_show_status", (char*) (com_stat+(uint) SQLCOM_SHOW_STATUS),SHOW_LONG},
+ {"Com_show_innodb_status", (char*) (com_stat+(uint) SQLCOM_SHOW_INNODB_STATUS),SHOW_LONG},
{"Com_show_tables", (char*) (com_stat+(uint) SQLCOM_SHOW_TABLES),SHOW_LONG},
{"Com_show_variables", (char*) (com_stat+(uint) SQLCOM_SHOW_VARIABLES),SHOW_LONG},
{"Com_slave_start", (char*) (com_stat+(uint) SQLCOM_SLAVE_START),SHOW_LONG},
@@ -4238,9 +4240,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_INNODB_LOG_ARCHIVE:
innobase_log_archive= argument ? test(atoi(argument)) : 1;
break;
- case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT:
- innobase_flush_log_at_trx_commit= argument ? test(atoi(argument)) : 1;
- break;
case OPT_INNODB_FAST_SHUTDOWN:
innobase_fast_shutdown= argument ? test(atoi(argument)) : 1;
break;
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 868bb42b6be..9c3bf3b32a1 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -1,28 +1,28 @@
/* Copyright Abandoned 1997 TCX DataKonsult AB & Monty Program KB & Detron HB
This file is public domain and comes with NO WARRANTY of any kind */
-/* Updated by Roberto de Martin Serqueira - martinsc@uol.com.br - 08.20.2001 */
+/* Updated by Thiago Delgado Pinto - thiagodp@ieg.com.br - 06.07.2002 */
"hashchk",
"isamchk",
-"não",
-"sim",
-"Não pode criar arquivo '%-.64s' (erro no. %d)",
-"Não pode criar tabela '%-.64s' (erro no. %d)",
-"Não pode criar banco de dados '%-.64s' (erro no. %d)",
-"Não pode criar banco de dados '%-.64s'. Banco de dados já existe",
-"Não pode eliminar banco de dados '%-.64s'. Banco de dados não existe",
+"NÃO",
+"SIM",
+"Não pode criar o arquivo '%-.64s' (erro no. %d)",
+"Não pode criar a tabela '%-.64s' (erro no. %d)",
+"Não pode criar o banco de dados '%-.64s' (erro no. %d)",
+"Não pode criar o banco de dados '%-.64s'. Este banco de dados já existe",
+"Não pode eliminar o banco de dados '%-.64s'. Este banco de dados não existe",
"Erro ao eliminar banco de dados (não pode eliminar '%-.64s' - erro no. %d)",
"Erro ao eliminar banco de dados (não pode remover diretório '%-.64s' - erro no. %d)",
-"Erro na deleção de '%-.64s' (erro no. %d)",
-"Não pode ler registro em tabela do sistema",
-"Não pode obter status de '%-.64s' (erro no. %d)",
-"Não pode obter diretório corrente (erro no. %d)",
-"Não pode travar arquivo (erro no. %d)",
-"Não pode abrir arquivo '%-.64s' (erro no. %d)",
-"Não pode encontrar arquivo '%-.64s' (erro no. %d)",
-"Não pode ler diretório de '%-.64s' (erro no. %d)",
+"Erro na remoção de '%-.64s' (erro no. %d)",
+"Não pode ler um registro numa tabela do sistema",
+"Não pode obter o status de '%-.64s' (erro no. %d)",
+"Não pode obter o diretório corrente (erro no. %d)",
+"Não pode travar o arquivo (erro no. %d)",
+"Não pode abrir o arquivo '%-.64s' (erro no. %d)",
+"Não pode encontrar o arquivo '%-.64s' (erro no. %d)",
+"Não pode ler o diretório de '%-.64s' (erro no. %d)",
"Não pode mudar para o diretório '%-.64s' (erro no. %d)",
"Registro alterado desde a última leitura da tabela '%-.64s'",
-"Disco cheio (%s). Aguardando alguém liberar algum espaço....",
+"Disco cheio (%s). Aguardando alguém liberar algum espaço...",
"Não pode gravar. Chave duplicada na tabela '%-.64s'",
"Erro ao fechar '%-.64s' (erro no. %d)",
"Erro ao ler arquivo '%-.64s' (erro no. %d)",
@@ -30,13 +30,13 @@
"Erro ao gravar arquivo '%-.64s' (erro no. %d)",
"'%-.64s' está com travamento contra alterações",
"Ordenação abortada",
-"'View' '%-.64s' não existe para '%-.64s'",
+"Visão '%-.64s' não existe para '%-.64s'",
"Obteve erro %d no manipulador de tabelas",
"Manipulador de tabela para '%-.64s' não tem esta opção",
"Não pode encontrar registro em '%-.64s'",
"Informação incorreta no arquivo '%-.64s'",
-"Arquivo de índice incorreto para tabela '%-.64s'. Tente reparar",
-"Arquivo chave desatualizado para tabela '%-.64s'. Repare-o!",
+"Arquivo de índice incorreto para tabela '%-.64s'. Tente repará-lo",
+"Arquivo de índice desatualizado para tabela '%-.64s'. Repare-o!",
"Tabela '%-.64s' é somente para leitura",
"Sem memória. Reinicie o programa e tente novamente (necessita de %d bytes)",
"Sem memória para ordenação. Aumente tamanho do 'buffer' de ordenação",
@@ -46,10 +46,10 @@
"Não pode obter nome do 'host' para seu endereço",
"Negociação de acesso falhou",
"Acesso negado para o usuário '%-.32s@%-.64s' ao banco de dados '%-.64s'",
-"Acesso negado para o usuário '%-.32s@%-.64s' (uso de senha: %s)",
+"Acesso negado para o usuário '%-.32s@%-.64s' (senha usada: %s)",
"Nenhum banco de dados foi selecionado",
"Comando desconhecido",
-"Coluna '%-.64s' não pode ter NULL",
+"Coluna '%-.64s' não pode ser vazia",
"Banco de dados '%-.64s' desconhecido",
"Tabela '%-.64s' já existe",
"Tabela '%-.64s' desconhecida",
@@ -66,9 +66,9 @@
"Entrada '%-.64s' duplicada para a chave %d",
"Especificador de coluna incorreto para a coluna '%-.64s'",
"%s próximo a '%-.80s' na linha %d",
-"'Query' estava vazia",
+"Consulta (query) estava vazia",
"Tabela/alias '%-.64s' não única",
-"Valor 'default' inválido para '%-.64s'",
+"Valor padrão (default) inválido para '%-.64s'",
"Definida mais de uma chave primária",
"Especificadas chaves demais. O máximo permitido são %d chaves",
"Especificadas partes de chave demais. O máximo permitido são %d partes",
@@ -82,50 +82,50 @@
"%s: Obteve sinal %d. Abortando!\n",
"%s: 'Shutdown' completo\n",
"%s: Forçando finalização da 'thread' %ld - usuário '%-.32s'\n",
-"Não pode criar 'IP socket'",
+"Não pode criar o soquete IP",
"Tabela '%-.64s' não possui um índice como o usado em CREATE INDEX. Recrie a tabela",
-"Argumento separador de campos não é o esperado. Confira no manual",
-"Você não pode usar comprimento de linha fixo com BLOBs. Favor usar 'fields terminated by'",
+"Argumento separador de campos não é o esperado. Cheque o manual",
+"Você não pode usar comprimento de linha fixo com BLOBs. Por favor, use campos com comprimento limitado.",
"Arquivo '%-.64s' tem que estar no diretório do banco de dados ou ter leitura possível para todos",
"Arquivo '%-.80s' já existe",
"Registros: %ld - Deletados: %ld - Ignorados: %ld - Avisos: %ld",
"Registros: %ld - Duplicados: %ld",
-"Parte de chave incorreta. A parte de chave usada não é um 'string' ou o comprimento usado é maior do que a parte de chave ou o manipulador de tabelas não aceita partes de chaves únicas",
+"Sub parte da chave incorreta. A parte da chave usada não é uma 'string' ou o comprimento usado é maior que parte da chave ou o manipulador de tabelas não suporta sub chaves únicas",
"Você não pode deletar todas as colunas com ALTER TABLE. Use DROP TABLE em seu lugar",
-"Não pode fazer DROP '%-.64s'. Confira se esta coluna/chave existe",
+"Não se pode fazer DROP '%-.64s'. Confira se esta coluna/chave existe",
"Registros: %ld - Duplicados: %ld - Avisos: %ld",
-"INSERT TABLE '%-.64s' não é permitido em lista de tabelas FROM",
+"INSERT TABLE '%-.64s' não é permitido na lista de tabelas contidas em FROM",
"'Id' de 'thread' %lu desconhecido",
"Você não é proprietário da 'thread' %lu",
"Nenhuma tabela usada",
"'Strings' demais para coluna '%-.64s' e SET",
"Não pode gerar um nome de arquivo de 'log' único '%-.64s'.(1-999)\n",
-"Tabela '%-.64s' foi travada com trava de READ e não pode ser atualizada",
+"Tabela '%-.64s' foi travada com trava de leitura e não pode ser atualizada",
"Tabela '%-.64s' não foi travada com LOCK TABLES",
-"Coluna BLOB '%-.64s' não pode ter um valor 'default'",
+"Coluna BLOB '%-.64s' não pode ter um valor padrão (default)",
"Nome de banco de dados '%-.100s' incorreto",
"Nome de tabela '%-.100s' incorreto",
-"O SELECT examinaria registros demais e provavelmente tomaria um tempo muito longo. Confira sua cláusula WHERE e use SET OPTION SQL_BIG_SELECTS=1, se o SELECT estiver correto",
+"O SELECT examinaria registros demais e provavelmente levaria muito tempo. Cheque sua cláusula WHERE e use SET OPTION SQL_BIG_SELECTS=1, se o SELECT estiver correto",
"Erro desconhecido",
"'Procedure' '%-.64s' desconhecida",
"Número de parâmetros incorreto para a 'procedure' '%-.64s'",
"Parâmetros incorretos para a 'procedure' '%-.64s'",
"Tabela '%-.64s' desconhecida em '%-.32s'",
"Coluna '%-.64s' especificada duas vezes",
-"Uso inválido de função de grupo",
+"Uso inválido de função de agrupamento (GROUP)",
"Tabela '%-.64s' usa uma extensão que não existe nesta versão do MySQL",
"Uma tabela tem que ter pelo menos uma (1) coluna",
"Tabela '%-.64s' está cheia",
"Conjunto de caracteres '%-.64s' desconhecido",
-"Tabelas demais. O MySQL pode usar somente %d tabelas em um JOIN",
+"Tabelas demais. O MySQL pode usar somente %d tabelas em uma junção (JOIN)",
"Colunas demais",
"Tamanho de linha grande demais. O máximo tamanho de linha, não contando BLOBs, é %d. Você tem que mudar alguns campos para BLOBs",
"Estouro da pilha do 'thread'. Usados %ld de uma pilha de %ld . Use 'mysqld -O thread_stack=#' para especificar uma pilha maior, se necessário",
-"Dependência cruzada encontrada em OUTER JOIN. Examine suas condições ON",
-"Coluna '%-.64s' é usada com UNIQUE ou INDEX, mas não está definida como NOT NULL",
+"Dependência cruzada encontrada em junção externa (OUTER JOIN). Examine as condições utilizadas nas cláusulas 'ON'",
+"Coluna '%-.64s' é usada com única (UNIQUE) ou índice (INDEX), mas não está definida como não-nula (NOT NULL)",
"Não pode carregar a função '%-.64s'",
"Não pode inicializar a função '%-.64s' - '%-.80s'",
-"Não é permitido caminho para biblioteca compartilhada",
+"Não há caminhos (paths) permitidos para biblioteca compartilhada",
"Função '%-.64s' já existe",
"Não pode abrir biblioteca compartilhada '%-.64s' (erro no. '%d' - '%-.64s')",
"Não pode encontrar a função '%-.64s' na biblioteca",
@@ -133,34 +133,34 @@
"'Host' '%-.64s' está bloqueado devido a muitos erros de conexão. Desbloqueie com 'mysqladmin flush-hosts'",
"'Host' '%-.64s' não tem permissão para se conectar com este servidor MySQL",
"Você está usando o MySQL como usuário anônimo e usuários anônimos não têm permissão para mudar senhas",
-"Você tem que ter o privilégio para atualizar tabelas no banco de dados mysql para ser capaz de mudar a senha de outros",
-"Não pode encontrar nenhuma linha que combine na tabela user",
+"Você deve ter privilégios para atualizar tabelas no banco de dados mysql para ser capaz de mudar a senha de outros",
+"Não pode encontrar nenhuma linha que combine na tabela usuário (user table)",
"Linhas que combinaram: %ld - Alteradas: %ld - Avisos: %ld",
"Não pode criar uma nova 'thread' (erro no. %d). Se você não estiver sem memória disponível, você pode consultar o manual sobre um possível 'bug' dependente do sistema operacional",
"Contagem de colunas não confere com a contagem de valores na linha %ld",
"Não pode reabrir a tabela '%-.64s',
"Uso inválido do valor NULL",
"Obteve erro '%-.64s' em regexp",
-"Mistura de colunas GROUP (MIN(),MAX(),COUNT()...) com colunas não GROUP é ilegal, se não existir cláusula GROUP BY",
-"Não existe tal 'grant' definido para o usuário '%-.32s' no 'host' '%-.64s'",
+"Mistura de colunas agrupadas (com MIN(), MAX(), COUNT(), ...) com colunas não agrupadas é ilegal, se não existir uma cláusula de agrupamento (cláusula GROUP BY)",
+"Não existe tal permissão (grant) definida para o usuário '%-.32s' no 'host' '%-.64s'",
"Comando '%-.16s' negado para o usuário '%-.32s@%-.64s' na tabela '%-.64s'",
"Comando '%-.16s' negado para o usuário '%-.32s@%-.64s' na coluna '%-.64s', na tabela '%-.64s'",
"Comando GRANT/REVOKE ilegal. Por favor consulte no manual quais privilégios podem ser usados.",
"Argumento de 'host' ou de usuário para o GRANT é longo demais",
"Tabela '%-.64s.%-.64s' não existe",
-"Não existe tal 'grant' definido para o usuário '%-.32s' no 'host' '%-.64s', na tabela '%-.64s'",
+"Não existe tal permissão (grant) definido para o usuário '%-.32s' no 'host' '%-.64s', na tabela '%-.64s'",
"Comando usado não é permitido para esta versão do MySQL",
"Você tem um erro de sintaxe no seu SQL",
-"'Thread' de inserção retardada ('delayed') não conseguiu obter trava solicitada para tabela '%-.64s'",
-"Excesso de 'threads' retardadas ('delayed') em uso",
+"'Thread' de inserção retardada (atrasada) pois não conseguiu obter a trava solicitada para tabela '%-.64s'",
+"Excesso de 'threads' retardadas (atrasadas) em uso",
"Conexão %ld abortou para o banco de dados '%-.64s' - usuário '%-.32s' (%-.64s)",
-"Obteve um pacote maior do que 'max_allowed_packet'",
+"Obteve um pacote maior do que a taxa máxima de pacotes definida (max_allowed_packet)",
"Obteve um erro de leitura no 'pipe' da conexão",
"Obteve um erro em fcntl()",
"Obteve pacotes fora de ordem",
"Não conseguiu descomprimir pacote de comunicação",
"Obteve um erro na leitura de pacotes de comunicação",
-"Obteve expiração de tempo ('timeout') na leitura de pacotes de comunicação",
+"Obteve expiração de tempo (timeout) na leitura de pacotes de comunicação",
"Obteve um erro na escrita de pacotes de comunicação",
"Obteve expiração de tempo ('timeout') na escrita de pacotes de comunicação",
"'String' resultante é mais longa do que 'max_allowed_packet'",
@@ -169,56 +169,56 @@
"INSERT DELAYED não pode ser usado com a tabela '%-.64s', porque ela está travada com LOCK TABLES",
"Nome de coluna '%-.100s' incorreto",
"O manipulador de tabela usado não pode indexar a coluna '%-.64s'",
-"Tabelas no MERGE não estão todas definidas identicamente",
+"Todas as tabelas contidas na tabela fundida (MERGE) não estão definidas identicamente",
"Não pode gravar, devido à restrição UNIQUE, na tabela '%-.64s'",
"Coluna BLOB '%-.64s' usada na especificação de chave sem o comprimento da chave",
-"Todas as partes de uma PRIMARY KEY têm que ser NOT NULL. Se você precisar de NULL em uma chave, use UNIQUE em seu lugar",
+"Todas as partes de uma chave primária devem ser não-nulas. Se você precisou usar um valor nulo (NULL) em uma chave, use a cláusula UNIQUE em seu lugar",
"O resultado consistiu em mais do que uma linha",
"Este tipo de tabela requer uma chave primária",
"Esta versão do MySQL não foi compilada com suporte a RAID",
-"Você está usando modo de atualização seguro e tentou atualizar uma tabela sem um WHERE que use uma coluna de KEY",
+"Você está usando modo de atualização seguro e tentou atualizar uma tabela sem uma cláusula WHERE que use uma coluna chave",
"Chave '%-.64s' não existe na tabela '%-.64s'",
"Não pode abrir a tabela",
-"O manipulador de tabela não suporta check/repair",
-"Não lhe é permitido executar este comando em uma 'transaction'",
+"O manipulador de tabela não suporta checagem/reparação (check/repair)",
+"Não lhe é permitido executar este comando em uma transação",
"Obteve erro %d durante COMMIT",
"Obteve erro %d durante ROLLBACK",
"Obteve erro %d durante FLUSH_LOGS",
"Obteve erro %d durante CHECKPOINT",
-"Conexão %ld abortada ao banco de dados '%-.64s' - usuário '%-.32s' - 'host' `%-.64s' ('%-.64s')",
-"O manipulador de tabela não suporta DUMP binário de tabela",
+"Conexão %ld abortada para banco de dados '%-.64s' - usuário '%-.32s' - 'host' `%-.64s' ('%-.64s')",
+"O manipulador de tabela não suporta 'dump' binário de tabela",
"Binlog fechado. Não pode fazer RESET MASTER",
-"Falhou na reconstrução do índice da tabela '%-.64s' 'dumped'",
+"Falhou na reconstrução do índice da tabela 'dumped' '%-.64s'",
"Erro no 'master' '%-.64s'",
-"Erro de rede na leitura do 'master'",
-"Erro de rede na gravação do 'master'",
-"Não pode encontrar índice FULLTEXT que combine com a lista de colunas",
-"Não pode executar o comando dado porque você tem tabelas ativas travadas ou uma 'transaction' ativa",
-"Variável de sistema '%-.64s' desconhecida",
+"Erro de rede lendo do 'master'",
+"Erro de rede gravando no 'master'",
+"Não pode encontrar um índice para o texto todo que combine com a lista de colunas",
+"Não pode executar o comando dado porque você tem tabelas ativas travadas ou uma transação ativa",
+"Variável de sistema '%-.64' desconhecida",
"Tabela '%-.64s' está marcada como danificada e deve ser reparada",
"Tabela '%-.64s' está marcada como danificada e a última reparação (automática?) falhou",
-"Aviso: Algumas tabelas não-transacionais alteradas não puderam ser reconstituídas ('rolled back')",
-"'Multi-statement transaction' requereu mais do que 'max_binlog_cache_size' bytes de armazenagem. Aumente o valor desta variável do mysqld e tente novamente',
+"Aviso: Algumas tabelas não-transacionais alteradas não puderam ser reconstituídas (rolled back)",
+"Transações multi-declaradas (multi-statement transactions) requeriram mais do que o valor limite (max_binlog_cache_size) de bytes para armazenagem. Aumente o valor desta variável do mysqld e tente novamente",
"Esta operação não pode ser realizada com um 'slave' em execução. Execute SLAVE STOP primeiro",
"Esta operação requer um 'slave' em execução. Configure o 'slave' e execute SLAVE START",
"O servidor não está configurado como 'slave'. Acerte o arquivo de configuração ou use CHANGE MASTER TO",
"Não pode inicializar a estrutura de informação do 'master'. Verifique as permissões em 'master.info'",
"Não conseguiu criar 'thread' de 'slave'. Verifique os recursos do sistema",
-"Usuário '%-.64s' já possui 'max_user_connections' conexões ativas",
-"Você pode usar apenas expressões de constante com SET",
-"Excedido tempo de espera (timeout) do travamento",
+"Usuário '%-.64s' já possui mais que o valor máximo de conexões (max_user_connections) ativas",
+"Você pode usar apenas expressões constantes com SET",
+"Tempo de espera (timeout) de travamento excedido. Tente reiniciar a transação.",
"O número total de travamentos excede o tamanho da tabela de travamentos",
-"Travamentos de atualização não podem ser obtidos durante uma transação de READ UNCOMMITTED",
+"Travamentos de atualização não podem ser obtidos durante uma transação de tipo READ UNCOMMITTED",
"DROP DATABASE não permitido enquanto uma 'thread' está mantendo um travamento global de leitura",
"CREATE DATABASE não permitido enquanto uma 'thread' está mantendo um travamento global de leitura",
"Argumentos errados para %s",
"Não é permitido a %-.32s@%-.64s criar novos usuários",
-"Incorrect table definition; All MERGE tables must be in the same database",
-"Deadlock found when trying to get lock; Try restarting transaction",
-"The used table type doesn't support FULLTEXT indexes",
-"Cannot add foreign key constraint",
-"Cannot add a child row: a foreign key constraint fails",
-"Cannot delete a parent row: a foreign key constraint fails",
+"Definição incorreta da tabela. Todas as tabelas contidas na junção devem estar no mesmo banco de dados.",
+"Encontrado um travamento fatal (deadlock) quando tentava obter uma trava. Tente reiniciar a transação.",
+"O tipo de tabela utilizado não suporta índices de texto completo (fulltext indexes)",
+"Não pode acrescentar uma restrição de chave estrangeira",
+"Não pode acrescentar uma linha filha: uma restrição de chave estrangeira falhou",
+"Não pode apagar uma linha pai: uma restrição de chave estrangeira falhou",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error when executing command %s: %-.128s",
diff --git a/sql/slave.cc b/sql/slave.cc
index e8119c6aea2..7871f536320 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1802,6 +1802,7 @@ slave_begin:
goto err;
}
+
thd->proc_info = "connecting to master";
#ifndef DBUG_OFF
sql_print_error("Slave I/O thread initialized");
diff --git a/sql/slave.h b/sql/slave.h
index 36849c884e9..e6a5e86bb10 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -252,6 +252,15 @@ typedef struct st_master_info
my_off_t master_log_pos;
File fd;
+
+ /*
+ InnoDB internally stores the master log position it has processed
+ so far; the position to store is really the sum of
+ pos + pending + event_len here since we must store the pos of the
+ END of the current log event
+*/
+ int event_len;
+ File fd;
IO_CACHE file;
/* the variables below are needed because we can change masters on the fly */
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index e5abd5ce8a7..0b02935e96c 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -2868,9 +2868,9 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
}
}
- db.append (" ON '",5);
+ db.append (" ON `",5);
db.append(acl_db->db);
- db.append ("'.* TO '",8);
+ db.append ("`.* TO '",8);
db.append(lex_user->user.str,lex_user->user.length);
db.append ("'@'",3);
db.append(lex_user->host.str, lex_user->host.length);
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 9c1e017a4f6..9be8703b6c5 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -44,6 +44,7 @@ enum enum_sql_command {
SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
+ SQLCOM_SHOW_INNODB_STATUS,
SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE,
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 33229b4cb4c..46ef9e90b7d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -23,6 +23,10 @@
#include <my_dir.h>
#include <assert.h>
+#ifdef HAVE_INNOBASE_DB
+#include "ha_innobase.h"
+#endif
+
#ifdef HAVE_OPENSSL
/*
Without SSL the handshake consists of one packet. This packet
@@ -1427,6 +1431,16 @@ mysql_execute_command(void)
res = load_master_data(thd);
break;
+#ifdef HAVE_INNOBASE_DB
+ case SQLCOM_SHOW_INNODB_STATUS:
+ {
+ if (check_process_priv(thd))
+ goto error;
+ res = innodb_show_status(thd);
+ break;
+ }
+#endif
+
case SQLCOM_LOAD_MASTER_TABLE:
{
if (!tables->db)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 296db748c03..ef2bb807efd 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1842,7 +1842,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID(pthread_mutex_unlock(&LOCK_open));
goto err;
}
-
+#ifdef HAVE_BERKELEY_DB
+ extern bool berkeley_flush_logs(void);
+ if (old_db_type == DB_TYPE_BERKELEY_DB && berkeley_flush_logs())
+ goto err;
+#endif
thd->proc_info="end";
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index d9080332bd6..a8a9237ebaf 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -261,6 +261,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NEW_SYM
%token NCHAR_SYM
%token NOT
+%token NO_FOREIGN_KEY_CHECKS
%token NO_SYM
%token NULL_SYM
%token NUM
@@ -290,6 +291,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token REAL_NUM
%token REFERENCES
%token REGEXP
+%token RELAXED_UNIQUE_CHECKS
%token RELOAD
%token RENAME
%token REPEATABLE_SYM
@@ -2704,6 +2706,8 @@ show_param:
}
| STATUS_SYM wild
{ Lex->sql_command= SQLCOM_SHOW_STATUS; }
+ | INNOBASE_SYM STATUS_SYM
+ { Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;}
| opt_full PROCESSLIST_SYM
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
| opt_var_type VARIABLES wild