Merge bk-internal.mysql.com:/home/bk/mysql-5.1

into  mysql.com:/home/my/mysql-5.1


sql/Makefile.am:
  Auto merged
sql/handler.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Manual merge
This commit is contained in:
unknown 2006-11-01 19:46:23 +02:00
commit 2fec8851f6
28 changed files with 126 additions and 77 deletions

View File

@ -65,7 +65,7 @@ __MYSQL_DECLARE_PLUGIN(NAME, \
builtin_ ## NAME ## _sizeof_struct_st_plugin, \ builtin_ ## NAME ## _sizeof_struct_st_plugin, \
builtin_ ## NAME ## _plugin) builtin_ ## NAME ## _plugin)
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0}} #define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}}
/* /*
declarations for SHOW STATUS support in plugins declarations for SHOW STATUS support in plugins

View File

@ -1633,7 +1633,7 @@ sub environment_setup () {
# ---------------------------------------------------- # ----------------------------------------------------
# We are nice and report a bit about our settings # We are nice and report a bit about our settings
# ---------------------------------------------------- # ----------------------------------------------------
if (!$opt_extern) if (!$opt_extern && $opt_verbose)
{ {
print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n"; print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n"; print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
@ -2270,6 +2270,11 @@ sub initialize_servers () {
} }
check_running_as_root(); check_running_as_root();
} }
else
{
# We have to create the 'var' and related directories
cleanup_stale_files();
}
} }
sub mysql_install_db () { sub mysql_install_db () {
@ -2590,17 +2595,19 @@ sub do_before_run_mysqltest($)
} }
# MASV cleanup... if (!$opt_extern)
{
# MASV cleanup...
mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
# output current test to ndbcluster log file to enable diagnostics # output current test to ndbcluster log file to enable diagnostics
mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n"); mtr_tofile($file_ndb_testrun_log,"CURRENT TEST $tname\n");
mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n"); mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
if ( $master->[1]->{'pid'} ) if ( $master->[1]->{'pid'} ) {
{
mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n"); mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
} }
}
} }
sub do_after_run_mysqltest($) sub do_after_run_mysqltest($)

View File

@ -1351,7 +1351,7 @@ Abstract_option_cmd::get_instance_options_list(const LEX_STRING *instance_name)
int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id) int Abstract_option_cmd::execute_impl(st_net *net, ulong connection_id)
{ {
int err_code; int err_code= 0;
/* Check that all the specified instances exist and are offline. */ /* Check that all the specified instances exist and are offline. */

View File

@ -158,7 +158,7 @@ void Guardian_thread::process_instance(Instance *instance,
{ {
/* clear status fields */ /* clear status fields */
log_info("guardian: instance %s is running, set state to STARTED", log_info("guardian: instance %s is running, set state to STARTED",
instance->options.instance_name); instance->options.instance_name.str);
current_node->restart_counter= 0; current_node->restart_counter= 0;
current_node->crash_moment= 0; current_node->crash_moment= 0;
current_node->state= STARTED; current_node->state= STARTED;
@ -169,7 +169,7 @@ void Guardian_thread::process_instance(Instance *instance,
switch (current_node->state) { switch (current_node->state) {
case NOT_STARTED: case NOT_STARTED:
log_info("guardian: starting instance %s", log_info("guardian: starting instance %s",
instance->options.instance_name); instance->options.instance_name.str);
/* NOTE, set state to STARTING _before_ start() is called */ /* NOTE, set state to STARTING _before_ start() is called */
current_node->state= STARTING; current_node->state= STARTING;
@ -194,7 +194,7 @@ void Guardian_thread::process_instance(Instance *instance,
{ {
instance->start(); instance->start();
log_info("guardian: starting instance %s", log_info("guardian: starting instance %s",
instance->options.instance_name); instance->options.instance_name.str);
} }
} }
else else
@ -212,13 +212,13 @@ void Guardian_thread::process_instance(Instance *instance,
current_node->last_checked= current_time; current_node->last_checked= current_time;
current_node->restart_counter++; current_node->restart_counter++;
log_info("guardian: restarting instance %s", log_info("guardian: restarting instance %s",
instance->options.instance_name); instance->options.instance_name.str);
} }
} }
else else
{ {
log_info("guardian: cannot start instance %s. Abandoning attempts " log_info("guardian: cannot start instance %s. Abandoning attempts "
"to (re)start it", instance->options.instance_name); "to (re)start it", instance->options.instance_name.str);
current_node->state= CRASHED_AND_ABANDONED; current_node->state= CRASHED_AND_ABANDONED;
} }
} }

View File

@ -166,7 +166,7 @@ static int start_process(Instance_options *instance_options,
exit(1); exit(1);
case -1: case -1:
log_info("cannot create a new process to start instance %s", log_info("cannot create a new process to start instance %s",
instance_options->instance_name); instance_options->instance_name.str);
return 1; return 1;
} }
return 0; return 0;
@ -311,9 +311,9 @@ void Instance::remove_pid()
int pid; int pid;
if ((pid= options.get_pid()) != 0) /* check the pidfile */ if ((pid= options.get_pid()) != 0) /* check the pidfile */
if (options.unlink_pidfile()) /* remove stalled pidfile */ if (options.unlink_pidfile()) /* remove stalled pidfile */
log_error("cannot remove pidfile for instance %i, this might be \ log_error("cannot remove pidfile for instance %s, this might be "
since IM lacks permmissions or hasn't found the pidifle", "since IM lacks permmissions or hasn't found the pidfile",
options.instance_name); options.instance_name.str);
} }
@ -619,7 +619,7 @@ void Instance::kill_instance(int signum)
log_error("The instance %s is being stopped forcibly. Normally" \ log_error("The instance %s is being stopped forcibly. Normally" \
"it should not happen. Probably the instance has been" \ "it should not happen. Probably the instance has been" \
"hanging. You should also check your IM setup", "hanging. You should also check your IM setup",
options.instance_name); options.instance_name.str);
/* After sucessful hard kill the pidfile need to be removed */ /* After sucessful hard kill the pidfile need to be removed */
options.unlink_pidfile(); options.unlink_pidfile();
} }

View File

@ -182,7 +182,7 @@ int Instance_options::fill_instance_version()
err: err:
if (rc) if (rc)
log_error("fill_instance_version: Failed to get version of '%s'", log_error("fill_instance_version: Failed to get version of '%s'",
mysqld_path); mysqld_path.str);
return rc; return rc;
} }

View File

@ -165,7 +165,7 @@ Mysql_connection_thread::~Mysql_connection_thread()
void Mysql_connection_thread::run() void Mysql_connection_thread::run()
{ {
log_info("accepted mysql connection %d", connection_id); log_info("accepted mysql connection %lu", connection_id);
my_thread_init(); my_thread_init();
@ -175,7 +175,7 @@ void Mysql_connection_thread::run()
return; return;
} }
log_info("connection %d is checked successfully", connection_id); log_info("connection %lu is checked successfully", connection_id);
vio_keepalive(vio, TRUE); vio_keepalive(vio, TRUE);
@ -314,7 +314,7 @@ int Mysql_connection_thread::do_command()
packet= (char*) net.read_pos; packet= (char*) net.read_pos;
enum enum_server_command command= (enum enum_server_command) enum enum_server_command command= (enum enum_server_command)
(uchar) *packet; (uchar) *packet;
log_info("connection %d: packet_length=%d, command=%d", log_info("connection %lu: packet_length=%lu, command=%d",
connection_id, packet_length, command); connection_id, packet_length, command);
return dispatch_command(command, packet + 1, packet_length - 1); return dispatch_command(command, packet + 1, packet_length - 1);
} }
@ -325,27 +325,27 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command,
{ {
switch (command) { switch (command) {
case COM_QUIT: // client exit case COM_QUIT: // client exit
log_info("query for connection %d received quit command", connection_id); log_info("query for connection %lu received quit command", connection_id);
return 1; return 1;
case COM_PING: case COM_PING:
log_info("query for connection %d received ping command", connection_id); log_info("query for connection %lu received ping command", connection_id);
net_send_ok(&net, connection_id, NULL); net_send_ok(&net, connection_id, NULL);
break; break;
case COM_QUERY: case COM_QUERY:
{ {
log_info("query for connection %d : ----\n%s\n-------------------------", log_info("query for connection %lu : ----\n%s\n-------------------------",
connection_id,packet); connection_id,packet);
if (Command *command= parse_command(&instance_map, packet)) if (Command *command= parse_command(&instance_map, packet))
{ {
int res= 0; int res= 0;
log_info("query for connection %d successfully parsed",connection_id); log_info("query for connection %lu successfully parsed",connection_id);
res= command->execute(&net, connection_id); res= command->execute(&net, connection_id);
delete command; delete command;
if (!res) if (!res)
log_info("query for connection %d executed ok",connection_id); log_info("query for connection %lu executed ok",connection_id);
else else
{ {
log_info("query for connection %d executed err=%d",connection_id,res); log_info("query for connection %lu executed err=%d",connection_id,res);
net_send_error(&net, res); net_send_error(&net, res);
return 0; return 0;
} }
@ -358,7 +358,7 @@ int Mysql_connection_thread::dispatch_command(enum enum_server_command command,
break; break;
} }
default: default:
log_info("query for connection %d received unknown command",connection_id); log_info("query for connection %lu received unknown command",connection_id);
net_send_error(&net, ER_UNKNOWN_COM_ERROR); net_send_error(&net, ER_UNKNOWN_COM_ERROR);
break; break;
} }

View File

@ -273,7 +273,7 @@ Command *parse_command(Instance_map *map, const char *text)
{ {
uint word_len; uint word_len;
LEX_STRING instance_name; LEX_STRING instance_name;
Command *command; Command *command= 0;
const char *saved_text= text; const char *saved_text= text;
Token tok1= shift_token(&text, &word_len); Token tok1= shift_token(&text, &word_len);

View File

@ -74,11 +74,10 @@ int User::init(const char *line)
password_length= strlen(password); password_length= strlen(password);
if (password_length > SCRAMBLED_PASSWORD_CHAR_LENGTH) if (password_length > SCRAMBLED_PASSWORD_CHAR_LENGTH)
{ {
log_info("Error: password is too long (%d). Max length: %d. ", log_info("Error: password is too long (%d). Max length: %d. User line: '%s'.",
"User line: '%s'.",
(int) password_length, (int) password_length,
(int) SCRAMBLED_PASSWORD_CHAR_LENGTH, (int) SCRAMBLED_PASSWORD_CHAR_LENGTH,
(const char *) line); line);
return 1; return 1;
} }

View File

@ -151,9 +151,12 @@ mysql_tzinfo_to_sql.o: $(mysql_tzinfo_to_sql_SOURCES)
# things like different grammars for different pars of MySQL can # things like different grammars for different pars of MySQL can
# happen if you are unlucky. # happen if you are unlucky.
sql_yacc.cc: sql_yacc.yy sql_yacc.cc: sql_yacc.yy
sql_yacc.h: sql_yacc.yy sql_yacc.h: sql_yacc.yy
sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS) sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
@SED@ -e 's/__attribute__ ((__unused__))//' sql_yacc.cc > sql_yacc.cc-new
@MV@ sql_yacc.cc-new sql_yacc.cc
@echo "Note: The following compile may take a long time." @echo "Note: The following compile may take a long time."
@echo "If it fails, re-run configure with --with-low-memory" @echo "If it fails, re-run configure with --with-low-memory"
$(CXXCOMPILE) $(LM_CFLAGS) -c $< $(CXXCOMPILE) $(LM_CFLAGS) -c $<

View File

@ -6511,7 +6511,7 @@ static int ndbcluster_init(void *p)
} }
{ {
char buf[128]; char buf[128];
my_snprintf(buf, sizeof(buf), "mysqld --server-id=%d", server_id); my_snprintf(buf, sizeof(buf), "mysqld --server-id=%lu", server_id);
g_ndb_cluster_connection->set_name(buf); g_ndb_cluster_connection->set_name(buf);
} }
g_ndb_cluster_connection->set_optimized_node_selection g_ndb_cluster_connection->set_optimized_node_selection
@ -7268,7 +7268,7 @@ int handle_trailing_share(NDB_SHARE *share)
share->key_length= min_key_length; share->key_length= min_key_length;
} }
share->key_length= share->key_length=
my_snprintf(share->key, min_key_length + 1, "#leak%d", my_snprintf(share->key, min_key_length + 1, "#leak%lu",
trailing_share_id++); trailing_share_id++);
} }
/* Keep it for possible the future trailing free */ /* Keep it for possible the future trailing free */
@ -9805,12 +9805,12 @@ ndbcluster_show_status(handlerton *hton, THD* thd, stat_print_fn *stat_print,
update_status_variables(g_ndb_cluster_connection); update_status_variables(g_ndb_cluster_connection);
buflen= buflen=
my_snprintf(buf, sizeof(buf), my_snprintf(buf, sizeof(buf),
"cluster_node_id=%u, " "cluster_node_id=%ld, "
"connected_host=%s, " "connected_host=%s, "
"connected_port=%u, " "connected_port=%ld, "
"number_of_data_nodes=%u, " "number_of_data_nodes=%ld, "
"number_of_ready_data_nodes=%u, " "number_of_ready_data_nodes=%ld, "
"connect_count=%u", "connect_count=%ld",
ndb_cluster_node_id, ndb_cluster_node_id,
ndb_connected_host, ndb_connected_host,
ndb_connected_port, ndb_connected_port,
@ -10696,7 +10696,8 @@ static int ndbcluster_fill_files_table(handlerton *hton,
table->field[IS_FILES_VERSION]->store(uf.getObjectVersion()); table->field[IS_FILES_VERSION]->store(uf.getObjectVersion());
char extra[100]; char extra[100];
int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",id,lfg.getUndoBufferSize()); int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u;UNDO_BUFFER_SIZE=%lu",
id, (ulong) lfg.getUndoBufferSize());
table->field[IS_FILES_EXTRA]->set_notnull(); table->field[IS_FILES_EXTRA]->set_notnull();
table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info); table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table); schema_table_store_record(thd, table);
@ -10713,7 +10714,6 @@ static int ndbcluster_fill_files_table(handlerton *hton,
for (i= 0; i < lfglist.count; i++) for (i= 0; i < lfglist.count; i++)
{ {
NdbDictionary::Dictionary::List::Element& elt= lfglist.elements[i]; NdbDictionary::Dictionary::List::Element& elt= lfglist.elements[i];
unsigned id;
NdbDictionary::LogfileGroup lfg= dict->getLogfileGroup(elt.name); NdbDictionary::LogfileGroup lfg= dict->getLogfileGroup(elt.name);
ndberr= dict->getNdbError(); ndberr= dict->getNdbError();
@ -10751,7 +10751,7 @@ static int ndbcluster_fill_files_table(handlerton *hton,
char extra[100]; char extra[100];
int len= my_snprintf(extra,sizeof(extra), int len= my_snprintf(extra,sizeof(extra),
"UNDO_BUFFER_SIZE=%lu", "UNDO_BUFFER_SIZE=%lu",
lfg.getUndoBufferSize()); (ulong) lfg.getUndoBufferSize());
table->field[IS_FILES_EXTRA]->set_notnull(); table->field[IS_FILES_EXTRA]->set_notnull();
table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info); table->field[IS_FILES_EXTRA]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table); schema_table_store_record(thd, table);

View File

@ -3907,7 +3907,7 @@ err:
close_thread_tables(thd); close_thread_tables(thd);
pthread_mutex_lock(&injector_mutex); pthread_mutex_lock(&injector_mutex);
/* don't mess with the injector_ndb anymore from other threads */ /* don't mess with the injector_ndb anymore from other threads */
int ndb_obj_cnt= 1; // g_ndb uint ndb_obj_cnt= 1; // g_ndb
ndb_obj_cnt+= injector_ndb == 0 ? 0 : 1; ndb_obj_cnt+= injector_ndb == 0 ? 0 : 1;
ndb_obj_cnt+= schema_ndb == 0 ? 0 : 1; ndb_obj_cnt+= schema_ndb == 0 ? 0 : 1;
ndb_obj_cnt+= ndbcluster_util_inited ? 1 : 0; ndb_obj_cnt+= ndbcluster_util_inited ? 1 : 0;
@ -3930,7 +3930,8 @@ err:
* otherwise user thread can have ongoing SUB_DATA * otherwise user thread can have ongoing SUB_DATA
*/ */
int sleep_cnt= 0; int sleep_cnt= 0;
while (sleep_cnt < 300 && g_ndb_cluster_connection->get_active_ndb_objects() > ndb_obj_cnt) while (sleep_cnt < 300 &&
g_ndb_cluster_connection->get_active_ndb_objects() > ndb_obj_cnt)
{ {
my_sleep(10000); // 10ms my_sleep(10000); // 10ms
sleep_cnt++; sleep_cnt++;

View File

@ -2958,15 +2958,15 @@ static my_bool binlog_func_list(THD *thd, st_plugin_int *plugin, void *arg)
static my_bool binlog_func_foreach(THD *thd, binlog_func_st *bfn) static my_bool binlog_func_foreach(THD *thd, binlog_func_st *bfn)
{ {
handlerton *hton;
hton_list_st hton_list; hton_list_st hton_list;
uint i, sz;
hton_list.sz= 0; hton_list.sz= 0;
plugin_foreach(thd, binlog_func_list, plugin_foreach(thd, binlog_func_list,
MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list); MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
uint i= 0, sz= hton_list.sz; for (i= 0, sz= hton_list.sz; i < sz ; i++)
while(i < sz) hton_list.hton[i]->binlog_func(hton_list.hton[i], thd, bfn->fn, bfn->arg);
hton_list.hton[i++]->binlog_func(hton, thd, bfn->fn, bfn->arg);
return FALSE; return FALSE;
} }

View File

@ -275,6 +275,9 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
my_bitmap_map *old_write_map; my_bitmap_map *old_write_map;
my_bitmap_map *old_read_map; my_bitmap_map *old_read_map;
LINT_INIT(old_write_map);
LINT_INIT(old_read_map);
if (table) if (table)
{ {
old_write_map= dbug_tmp_use_all_columns(table, table->write_set); old_write_map= dbug_tmp_use_all_columns(table, table->write_set);

View File

@ -1249,6 +1249,11 @@ bool get_interval_value(Item *args,interval_type int_type,
interval->second= array[0]; interval->second= array[0];
interval->second_part= array[1]; interval->second_part= array[1];
break; break;
/* purecov: begin deadcode */
case INTERVAL_LAST:
DBUG_ASSERT(0);
break;
/* purecov: end */
} }
return 0; return 0;
} }
@ -2088,6 +2093,7 @@ void Item_extract::fix_length_and_dec()
case INTERVAL_HOUR_MICROSECOND: max_length=13; date_value=0; break; case INTERVAL_HOUR_MICROSECOND: max_length=13; date_value=0; break;
case INTERVAL_MINUTE_MICROSECOND: max_length=11; date_value=0; break; case INTERVAL_MINUTE_MICROSECOND: max_length=11; date_value=0; break;
case INTERVAL_SECOND_MICROSECOND: max_length=9; date_value=0; break; case INTERVAL_SECOND_MICROSECOND: max_length=9; date_value=0; break;
case INTERVAL_LAST: DBUG_ASSERT(0); break; /* purecov: deadcode */
} }
} }
@ -2157,6 +2163,8 @@ longlong Item_extract::val_int()
ltime.second_part)*neg; ltime.second_part)*neg;
case INTERVAL_SECOND_MICROSECOND: return ((longlong)ltime.second*1000000L+ case INTERVAL_SECOND_MICROSECOND: return ((longlong)ltime.second*1000000L+
ltime.second_part)*neg; ltime.second_part)*neg;
case INTERVAL_LAST: DBUG_ASSERT(0); return(0); /* purecov: deadcode */
/* purecov: end */
} }
return 0; // Impossible return 0; // Impossible
} }
@ -2271,7 +2279,7 @@ String *Item_char_typecast::val_str(String *str)
{ // Safe even if const arg { // Safe even if const arg
char char_type[40]; char char_type[40];
my_snprintf(char_type, sizeof(char_type), "%s(%lu)", my_snprintf(char_type, sizeof(char_type), "%s(%lu)",
cast_cs == &my_charset_bin ? "BINARY" : "CHAR", length); cast_cs == &my_charset_bin ? "BINARY" : "CHAR", (ulong) length);
if (!res->alloced_length()) if (!res->alloced_length())
{ // Don't change const str { // Don't change const str

View File

@ -2010,7 +2010,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
goto err; goto err;
/* command_type, thread_id */ /* command_type, thread_id */
length= my_snprintf(buff, 32, "%5ld ", thread_id); length= my_snprintf(buff, 32, "%5ld ", (long) thread_id);
if (my_b_write(&log_file, (byte*) buff, length)) if (my_b_write(&log_file, (byte*) buff, length))
goto err; goto err;

View File

@ -1609,7 +1609,7 @@ static void network_init(void)
if (strlen(mysqld_unix_port) > (sizeof(UNIXaddr.sun_path) - 1)) if (strlen(mysqld_unix_port) > (sizeof(UNIXaddr.sun_path) - 1))
{ {
sql_print_error("The socket file path is too long (> %lu): %s", sql_print_error("The socket file path is too long (> %u): %s",
sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port); sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port);
unireg_abort(1); unireg_abort(1);
} }
@ -3506,7 +3506,7 @@ int main(int argc, char **argv)
{ {
if (global_system_variables.log_warnings) if (global_system_variables.log_warnings)
sql_print_warning("Asked for %ld thread stack, but got %ld", sql_print_warning("Asked for %ld thread stack, but got %ld",
thread_stack, stack_size); thread_stack, (long) stack_size);
#if defined(__ia64__) || defined(__ia64) #if defined(__ia64__) || defined(__ia64)
thread_stack= stack_size*2; thread_stack= stack_size*2;
#else #else
@ -5315,7 +5315,7 @@ master-ssl",
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"merge", OPT_MERGE, "Enable Merge storage engine. Disable with \ {"merge", OPT_MERGE, "Enable Merge storage engine. Disable with \
--skip-merge.", --skip-merge.",
(gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0}, (gptr*) &opt_merge, (gptr*) &opt_merge, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"myisam-recover", OPT_MYISAM_RECOVER, {"myisam-recover", OPT_MYISAM_RECOVER,
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.", "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
(gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0, (gptr*) &myisam_recover_options_str, (gptr*) &myisam_recover_options_str, 0,

View File

@ -485,6 +485,8 @@ bool partition_info::check_range_constants()
DBUG_ENTER("partition_info::check_range_constants"); DBUG_ENTER("partition_info::check_range_constants");
DBUG_PRINT("enter", ("INT_RESULT with %d parts", no_parts)); DBUG_PRINT("enter", ("INT_RESULT with %d parts", no_parts));
LINT_INIT(current_largest);
part_result_type= INT_RESULT; part_result_type= INT_RESULT;
range_int_array= (longlong*)sql_alloc(no_parts * sizeof(longlong)); range_int_array= (longlong*)sql_alloc(no_parts * sizeof(longlong));
if (unlikely(range_int_array == NULL)) if (unlikely(range_int_array == NULL))
@ -877,7 +879,6 @@ void partition_info::print_no_partition_found(TABLE *table)
bool partition_info::set_up_charset_field_preps() bool partition_info::set_up_charset_field_preps()
{ {
Field *field, **ptr; Field *field, **ptr;
char *field_buf;
char **char_ptrs; char **char_ptrs;
unsigned i; unsigned i;
bool found; bool found;
@ -919,6 +920,7 @@ bool partition_info::set_up_charset_field_preps()
{ {
if (field_is_partition_charset(field)) if (field_is_partition_charset(field))
{ {
char *field_buf;
CHARSET_INFO *cs= ((Field_str*)field)->charset(); CHARSET_INFO *cs= ((Field_str*)field)->charset();
size= field->pack_length(); size= field->pack_length();
if (!(field_buf= sql_calloc(size))) if (!(field_buf= sql_calloc(size)))
@ -956,6 +958,8 @@ bool partition_info::set_up_charset_field_preps()
unsigned j= 0; unsigned j= 0;
Field *part_field; Field *part_field;
CHARSET_INFO *cs; CHARSET_INFO *cs;
char *field_buf;
LINT_INIT(field_buf);
if (!field_is_partition_charset(field)) if (!field_is_partition_charset(field))
continue; continue;

View File

@ -79,6 +79,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
if (net && net->no_send_error) if (net && net->no_send_error)
{ {
thd->clear_error(); thd->clear_error();
thd->is_fatal_error= 0; // Error message is given
DBUG_PRINT("info", ("sending error messages prohibited")); DBUG_PRINT("info", ("sending error messages prohibited"));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -111,7 +112,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
net_send_error_packet(thd, sql_errno, err); net_send_error_packet(thd, sql_errno, err);
thd->is_fatal_error=0; // Error message is given thd->is_fatal_error= 0; // Error message is given
thd->net.report_error= 0; thd->net.report_error= 0;
/* Abort multi-result sets */ /* Abort multi-result sets */
@ -156,6 +157,7 @@ net_printf_error(THD *thd, uint errcode, ...)
if (net && net->no_send_error) if (net && net->no_send_error)
{ {
thd->clear_error(); thd->clear_error();
thd->is_fatal_error= 0; // Error message is given
DBUG_PRINT("info", ("sending error messages prohibited")); DBUG_PRINT("info", ("sending error messages prohibited"));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -1143,6 +1143,7 @@ sp_head::execute(THD *thd)
ctx->clear_handler(); ctx->clear_handler();
ctx->enter_handler(hip); ctx->enter_handler(hip);
thd->clear_error(); thd->clear_error();
thd->is_fatal_error= 0;
thd->killed= THD::NOT_KILLED; thd->killed= THD::NOT_KILLED;
continue; continue;
} }
@ -1170,8 +1171,9 @@ sp_head::execute(THD *thd)
state= EXECUTED; state= EXECUTED;
done: done:
DBUG_PRINT("info", ("err_status: %d killed: %d query_error: %d", DBUG_PRINT("info", ("err_status: %d killed: %d query_error: %d report_error: %d",
err_status, thd->killed, thd->query_error)); err_status, thd->killed, thd->query_error,
thd->net.report_error));
if (thd->killed) if (thd->killed)
err_status= TRUE; err_status= TRUE;
@ -2375,6 +2377,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
bool open_tables, sp_instr* instr) bool open_tables, sp_instr* instr)
{ {
int res= 0; int res= 0;
DBUG_ENTER("reset_lex_and_exec_core");
DBUG_ASSERT(!thd->derived_tables); DBUG_ASSERT(!thd->derived_tables);
DBUG_ASSERT(thd->change_list.is_empty()); DBUG_ASSERT(thd->change_list.is_empty());
@ -2419,7 +2422,10 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
res= -1; res= -1;
if (!res) if (!res)
{
res= instr->exec_core(thd, nextp); res= instr->exec_core(thd, nextp);
DBUG_PRINT("info",("exec_core returned: %d", res));
}
m_lex->unit.cleanup(); m_lex->unit.cleanup();
@ -2457,7 +2463,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
cleanup_items() is called in sp_head::execute() cleanup_items() is called in sp_head::execute()
*/ */
return res || thd->net.report_error; DBUG_RETURN(res || thd->net.report_error);
} }

View File

@ -6558,6 +6558,8 @@ static bool
has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables) has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables)
{ {
char *first_table_name= NULL, *first_db; char *first_table_name= NULL, *first_db;
LINT_INIT(first_db);
for (TABLE_LIST *table= tables; table; table= table->next_global) for (TABLE_LIST *table= tables; table; table= table->next_global)
{ {
/* we must do preliminary checks as table->table may be NULL */ /* we must do preliminary checks as table->table may be NULL */

View File

@ -1449,10 +1449,12 @@ public:
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
inline void clear_error() inline void clear_error()
{ {
DBUG_ENTER("clear_error");
net.last_error[0]= 0; net.last_error[0]= 0;
net.last_errno= 0; net.last_errno= 0;
net.report_error= 0; net.report_error= 0;
query_error= 0; query_error= 0;
DBUG_VOID_RETURN;
} }
inline bool vio_ok() const { return net.vio != 0; } inline bool vio_ok() const { return net.vio != 0; }
#else #else

View File

@ -261,6 +261,8 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
TABLE *table= insert_table_list->table; TABLE *table= insert_table_list->table;
my_bool timestamp_mark; my_bool timestamp_mark;
LINT_INIT(timestamp_mark);
if (table->timestamp_field) if (table->timestamp_field)
{ {
/* /*
@ -1699,7 +1701,7 @@ static int
write_delayed(THD *thd,TABLE *table, enum_duplicates duplic, write_delayed(THD *thd,TABLE *table, enum_duplicates duplic,
LEX_STRING query, bool ignore, bool log_on) LEX_STRING query, bool ignore, bool log_on)
{ {
delayed_row *row; delayed_row *row= 0;
delayed_insert *di=thd->di; delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc; const Discrete_interval *forced_auto_inc;
DBUG_ENTER("write_delayed"); DBUG_ENTER("write_delayed");
@ -2306,14 +2308,18 @@ bool delayed_insert::handle_inserts(void)
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
DBUG_EXECUTE("error", max_rows= 0;); #ifndef DBUG_OFF
max_rows= 0; // For DBUG output
#endif
/* Remove all not used rows */ /* Remove all not used rows */
while ((row=rows.get())) while ((row=rows.get()))
{ {
delete row; delete row;
thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status); thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
stacked_inserts--; stacked_inserts--;
DBUG_EXECUTE("error", max_rows++;); #ifndef DBUG_OFF
max_rows++;
#endif
} }
DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows)); DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows));
thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status); thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);

View File

@ -4633,8 +4633,11 @@ end_with_restore_list:
send_ok(thd, (ulong) (thd->row_count_func < 0 ? 0 : send_ok(thd, (ulong) (thd->row_count_func < 0 ? 0 :
thd->row_count_func)); thd->row_count_func));
else else
{
DBUG_ASSERT(thd->net.report_error == 1 || thd->killed);
goto error; // Substatement should already have sent error goto error; // Substatement should already have sent error
} }
}
break; break;
} }
case SQLCOM_ALTER_PROCEDURE: case SQLCOM_ALTER_PROCEDURE:
@ -4918,7 +4921,7 @@ end_with_restore_list:
LEX_STRING *name; LEX_STRING *name;
int i; int i;
for (i= 0; name= names++; i++) for (i= 0; (name= names++); i++)
{ {
buff.append(i ? ", " : "("); buff.append(i ? ", " : "(");
append_identifier(thd, &buff, name->str, name->length); append_identifier(thd, &buff, name->str, name->length);

View File

@ -502,7 +502,7 @@ void plugin_deinitialize(struct st_plugin_int *plugin)
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin)) if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
{ {
sql_print_error("Plugin '%s' of type %s failed deinitialization", sql_print_error("Plugin '%s' of type %s failed deinitialization",
plugin->name.str, plugin_type_names[plugin->plugin->type]); plugin->name.str, plugin_type_names[plugin->plugin->type].str);
} }
} }
else if (plugin->plugin->deinit) else if (plugin->plugin->deinit)
@ -562,7 +562,7 @@ static int plugin_initialize(struct st_plugin_int *plugin)
if ((*plugin_type_initialize[plugin->plugin->type])(plugin)) if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
{ {
sql_print_error("Plugin '%s' registration as a %s failed.", sql_print_error("Plugin '%s' registration as a %s failed.",
plugin->name.str, plugin_type_names[plugin->plugin->type]); plugin->name.str, plugin_type_names[plugin->plugin->type].str);
goto err; goto err;
} }
} }

View File

@ -3605,7 +3605,7 @@ best_access_path(JOIN *join,
double best= DBL_MAX; double best= DBL_MAX;
double best_time= DBL_MAX; double best_time= DBL_MAX;
double records= DBL_MAX; double records= DBL_MAX;
table_map best_ref_depends_map; table_map best_ref_depends_map= 0;
double tmp; double tmp;
ha_rows rec; ha_rows rec;
@ -10106,6 +10106,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
enum_nested_loop_state error= NESTED_LOOP_OK; enum_nested_loop_state error= NESTED_LOOP_OK;
JOIN_TAB *join_tab; JOIN_TAB *join_tab;
DBUG_ENTER("do_select"); DBUG_ENTER("do_select");
LINT_INIT(join_tab);
join->procedure=procedure; join->procedure=procedure;
join->tmp_table= table; /* Save for easy recursion */ join->tmp_table= table; /* Save for easy recursion */
@ -10136,9 +10137,9 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
*/ */
if (!join->conds || join->conds->val_int()) if (!join->conds || join->conds->val_int())
{ {
error= (*end_select)(join,join_tab,0); error= (*end_select)(join, 0, 0);
if (error == NESTED_LOOP_OK || error == NESTED_LOOP_QUERY_LIMIT) if (error == NESTED_LOOP_OK || error == NESTED_LOOP_QUERY_LIMIT)
error= (*end_select)(join,join_tab,1); error= (*end_select)(join, 0, 1);
} }
else if (join->send_row_on_empty_set()) else if (join->send_row_on_empty_set())
{ {
@ -10694,7 +10695,7 @@ int report_error(TABLE *table, int error)
*/ */
if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT) if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
sql_print_error("Got error %d when reading table '%s'", sql_print_error("Got error %d when reading table '%s'",
error, table->s->path); error, table->s->path.str);
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
return 1; return 1;
} }

View File

@ -1073,6 +1073,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
bool view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE && bool view_is_mergeable= (table->algorithm != VIEW_ALGORITHM_TMPTABLE &&
lex->can_be_merged()); lex->can_be_merged());
TABLE_LIST *view_main_select_tables; TABLE_LIST *view_main_select_tables;
LINT_INIT(view_main_select_tables);
if (view_is_mergeable) if (view_is_mergeable)
{ {
/* /*

View File

@ -480,7 +480,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
sql_print_warning("'%s' had no or invalid character set, " sql_print_warning("'%s' had no or invalid character set, "
"and default character set is multi-byte, " "and default character set is multi-byte, "
"so character column sizes may have changed", "so character column sizes may have changed",
share->path); share->path.str);
} }
share->table_charset= default_charset_info; share->table_charset= default_charset_info;
} }