diff options
48 files changed, 195 insertions, 141 deletions
diff --git a/.bzrignore b/.bzrignore index 1e89b903ac7..e794d7d51cc 100644 --- a/.bzrignore +++ b/.bzrignore @@ -923,3 +923,4 @@ Docs/Images/mydsn-trace.txt Docs/Images/mydsn.txt Docs/Images/myflowchart.txt mysql-test/mysql_test_run_new +ndb/tools/ndb_test_platform diff --git a/dbug/dbug.c b/dbug/dbug.c index 1796d883c5e..02175f8b091 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -227,14 +227,15 @@ static my_bool init_done = FALSE; /* Set to TRUE when initialization done */ static struct state *stack=0; typedef struct st_code_state { - int lineno; /* Current debugger output line number */ - int level; /* Current function nesting level */ const char *func; /* Name of current user function */ const char *file; /* Name of current user file */ char **framep; /* Pointer to current frame */ - int jmplevel; /* Remember nesting level at setjmp () */ const char *jmpfunc; /* Remember current function for setjmp */ const char *jmpfile; /* Remember current file for setjmp */ + int lineno; /* Current debugger output line number */ + int level; /* Current function nesting level */ + int disable_output; /* Set to it if output is disabled */ + int jmplevel; /* Remember nesting level at setjmp () */ /* * The following variables are used to hold the state information @@ -247,8 +248,8 @@ typedef struct st_code_state { */ uint u_line; /* User source code line number */ - const char *u_keyword; /* Keyword for current macro */ int locked; /* If locked with _db_lock_file */ + const char *u_keyword; /* Keyword for current macro */ } CODE_STATE; /* Parse a debug command string */ @@ -370,8 +371,10 @@ static CODE_STATE *code_state(void) #define code_state() (&static_code_state) #define pthread_mutex_lock(A) {} #define pthread_mutex_unlock(A) {} -static CODE_STATE static_code_state = { 0,0,"?func","?file",NULL,0,NULL, - NULL,0,"?",0}; +static CODE_STATE static_code_state= +{ + "?func", "?file", NULL, NullS, NullS, 0,0,0,0,0,0, NullS +}; #endif @@ -728,9 +731,12 @@ char ***_sframep_ __attribute__((unused))) if (DoProfile ()) { long stackused; - if (*state->framep == NULL) { + if (*state->framep == NULL) + { stackused = 0; - } else { + } + else + { stackused = ((long)(*state->framep)) - ((long)(state->framep)); stackused = stackused > 0 ? stackused : -stackused; } @@ -744,7 +750,7 @@ char ***_sframep_ __attribute__((unused))) (void) fflush (_db_pfp_); } #endif - if (DoTrace (state)) + if (DoTrace(state)) { if (!state->locked) pthread_mutex_lock(&THR_LOCK_dbug); @@ -754,7 +760,7 @@ char ***_sframep_ __attribute__((unused))) dbug_flush (state); /* This does a unlock */ } #ifdef SAFEMALLOC - if (stack -> flags & SANITY_CHECK_ON) + if (stack->flags & SANITY_CHECK_ON && !state->disable_output) if (_sanity(_file_,_line_)) /* Check of safemalloc */ stack -> flags &= ~SANITY_CHECK_ON; #endif @@ -809,9 +815,11 @@ uint *_slevel_) else { #ifdef SAFEMALLOC - if (stack -> flags & SANITY_CHECK_ON) + if (stack->flags & SANITY_CHECK_ON && !state->disable_output) + { if (_sanity(*_sfile_,_line_)) stack->flags &= ~SANITY_CHECK_ON; + } #endif #ifndef THREAD if (DoProfile ()) @@ -954,7 +962,6 @@ uint length) int pos; char dbuff[90]; CODE_STATE *state; - /* Sasha: pre-my_thread_init() safety */ if (!(state=code_state())) return; @@ -994,6 +1001,25 @@ uint length) } } + +/* + Enable/Disable output for this thread + + SYNOPSIS + _db_output_() + flag 1 = enable output, 0 = disable_output + +*/ + +void _db_output_(uint flag) +{ + CODE_STATE *state; + if (!(state=code_state())) + return; + state->disable_output= !flag; +} + + /* * FUNCTION * @@ -1159,7 +1185,7 @@ static BOOLEAN DoTrace (CODE_STATE *state) { reg2 BOOLEAN trace=FALSE; - if (TRACING && + if (TRACING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> functions, state->func) && InList (stack -> processes, _db_process_)) @@ -1195,7 +1221,7 @@ static BOOLEAN DoProfile () state=code_state(); profile = FALSE; - if (PROFILING && + if (PROFILING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> p_functions, state->func) && InList (stack -> processes, _db_process_)) @@ -1242,7 +1268,7 @@ const char *keyword) if (!(state=code_state())) return FALSE; result = FALSE; - if (DEBUGGING && + if (DEBUGGING && !state->disable_output && state->level <= stack -> maxdepth && InList (stack -> functions, state->func) && InList (stack -> keywords, keyword) && diff --git a/include/my_dbug.h b/include/my_dbug.h index 9174a8b1ef9..711ece4335c 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -38,6 +38,7 @@ extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); +extern void _db_output_(); extern void _db_lock_file(); extern void _db_unlock_file(); @@ -66,6 +67,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON _no_db_=0 #define DBUG_LOCK_FILE { _db_lock_file(); } #define DBUG_UNLOCK_FILE { _db_unlock_file(); } +#define DBUG_OUTPUT(A) { _db_output_(A); } #define DBUG_ASSERT(A) assert(A) #else /* No debugger */ @@ -86,6 +88,7 @@ extern void _db_unlock_file(); #define DEBUGGER_ON #define DBUG_LOCK_FILE #define DBUG_UNLOCK_FILE +#define DBUG_OUTPUT(A) #define DBUG_ASSERT(A) {} #endif #ifdef __cplusplus diff --git a/include/my_global.h b/include/my_global.h index f6200830ee3..07d4d8dc1cc 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -370,6 +370,12 @@ int __void__; #define LINT_INIT(var) #endif +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(HAVE_purify) +#define PURIFY_OR_LINT_INIT(var) var=0 +#else +#define PURIFY_OR_LINT_INIT(var) +#endif + /* Define some useful general macros */ #if defined(__cplusplus) && defined(__GNUC__) #define max(a, b) ((a) >? (b)) diff --git a/include/my_sys.h b/include/my_sys.h index 01a7482e4d0..a8e21ea2f98 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -214,6 +214,7 @@ extern ulong my_cache_w_requests, my_cache_write, my_cache_r_requests, my_cache_read; extern ulong my_blocks_used, my_blocks_changed; extern ulong my_file_opened,my_stream_opened, my_tmp_file_created; +extern uint mysys_usage_id; extern my_bool my_init_done; /* Point to current my_message() */ diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 67c2b0aba73..776869ff045 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -319,5 +319,4 @@ #define ER_INVALID_CHARACTER_STRING 1300 #define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 #define ER_CONFLICTING_DECLARATIONS 1302 -#define ER_NO_CONS_READ_ENGINE 1303 -#define ER_ERROR_MESSAGES 304 +#define ER_ERROR_MESSAGES 303 diff --git a/innobase/trx/trx0purge.c b/innobase/trx/trx0purge.c index 6726d7ca609..5c62640e011 100644 --- a/innobase/trx/trx0purge.c +++ b/innobase/trx/trx0purge.c @@ -1069,30 +1069,6 @@ trx_purge(void) } } - /* Determine how much data manipulation language (DML) statements - need to be delayed in order to reduce the lagging of the purge - thread. */ - srv_dml_needed_delay = 0; /* in microseconds; default: no delay */ - - /* If we cannot advance the 'purge view' because of an old - 'consistent read view', then the DML statements cannot be delayed. - Also, srv_max_purge_lag <= 0 means 'infinity'. */ - if (srv_max_purge_lag > 0 - && !UT_LIST_GET_LAST(trx_sys->view_list)) { - float ratio = (float) trx_sys->rseg_history_len - / srv_max_purge_lag; - if (ratio > ULINT_MAX / 10000) { - /* Avoid overflow: maximum delay is 4295 seconds */ - srv_dml_needed_delay = ULINT_MAX; - } else if (ratio > 1) { - /* If the history list length exceeds the - innodb_max_purge_lag, the - data manipulation statements are delayed - by at least 5000 microseconds. */ - srv_dml_needed_delay = (ulint) ((ratio - .5) * 10000); - } - } - purge_sys->view = read_view_oldest_copy_or_open_new(NULL, purge_sys->heap); mutex_exit(&kernel_mutex); diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index fcb9e5eee2d..27eae89922c 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -227,7 +227,7 @@ DO_CLIENT_GDB="" SLEEP_TIME_AFTER_RESTART=1 SLEEP_TIME_FOR_DELETE=10 SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables -SLEEP_TIME_FOR_SECOND_MASTER=30 +SLEEP_TIME_FOR_SECOND_MASTER=400 SLEEP_TIME_FOR_FIRST_SLAVE=400 SLEEP_TIME_FOR_SECOND_SLAVE=30 CHARACTER_SET=latin1 diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index 3486a879eec..60188705857 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -36,7 +36,7 @@ else exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd fi exec_waiter=$BASEDIR/bin/ndb_waiter - exec_waiter=$BASEDIR/bin/ndb_test_platform + exec_test=$BASEDIR/bin/ndb_test_platform exec_mgmtclient=$BASEDIR/bin/ndb_mgm fi diff --git a/mysys/my_init.c b/mysys/my_init.c index 0ef938b434c..e9a61b1833c 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -42,8 +42,8 @@ static void netware_init(); #define netware_init() #endif - -my_bool my_init_done=0; +my_bool my_init_done= 0; +uint mysys_usage_id= 0; /* Incremented for each my_init() */ static ulong atoi_octal(const char *str) { @@ -51,7 +51,7 @@ static ulong atoi_octal(const char *str) while (*str && my_isspace(&my_charset_latin1, *str)) str++; str2int(str, - (*str == '0' ? 8 : 10), /* Octalt or decimalt */ + (*str == '0' ? 8 : 10), /* Octalt or decimalt */ 0, INT_MAX, &tmp); return (ulong) tmp; } @@ -74,6 +74,7 @@ my_bool my_init(void) if (my_init_done) return 0; my_init_done=1; + mysys_usage_id++; #if defined(THREAD) && defined(SAFE_MUTEX) safe_mutex_global_init(); /* Must be called early */ #endif diff --git a/ndb/src/common/util/basestring_vsnprintf.c b/ndb/src/common/util/basestring_vsnprintf.c index 1b4d88679c1..8a58ca0fe5c 100644 --- a/ndb/src/common/util/basestring_vsnprintf.c +++ b/ndb/src/common/util/basestring_vsnprintf.c @@ -20,6 +20,10 @@ #include <basestring_vsnprintf.h> #include <my_config.h> + +/* + #define SNPRINTF_RETURN_TRUNC +*/ int basestring_snprintf(char *str, size_t size, const char *format, ...) { @@ -47,13 +51,27 @@ static char basestring_vsnprintf_buf[16*1024]; int basestring_vsnprintf(char *str, size_t size, const char *format, va_list ap) { - int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap); + if (size == 0) + { #ifdef SNPRINTF_RETURN_TRUNC - if (ret == size-1 || ret == -1) { - ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf, - sizeof(basestring_vsnprintf_buf), - format, ap); + return BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf, + sizeof(basestring_vsnprintf_buf), + format, ap); +#else + char buf[1]; + return BASESTRING_VSNPRINTF_FUNC(buf, 1, format, ap); +#endif } + { + int ret= BASESTRING_VSNPRINTF_FUNC(str, size, format, ap); +#ifdef SNPRINTF_RETURN_TRUNC + if (ret == size-1 || ret == -1) + { + ret= BASESTRING_VSNPRINTF_FUNC(basestring_vsnprintf_buf, + sizeof(basestring_vsnprintf_buf), + format, ap); + } #endif - return ret; + return ret; + } } diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index f1a953769b8..fde4e5a2e91 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -200,6 +200,7 @@ extern "C" { int ndb_mgmclient_handle_destroy(Ndb_mgmclient_handle h) { delete (Ndb_mgmclient*)h; + return 0; } } /* diff --git a/ndb/src/ndbapi/ndberror.c b/ndb/src/ndbapi/ndberror.c index 3815bbc79c2..0b1fdcbd0af 100644 --- a/ndb/src/ndbapi/ndberror.c +++ b/ndb/src/ndbapi/ndberror.c @@ -125,7 +125,8 @@ ErrorBundle ErrorCodes[] = { { 217, TR, "217" }, { 218, TR, "218" }, { 219, TR, "219" }, - { 233, TR, "Out of operation records in transaction coordinator" }, + { 233, TR, + "Out of operation records in transaction coordinator (increase MaxNoOfConcurrentOperations)" }, { 275, TR, "275" }, { 279, TR, "Out of transaction markers in transaction coordinator" }, { 414, TR, "414" }, @@ -138,7 +139,7 @@ ErrorBundle ErrorCodes[] = { { 830, TR, "Out of add fragment operation records" }, { 873, TR, "Out of attrinfo records for scan in tuple manager" }, { 1217, TR, "1217" }, - { 1219, TR, "Out of operation records in local data manager" }, + { 1219, TR, "Out of operation records in local data manager (increase MaxNoOfLocalOperations)" }, { 1220, TR, "1220" }, { 1222, TR, "Out of transaction markers in LQH" }, { 4021, TR, "Out of Send Buffer space in NDB API" }, @@ -150,9 +151,10 @@ ErrorBundle ErrorCodes[] = { */ { 623, IS, "623" }, { 624, IS, "624" }, - { 625, IS, "Out of memory in Ndb Kernel, index part" }, - { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes)" }, - { 827, IS, "Out of memory in Ndb Kernel, data part" }, + { 625, IS, "Out of memory in Ndb Kernel, index part (increase IndexMemory)" }, + { 800, IS, "Too many ordered indexes (increase MaxNoOfOrderedIndexes)" }, + { 826, IS, "Too many tables and attributes (increase MaxNoOfAttributes or MaxNoOfTables)" }, + { 827, IS, "Out of memory in Ndb Kernel, data part (increase DataMemory)" }, { 832, IS, "832" }, /** @@ -169,10 +171,10 @@ ErrorBundle ErrorCodes[] = { * OverloadError */ { 410, OL, "Out of log file space temporarily" }, - { 677, OL, "Index UNDO buffers overloaded" }, - { 891, OL, "Data UNDO buffers overloaded" }, - { 1221, OL, "REDO log buffers overloaded" }, - { 4006, OL, "Connect failure - out of connection objects" }, + { 677, OL, "Index UNDO buffers overloaded (increase UndoIndexBuffer)" }, + { 891, OL, "Data UNDO buffers overloaded (increase UndoDataBuffer)" }, + { 1221, OL, "REDO log buffers overloaded (increase RedoBuffer)" }, + { 4006, OL, "Connect failure - out of connection objects (increase MaxNoOfConcurrentTransactions)" }, @@ -242,9 +244,9 @@ ErrorBundle ErrorCodes[] = { { 884, AE, "Stack overflow in interpreter" }, { 885, AE, "Stack underflow in interpreter" }, { 886, AE, "More than 65535 instructions executed in interpreter" }, - { 4256, AE, "Must call Ndb::init() before this function" }, + { 4256, AE, "Must call Ndb::init() before this function" }, { 880, AE, "Tried to read too much - too many getValue calls" }, - { 4257, AE, "Tried to read too much - too many getValue calls" }, + { 4257, AE, "Tried to read too much - too many getValue calls" }, /** * Scan application errors @@ -289,7 +291,7 @@ ErrorBundle ErrorCodes[] = { { 283, SE, "Table is being dropped" }, { 284, SE, "Table not defined in transaction coordinator" }, { 285, SE, "Unknown table error in transaction coordinator" }, - { 881, SE, "Unable to create table, out of data pages" }, + { 881, SE, "Unable to create table, out of data pages (increase DataMemory) " }, { 1225, SE, "Table not defined in local query handler" }, { 1226, SE, "Table is being dropped" }, { 1228, SE, "Cannot use drop table for drop index" }, @@ -345,17 +347,11 @@ ErrorBundle ErrorCodes[] = { { 4327, AE, "Distribution Group with 1 byte attribute is not allowed" }, { 4328, AE, "Disk memory attributes not yet supported" }, { 4329, AE, "Variable stored attributes not yet supported" }, - { 4330, AE, "Table names limited to 127 bytes" }, - { 4331, AE, "Attribute names limited to 31 bytes" }, - { 4332, AE, "Maximum 2000 attributes in a table" }, - { 4333, AE, "Maximum 4092 bytes long keys allowed" }, - { 4334, AE, "Attribute properties length limited to 127 bytes" }, { 4400, AE, "Status Error in NdbSchemaCon" }, { 4401, AE, "Only one schema operation per schema transaction" }, { 4402, AE, "No schema operation defined before calling execute" }, - { 4500, AE, "Cannot handle more than 2048 tables in NdbApi" }, { 4501, AE, "Insert in hash table failed when getting table information from Ndb" }, { 4502, AE, "GetValue not allowed in Update operation" }, { 4503, AE, "GetValue not allowed in Insert operation" }, diff --git a/ndb/tools/ndb_test_platform.cpp b/ndb/tools/ndb_test_platform.cpp index 2b8bbd0274b..72dd146dacd 100644 --- a/ndb/tools/ndb_test_platform.cpp +++ b/ndb/tools/ndb_test_platform.cpp @@ -32,19 +32,21 @@ int test_snprintf(const char * fmt, int buf_sz, int result) if(ret < 0) { - printf("BaseString::snprint returns %d\n", ret); + printf("BaseString::snprint returns %d with size=%d and strlen(fmt)=%d\n", + ret, buf_sz, strlen(fmt)); return -1; } if(ret+1 == buf_sz) { - printf("BaseString::snprint truncates\n"); + printf("BaseString::snprint truncates returns %d with size=%d and strlen(fmt)=%d\n", + ret, buf_sz, strlen(fmt)); return -1; } if(ret != result) { - printf("BaseString::snprint returns incorrect value: %d != %d\n", + printf("BaseString::snprint returns incorrect value: returned=%d != expected=%d\n", ret, result); return -1; } @@ -54,7 +56,7 @@ int test_snprintf(const char * fmt, int buf_sz, int result) if(buf[ret] != fmt[ret]) { printf("BaseString::snprint Incorrect value in output buffer: " - "%d %d %d %d %d\n", + "size=%d returned=expected=%d at pos=%d result=%d != expected=%d\n", buf_sz, result, ret, buf[ret], fmt[ret]); return -1; } diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index c9e76bb8ed3..be572d7c275 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -86,7 +86,7 @@ int main(int argc, char** argv){ if (_hostName == NULL){ LocalConfig lcfg; - if(!lcfg.init()) + if(!lcfg.init(opt_connect_str, 0)) { lcfg.printError(); lcfg.printUsage(); diff --git a/scripts/fill_help_tables.sh b/scripts/fill_help_tables.sh index cb5437f7178..1f44e9fa488 100644 --- a/scripts/fill_help_tables.sh +++ b/scripts/fill_help_tables.sh @@ -197,6 +197,9 @@ sub prepare_name $a =~ s/(\@node(.*?)\n)/ /g; $a =~ s/(\@tab)/\t/g; $a =~ s/\@item/ /g; + $a =~ s/\@minus\{\}/-/g; + $a =~ s/\@var\{((.|\n)+?)\}/$1/go; + $a =~ s/\@command\{((.|\n)+?)\}/$1/go; $a =~ s/\@code\{((.|\n)+?)\}/$1/go; $a =~ s/\@strong\{(.+?)\}/$1/go; $a =~ s/\@samp\{(.+?)\}/$1/go; @@ -244,6 +247,9 @@ sub prepare_description $a =~ s/(\@item)/ /g; $a =~ s/(\@tindex\s(.*?)\n)//g; $a =~ s/(\@c\s(.*?)\n)//g; + $a =~ s/\@minus\{\}/-/g; + $a =~ s/\@var\{((.|\n)+?)\}/$1/go; + $a =~ s/\@command\{((.|\n)+?)\}/$1/go; $a =~ s/\@code\{((.|\n)+?)\}/$1/go; $a =~ s/\@strong\{(.+?)\}/$1/go; $a =~ s/\@samp\{(.+?)\}/$1/go; @@ -273,6 +279,7 @@ sub prepare_example $a =~ s/(^\@c for_help_topic(.*?)\n)//g; + $a =~ s/\@var\{((.|\n)+?)\}/$1/go; $a =~ s/\\/\\\\/g; $a =~ s/(\@{)/{/g; $a =~ s/(\@})/}/g; diff --git a/sql/field.cc b/sql/field.cc index deb38048d42..f70a23e889a 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5941,8 +5941,14 @@ Field *make_field(char *ptr, uint32 field_length, if (f_is_alpha(pack_flag)) { if (!f_is_packed(pack_flag)) - return new Field_string(ptr,field_length,null_pos,null_bit, - unireg_check, field_name, table, field_charset); + { + if (field_type == FIELD_TYPE_STRING || + field_type == FIELD_TYPE_VAR_STRING) + return new Field_string(ptr,field_length,null_pos,null_bit, + unireg_check, field_name, table, + field_charset); + return 0; // Error + } uint pack_length=calc_pack_length((enum_field_types) f_packtype(pack_flag), diff --git a/sql/handler.cc b/sql/handler.cc index 32f5ad6ff1d..5dae7950390 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -110,6 +110,7 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"", tx_isolation_names, NULL}; static TYPELIB known_extensions= {0,"known_exts", NULL, NULL}; +uint known_extensions_id= 0; enum db_type ha_resolve_by_name(const char *name, uint namelen) { @@ -785,8 +786,9 @@ int ha_start_consistent_snapshot(THD *thd) Same idea as when one wants to CREATE TABLE in one engine which does not exist: */ - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_NO_CONS_READ_ENGINE, ER(ER_NO_CONS_READ_ENGINE)); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, + "This MySQL server does not support any " + "consistent-read capable storage engine"); return 0; } @@ -1660,6 +1662,7 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key, return error; } + /* Returns a list of all known extensions. @@ -1668,20 +1671,24 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key, NOTES No mutexes, worst case race is a minor surplus memory allocation + We have to recreate the extension map if mysqld is restarted (for example + within libmysqld) RETURN VALUE pointer pointer to TYPELIB structure */ + TYPELIB *ha_known_exts(void) { - if (!known_extensions.type_names) + if (!known_extensions.type_names || mysys_usage_id != known_extensions_id) { show_table_type_st *types; List<char> found_exts; List_iterator_fast<char> it(found_exts); - const char *e, **ext; - - found_exts.push_back(".db"); + const char **ext, *old_ext; + + known_extensions_id= mysys_usage_id; + found_exts.push_back((char*) ".db"); for (types= sys_table_types; types->type; types++) { if (*types->value == SHOW_OPTION_YES) @@ -1689,28 +1696,30 @@ TYPELIB *ha_known_exts(void) handler *file= get_new_handler(0,(enum db_type) types->db_type); for (ext= file->bas_ext(); *ext; ext++) { - while (e=it++) - if (e == *ext) + while ((old_ext= it++)) + { + if (!strcmp(old_ext, *ext)) break; - - if (!e) - found_exts.push_back((char *)*ext); + } + if (!old_ext) + found_exts.push_back((char *) *ext); it.rewind(); } delete file; } } - ext= (const char **)my_once_alloc(sizeof(char *)* - (found_exts.elements+1), MYF(MY_WME)); + ext= (const char **) my_once_alloc(sizeof(char *)* + (found_exts.elements+1), + MYF(MY_WME | MY_FAE)); DBUG_ASSERT(ext); - for (uint i=0; e=it++; i++) - ext[i]= e; - ext[found_exts.elements]= 0; - known_extensions.count= found_exts.elements; known_extensions.type_names= ext; + + while ((old_ext= it++)) + *ext++= old_ext; + *ext= 0; } return &known_extensions; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 41418c0094d..d8142352e70 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -161,21 +161,24 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, { int weekday= 0, yearday= 0, daypart= 0; int week_number= -1; - CHARSET_INFO *cs= &my_charset_bin; int error= 0; - bool usa_time= 0; - bool sunday_first_n_first_week_non_iso= -2; - bool strict_week_number; int strict_week_number_year= -1; - bool strict_week_number_year_type= -1; int frac_part; + bool usa_time= 0; + bool sunday_first_n_first_week_non_iso; + bool strict_week_number; + bool strict_week_number_year_type; const char *val_begin= val; const char *val_end= val + length; const char *ptr= format->format.str; const char *end= ptr + format->format.length; + CHARSET_INFO *cs= &my_charset_bin; DBUG_ENTER("extract_date_time"); LINT_INIT(strict_week_number); + /* Remove valgrind varnings when using gcc 3.3 and -O1 */ + PURIFY_OR_LINT_INIT(strict_week_number_year_type); + PURIFY_OR_LINT_INIT(sunday_first_n_first_week_non_iso); if (!sub_pattern_end) bzero((char*) l_time, sizeof(*l_time)); diff --git a/sql/log.cc b/sql/log.cc index ef57a57d3b4..bcd99326501 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1703,6 +1703,8 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, time_t current_time; if (!is_open()) return 0; + DBUG_ENTER("MYSQL_LOG::write"); + VOID(pthread_mutex_lock(&LOCK_log)); if (is_open()) { // Safety agains reopen @@ -1712,7 +1714,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, if (!(thd->options & OPTION_UPDATE_LOG)) { VOID(pthread_mutex_unlock(&LOCK_log)); - return 0; + DBUG_RETURN(0); } if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT) || query_start_arg) { @@ -1812,7 +1814,7 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, } } VOID(pthread_mutex_unlock(&LOCK_log)); - return error; + DBUG_RETURN(error); } @@ -1832,16 +1834,19 @@ bool MYSQL_LOG::write(THD *thd,const char *query, uint query_length, THD::enter_cond() (see NOTES in sql_class.h). */ -void MYSQL_LOG:: wait_for_update(THD* thd, bool master_or_slave) +void MYSQL_LOG::wait_for_update(THD* thd, bool master_or_slave) { - const char* old_msg = thd->enter_cond(&update_cond, &LOCK_log, - master_or_slave ? - "Has read all relay log; waiting for \ -the slave I/O thread to update it" : - "Has sent all binlog to slave; \ -waiting for binlog to be updated"); + const char *old_msg; + DBUG_ENTER("wait_for_update"); + old_msg= thd->enter_cond(&update_cond, &LOCK_log, + master_or_slave ? + "Has read all relay log; waiting for the slave I/O " + "thread to update it" : + "Has sent all binlog to slave; waiting for binlog " + "to be updated"); pthread_cond_wait(&update_cond, &LOCK_log); thd->exit_cond(old_msg); + DBUG_VOID_RETURN; } @@ -2198,6 +2203,15 @@ void MYSQL_LOG::report_pos_in_innodb() DBUG_VOID_RETURN; } + +void MYSQL_LOG::signal_update() +{ + DBUG_ENTER("MYSQL_LOG::signal_update"); + pthread_cond_broadcast(&update_cond); + DBUG_VOID_RETURN; +} + + #ifdef __NT__ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, uint length, int buffLen) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 078ee19fe6a..5622ac50a7b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -540,7 +540,7 @@ static void close_connections(void) struct timespec abstime; int error; LINT_INIT(error); - DBUG_PRINT("info",("Waiting for select_thread")); + DBUG_PRINT("info",("Waiting for select thread")); #ifndef DONT_USE_THR_ALARM if (pthread_kill(select_thread,THR_CLIENT_ALARM)) diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index d352a6e82f7..022a624c921 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -331,4 +331,3 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index e84ee22d5cf..18ebe5712f8 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -322,4 +322,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index d9d33c3bf59..54377b5949a 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -331,4 +331,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index fd43a2c10c5..8ede3f61a0b 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -319,4 +319,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index ae4d5279f35..5aab524e0d9 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -324,4 +324,3 @@ character-set=latin7 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 5217133274b..355e784b156 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -319,4 +319,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 15f98d36e87..03e838dd805 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -332,4 +332,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index fae5c508320..06f31a79a73 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -319,4 +319,3 @@ character-set=greek "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 6f83de7a64d..af10c33ee2d 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -324,4 +324,3 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 7df71e92fc4..cd66f15db5f 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -319,4 +319,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 9fc2ead10d6..eaab58d8403 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -323,4 +323,3 @@ character-set=ujis "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 4e40ffc6264..1cff50432e9 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -319,4 +319,3 @@ character-set=euckr "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index d78c59357f1..27f7a18f029 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -321,4 +321,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index d0a282c444d..772f30e5d94 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -321,4 +321,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index de812697482..634a4d93f42 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -324,4 +324,3 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 262c472a4fa..c79c346008e 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -321,4 +321,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 377ebfbf698..7cb0427dc3f 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -324,4 +324,3 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 4edfd39c836..df354d5797f 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -324,4 +324,3 @@ character-set=koi8r "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index e18fa6d2811..45b56c8269c 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -312,4 +312,3 @@ character-set=cp1250 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index d935439a1ba..12c3eb2b6af 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -327,4 +327,3 @@ character-set=latin2 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 97fb1bf0be5..bd2439c44a6 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -323,4 +323,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 8de68600509..da75e4fcede 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -319,4 +319,3 @@ character-set=latin1 "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index cf44fea6553..a19cf946cb1 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -325,4 +325,3 @@ character-set=koi8u "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" "Conflicting declarations: '%s%s' and '%s%s'" -"This MySQL server does not support any consistent-read capable storage engine" diff --git a/sql/slave.cc b/sql/slave.cc index d5278e06d8a..b6ad35573ff 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2635,7 +2635,7 @@ static int request_dump(MYSQL* mysql, MASTER_INFO* mi, DBUG_ENTER("request_dump"); // TODO if big log files: Change next to int8store() - int4store(buf, (longlong) mi->master_log_pos); + int4store(buf, (ulong) mi->master_log_pos); int2store(buf + 4, binlog_flags); int4store(buf + 6, server_id); len = (uint) strlen(logname); diff --git a/sql/sql_class.h b/sql/sql_class.h index df6be559df2..312d9de9794 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -131,7 +131,7 @@ public: DBUG_VOID_RETURN; } void set_max_size(ulong max_size_arg); - void signal_update() { pthread_cond_broadcast(&update_cond);} + void signal_update(); void wait_for_update(THD* thd, bool master_or_slave); void set_need_start_event() { need_start_event = 1; } void init(enum_log_type log_type_arg, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9b1cac63e50..9d755731cb7 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1610,15 +1610,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #ifndef EMBEDDED_LIBRARY case COM_BINLOG_DUMP: { + ulong pos; + ushort flags; + uint32 slave_server_id; + statistic_increment(com_other,&LOCK_status); thd->slow_command = TRUE; if (check_global_access(thd, REPL_SLAVE_ACL)) break; - mysql_log.write(thd,command, 0); - ulong pos; - ushort flags; - uint32 slave_server_id; /* TODO: The following has to be changed to an 8 byte integer */ pos = uint4korr(packet); flags = uint2korr(packet + 4); @@ -1626,6 +1626,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if ((slave_server_id= uint4korr(packet+6))) // mysqlbinlog.server_id==0 kill_zombie_dump_threads(slave_server_id); thd->server_id = slave_server_id; + + mysql_log.write(thd, command, "Log: '%s' Pos: %ld", packet+10, + (long) pos); mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags); unregister_slave(thd,1,1); // fake COM_QUIT -- if we get here, the thread needs to terminate diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1852101fcfb..d842b4b66bb 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2111,6 +2111,7 @@ start_transaction_opts: { $$= MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT; } + ; slave_thread_opts: { Lex->slave_thd_opt= 0; } @@ -5627,7 +5628,7 @@ revoke_command: grant_privileges ON opt_table FROM user_list {} | - ALL PRIVILEGES ',' GRANT OPTION FROM user_list + ALL opt_privileges ',' GRANT OPTION FROM user_list { Lex->sql_command = SQLCOM_REVOKE_ALL; } @@ -5653,10 +5654,14 @@ grant: grant_privileges: grant_privilege_list {} - | ALL PRIVILEGES { Lex->grant = GLOBAL_ACLS;} - | ALL { Lex->grant = GLOBAL_ACLS;} + | ALL opt_privileges { Lex->grant = GLOBAL_ACLS;} ; +opt_privileges: + /* empty */ + | PRIVILEGES + ; + grant_privilege_list: grant_privilege | grant_privilege_list ',' grant_privilege; |