summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-10-08 12:01:58 +0300
committerunknown <monty@narttu.mysql.fi>2003-10-08 12:01:58 +0300
commit1ead85e6783e303c2d024aebe4c5a04e0aa6560f (patch)
tree5f3cf2f56cc441edc81b2cf5fc056128ab764b41 /sql
parent118d532134a1700bdb7ba29ce41712994f023692 (diff)
downloadmariadb-git-1ead85e6783e303c2d024aebe4c5a04e0aa6560f.tar.gz
Fixes after merge
mysql-test/std_data/trunc_binlog.000001: Rename: mysql-test/std_data/trunc_binlog.001 -> mysql-test/std_data/trunc_binlog.000001 client/mysqltest.c: Fixed merge problem mysql-test/mysql-test-run.sh: Fixed merge problem mysql-test/r/distinct.result: Fix after merge mysql-test/r/drop_temp_table.result: Fix after merge mysql-test/r/join_outer.result: Fix after merge mysql-test/r/mysqldump.result: Fix after merge mysql-test/r/null_key.result: Fix after merge mysql-test/r/order_by.result: Fix after merge mysql-test/r/rpl_alter.result: Fix after merge mysql-test/r/rpl_loaddata.result: Fix after merge mysql-test/r/rpl_loaddata_rule_m.result: Fix after merge mysql-test/r/rpl_trunc_binlog.result: Fix after merge mysql-test/r/select_safe.result: Fix after merge mysql-test/t/insert.test: Fix after merge mysql-test/t/mysqlbinlog.test: Fix after merge mysql-test/t/rpl000009.test: Fix after merge mysql-test/t/rpl_alter.test: Fix after merge mysql-test/t/rpl_loaddata_rule_m.test: Fix after merge mysql-test/t/rpl_trunc_binlog.test: Fix after merge sql-common/client.c: Fix after merge sql/item_subselect.cc: Fix after merge sql/repl_failsafe.cc: Fix after merge sql/slave.cc: Fix after merge sql/sql_insert.cc: Fix after merge
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc1
-rw-r--r--sql/repl_failsafe.cc7
-rw-r--r--sql/slave.cc42
-rw-r--r--sql/sql_insert.cc13
4 files changed, 41 insertions, 22 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 3d6fd4c316d..fd024daca08 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1096,7 +1096,6 @@ int subselect_indexsubquery_engine::exec()
/* Check if there exists a row with a null value in the index */
if ((error= (safe_index_read(tab) == 1)))
break;
- }
}
}
}
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 2fe8946410f..aba887be070 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -755,6 +755,8 @@ int load_master_data(THD* thd)
int error = 0;
const char* errmsg=0;
int restart_thread_mask;
+ HA_CREATE_INFO create_info;
+
mysql_init(&mysql);
/*
@@ -858,7 +860,10 @@ int load_master_data(THD* thd)
continue;
}
- if (mysql_create_db(thd, db, HA_LEX_CREATE_IF_NOT_EXISTS, 1))
+ bzero((char*) &create_info, sizeof(create_info));
+ create_info.options= HA_LEX_CREATE_IF_NOT_EXISTS;
+
+ if (mysql_create_db(thd, db, &create_info, 1))
{
send_error(thd, 0, 0);
cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
diff --git a/sql/slave.cc b/sql/slave.cc
index a221abec2b5..d1a8fe51f33 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1125,12 +1125,13 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
handler *file;
ulong save_options;
NET *net= &mysql->net;
-
+ DBUG_ENTER("create_table_from_dump");
+
packet_len= my_net_read(net); // read create table statement
if (packet_len == packet_error)
{
send_error(thd, ER_MASTER_NET_READ);
- return 1;
+ DBUG_RETURN(1);
}
if (net->read_pos[0] == 255) // error from master
{
@@ -1139,7 +1140,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
CLIENT_PROTOCOL_41) ?
3+SQLSTATE_LENGTH+1 : 3);
net_printf(thd, ER_MASTER, err_msg);
- return 1;
+ DBUG_RETURN(1);
}
thd->command = COM_TABLE_DUMP;
thd->query_length= packet_len;
@@ -1148,12 +1149,23 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
{
sql_print_error("create_table_from_dump: out of memory");
net_printf(thd, ER_GET_ERRNO, "Out of memory");
- return 1;
+ DBUG_RETURN(1);
}
thd->query= query;
thd->query_error = 0;
thd->net.no_send_ok = 1;
+ bzero((char*) &tables,sizeof(tables));
+ tables.db = (char*)db;
+ tables.alias= tables.real_name= (char*)table_name;
+ /* Drop the table if 'overwrite' is true */
+ if (overwrite && mysql_rm_table(thd,&tables,1,0)) /* drop if exists */
+ {
+ send_error(thd);
+ sql_print_error("create_table_from_dump: failed to drop the table");
+ goto err;
+ }
+
/* Create the table. We do not want to log the "create table" statement */
save_options = thd->options;
thd->options &= ~(ulong) (OPTION_BIN_LOG);
@@ -1207,7 +1219,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
err:
close_thread_tables(thd);
thd->net.no_send_ok = 0;
- return error;
+ DBUG_RETURN(error);
}
@@ -3431,15 +3443,15 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
case STOP_EVENT:
/*
We needn't write this event to the relay log. Indeed, it just indicates a
- master server shutdown. The only thing this does is cleaning. But cleaning
- is already done on a per-master-thread basis (as the master server is
- shutting down cleanly, it has written all DROP TEMPORARY TABLE and DO
- RELEASE_LOCK; prepared statements' deletion are TODO).
+ master server shutdown. The only thing this does is cleaning. But
+ cleaning is already done on a per-master-thread basis (as the master
+ server is shutting down cleanly, it has written all DROP TEMPORARY TABLE
+ and DO RELEASE_LOCK; prepared statements' deletion are TODO).
- We don't even increment mi->master_log_pos, because we may be just after a
- Rotate event. Btw, in a few milliseconds we are going to have a Start
- event from the next binlog (unless the master is presently running without
- --log-bin).
+ We don't even increment mi->master_log_pos, because we may be just after
+ a Rotate event. Btw, in a few milliseconds we are going to have a Start
+ event from the next binlog (unless the master is presently running
+ without --log-bin).
*/
goto err;
case ROTATE_EVENT:
@@ -3465,8 +3477,8 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
/*
If this event is originating from this server, don't queue it.
We don't check this for 3.23 events because it's simpler like this; 3.23
- will be filtered anyway by the SQL slave thread which also tests the server
- id (we must also keep this test in the SQL thread, in case somebody
+ will be filtered anyway by the SQL slave thread which also tests the
+ server id (we must also keep this test in the SQL thread, in case somebody
upgrades a 4.0 slave which has a not-filtered relay log).
ANY event coming from ourselves can be ignored: it is obvious for queries;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index d523d868514..f4127265ce6 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1438,15 +1438,17 @@ bool select_insert::send_data(List<Item> &values)
void select_insert::send_error(uint errcode,const char *err)
{
+ DBUG_ENTER("select_insert::send_error");
+
//TODO error should be sent at the query processing end
::send_error(thd,errcode,err);
table->file->extra(HA_EXTRA_NO_CACHE);
table->file->activate_all_index(thd);
- /*
- If at least one row has been inserted/modified and will stay in the table
- (the table doesn't have transactions) (example: we got a duplicate key
- error while inserting into a MyISAM table) we must write to the binlog (and
- the error code will make the slave stop).
+ /*
+ If at least one row has been inserted/modified and will stay in the table
+ (the table doesn't have transactions) (example: we got a duplicate key
+ error while inserting into a MyISAM table) we must write to the binlog (and
+ the error code will make the slave stop).
*/
if ((info.copied || info.deleted) && !table->file->has_transactions())
{
@@ -1465,6 +1467,7 @@ void select_insert::send_error(uint errcode,const char *err)
if (info.copied || info.deleted)
query_cache_invalidate3(thd, table, 1);
ha_rollback_stmt(thd);
+ DBUG_VOID_RETURN;
}