Commit aa900a5e authored by unknown's avatar unknown

After merge fixes + bugs from last merge


mysql-test/mysql-test-run.sh:
  Use --skip-bdb with valgrind (as bdb tables causes valgrind to hang)
  Fix --ddd option
mysql-test/t/union.test:
  After merge fix
sql/item.cc:
  Fixed typo
sql/log_event.cc:
  Move current_tablenr to open_tables()
sql/protocol.h:
  Fixed wrong memory reference
sql/set_var.cc:
  After merge fix
sql/slave.cc:
  Reset thd->lex.current_select before execute
sql/sql_base.cc:
  Move current_tablenr to open_tables()
sql/sql_class.cc:
  Move current_tablenr to open_tables()
  Add missing update_charset()
sql/sql_parse.cc:
  Move current_tablenr to open_tables()
  Simple cleanup
sql/table.cc:
  Code cleanup
parent 755e72a0
......@@ -344,8 +344,8 @@ while test $# -gt 0; do
;;
--valgrind)
VALGRIND="valgrind --alignment=8 --leak-check=yes --num-callers=16"
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
SLEEP_TIME_AFTER_RESTART=10
SLEEP_TIME_FOR_DELETE=60
USE_RUNNING_SERVER=""
......@@ -998,7 +998,7 @@ start_slave()
if [ x$DO_DDD = x1 ]
then
$ECHO "set args $master_args" > $GDB_SLAVE_INIT
$ECHO "set args $slave_args" > $GDB_SLAVE_INIT
manager_launch $slave_ident ddd -display $DISPLAY --debugger \
"gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
elif [ x$DO_GDB = x1 ]
......
......@@ -23,7 +23,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
(select a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 4;
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1);
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
--error 1248
--error 1249
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
......
......@@ -50,7 +50,7 @@ Item::Item():
next= thd->free_list; // Put in free list
thd->free_list= this;
/*
Item constructor can be called during execution other tnen SQL_COM
Item constructor can be called during execution other then SQL_COM
command => we should check thd->lex.current_select on zero (thd->lex
can be uninitialised)
*/
......
......@@ -911,7 +911,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->set_time((time_t)when);
thd->current_tablenr = 0;
thd->query_length= q_len;
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = (char*)query;
......@@ -1617,7 +1616,6 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
thd->set_time((time_t)when);
thd->current_tablenr = 0;
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
......
......@@ -61,7 +61,7 @@ class Protocol
inline bool store(ulonglong from)
{ return store_longlong((longlong) from, 1); }
inline bool store(String *str)
{ return store(str->c_ptr(),str->length(),str->charset()); }
{ return store((char*) str->ptr(), str->length(), str->charset()); }
virtual bool prepare_for_send(List<Item> *item_list)
{
......
......@@ -823,7 +823,7 @@ void fix_max_binlog_size(THD *thd, enum_var_type type)
DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
max_binlog_size, max_relay_log_size));
mysql_bin_log.set_max_size(max_binlog_size);
#ifdef REPLICATION
#ifdef HAVE_REPLICATION
if (!max_relay_log_size)
active_mi->rli.relay_log.set_max_size(max_binlog_size);
#endif
......@@ -835,8 +835,10 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type)
DBUG_ENTER("fix_max_relay_log_size");
DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
max_binlog_size, max_relay_log_size));
#ifdef HAVE_REPLICATION
active_mi->rli.relay_log.set_max_size(max_relay_log_size ?
max_relay_log_size: max_binlog_size);
#endif
DBUG_VOID_RETURN;
}
......
......@@ -1137,7 +1137,6 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
return 1;
}
thd->query= query;
thd->current_tablenr = 0;
thd->query_error = 0;
thd->net.no_send_ok = 1;
......@@ -1811,7 +1810,8 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
field_list.push_back(new Item_empty_string("Replicate_do_table", 20));
field_list.push_back(new Item_empty_string("Replicate_ignore_table", 23));
field_list.push_back(new Item_empty_string("Replicate_wild_do_table", 24));
field_list.push_back(new Item_empty_string("Replicate_wild_ignore_table", 28));
field_list.push_back(new Item_empty_string("Replicate_wild_ignore_table",
28));
field_list.push_back(new Item_return_int("Last_errno", 4, MYSQL_TYPE_LONG));
field_list.push_back(new Item_empty_string("Last_error", 20));
field_list.push_back(new Item_return_int("Skip_counter", 10,
......@@ -1838,7 +1838,8 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
protocol->store(mi->master_log_name, &my_charset_bin);
protocol->store((ulonglong) mi->master_log_pos);
protocol->store(mi->rli.group_relay_log_name +
dirname_length(mi->rli.group_relay_log_name), &my_charset_bin);
dirname_length(mi->rli.group_relay_log_name),
&my_charset_bin);
protocol->store((ulonglong) mi->rli.group_relay_log_pos);
protocol->store(mi->rli.group_master_log_name, &my_charset_bin);
protocol->store(mi->slave_running ? "Yes":"No", &my_charset_bin);
......@@ -2384,6 +2385,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
thd->server_id = ev->server_id; // use the original server id for logging
thd->set_time(); // time the query
thd->lex.current_select= 0;
if (!ev->when)
ev->when = time(NULL);
ev->thd = thd;
......
......@@ -1355,6 +1355,7 @@ int open_tables(THD *thd,TABLE_LIST *start)
int result=0;
DBUG_ENTER("open_tables");
thd->current_tablenr= 0;
restart:
thd->proc_info="Opening tables";
for (tables=start ; tables ; tables=tables->next)
......@@ -1473,6 +1474,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
DBUG_ENTER("open_ltable");
thd->proc_info="Opening table";
thd->current_tablenr= 0;
while (!(table=open_table(thd,table_list->db,
table_list->real_name,table_list->alias,
&refresh)) && refresh) ;
......
......@@ -96,7 +96,6 @@ THD::THD():user_time(0), is_fatal_error(0),
query_error= tmp_table_used= 0;
next_insert_id=last_insert_id=0;
open_tables= temporary_tables= handler_tables= derived_tables= 0;
current_tablenr=0;
handler_items=0;
tmp_table=0;
lock=locked_tables=0;
......@@ -161,8 +160,6 @@ THD::THD():user_time(0), is_fatal_error(0),
else
bzero((char*) &user_var_events, sizeof(user_var_events));
/* Prepared statements */
last_prepared_stmt= 0;
init_tree(&prepared_statements, 0, 0, sizeof(PREP_STMT),
......@@ -218,6 +215,7 @@ void THD::init(void)
warn_list.empty();
bzero((char*) warn_count, sizeof(warn_count));
total_warn_count= 0;
update_charset();
}
......
......@@ -982,7 +982,6 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
buff[length-1] == ';'))
length--;
buff[length]=0;
thd->current_tablenr=0;
thd->query_length=length;
thd->query= thd->memdup_w_gap(buff, length+1, thd->db_length+1);
thd->query[length] = '\0';
......@@ -1085,7 +1084,6 @@ bool do_command(THD *thd)
DBUG_ENTER("do_command");
net= &thd->net;
thd->current_tablenr=0;
/*
indicator of uninitialized lex => normal flow of errors handling
(see my_message_sql)
......@@ -1173,16 +1171,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#endif
case COM_TABLE_DUMP:
{
char *db, *tbl_name;
uint db_len= *(uchar*) packet;
uint tbl_len= *(uchar*) (packet + db_len + 1);
statistic_increment(com_other, &LOCK_status);
slow_command = TRUE;
uint db_len = *(uchar*)packet;
uint tbl_len = *(uchar*)(packet + db_len + 1);
char* db = thd->alloc(db_len + tbl_len + 2);
memcpy(db, packet + 1, db_len);
char* tbl_name = db + db_len;
*tbl_name++ = 0;
memcpy(tbl_name, packet + db_len + 2, tbl_len);
tbl_name[tbl_len] = 0;
slow_command= TRUE;
db= thd->alloc(db_len + tbl_len + 2);
tbl_name= strmake(db, packet + 1, db_len)+1;
strmake(tbl_name, packet + db_len + 2, tbl_len);
if (mysql_table_dump(thd, db, tbl_name, -1))
send_error(thd); // dump to NET
break;
......
......@@ -1173,23 +1173,25 @@ rename_file_ext(const char * from,const char * to,const char * ext)
res result String
RETURN VALUES
true string is empty
false all ok
1 string is empty
0 all ok
*/
bool get_field(MEM_ROOT *mem, Field *field, String *res)
{
char buff[MAX_FIELD_WIDTH];
char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff),&my_charset_bin);
uint length;
field->val_str(&str,&str);
uint length=str.length();
if (!length)
return true;
char *to= strmake_root(mem, str.ptr(), length);
res->set(to,length,((Field_str*)field)->charset());
return false;
if (!(length= str.length()))
return 1;
to= strmake_root(mem, str.ptr(), length);
res->set(to, length, ((Field_str*)field)->charset());
return 0;
}
/*
Allocate string field in MEM_ROOT and return it as NULL-terminated string
......@@ -1205,14 +1207,15 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res)
char *get_field(MEM_ROOT *mem, Field *field)
{
char buff[MAX_FIELD_WIDTH];
char buff[MAX_FIELD_WIDTH], *to;
String str(buff,sizeof(buff),&my_charset_bin);
uint length;
field->val_str(&str,&str);
uint length=str.length();
if (!length)
if (!(length= str.length()))
return NullS;
char *to= (char*) alloc_root(mem,length+1);
memcpy(to,str.ptr(),(uint) length);
to= (char*) alloc_root(mem,length+1);
memcpy(to, str.ptr(), (uint) length);
to[length]=0;
return to;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment