Commit bf1d4487 authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Merge from mysql-5.5-bugfixing to mysql-5.5-runtime.

parents 6b8032ed 04b3b7c1
...@@ -1908,4 +1908,16 @@ group by PAY.id + 1; ...@@ -1908,4 +1908,16 @@ group by PAY.id + 1;
mult v_net_with_discount v_total mult v_net_with_discount v_total
1.0000 27.18 27.180000 1.0000 27.18 27.180000
DROP TABLE currencies, payments, sub_tasks; DROP TABLE currencies, payments, sub_tasks;
#
# BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions
#
CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED);
INSERT INTO t1 VALUES (0);
SELECT AVG(DISTINCT a) FROM t1;
AVG(DISTINCT a)
0.00000000
SELECT SUM(DISTINCT a) FROM t1;
SUM(DISTINCT a)
0.0000
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -116,18 +116,10 @@ where name like "wait/synch/mutex/sql/LOCK_rpl_status"; ...@@ -116,18 +116,10 @@ where name like "wait/synch/mutex/sql/LOCK_rpl_status";
count(name) count(name)
1 1
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOG_INFO::lock";
count(name)
1
select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex";
count(name) count(name)
1 1
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state";
count(name)
1
select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_event_metadata"; where name like "wait/synch/mutex/sql/LOCK_event_metadata";
count(name) count(name)
1 1
...@@ -144,15 +136,15 @@ where name like "wait/synch/mutex/sql/Cversion_lock"; ...@@ -144,15 +136,15 @@ where name like "wait/synch/mutex/sql/Cversion_lock";
count(name) count(name)
1 1
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_xid_cache"; where name like "wait/synch/mutex/sql/LOCK_audit_mask";
count(name) count(name)
1 1
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_plugin"; where name like "wait/synch/mutex/sql/LOCK_xid_cache";
count(name) count(name)
1 1
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_gdl"; where name like "wait/synch/mutex/sql/LOCK_plugin";
count(name) count(name)
1 1
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
...@@ -212,10 +204,6 @@ where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; ...@@ -212,10 +204,6 @@ where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed";
count(name) count(name)
1 1
select count(name) from COND_INSTANCES select count(name) from COND_INSTANCES
where name like "wait/synch/cond/sql/Event_scheduler::COND_state";
count(name)
1
select count(name) from COND_INSTANCES
where name like "wait/synch/cond/sql/COND_queue_state"; where name like "wait/synch/cond/sql/COND_queue_state";
count(name) count(name)
1 1
# Copyright (C) 2009 Sun Microsystems, Inc # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software Foundation,
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# Tests for PERFORMANCE_SCHEMA # Tests for PERFORMANCE_SCHEMA
...@@ -43,10 +43,6 @@ select count(name) from MUTEX_INSTANCES ...@@ -43,10 +43,6 @@ select count(name) from MUTEX_INSTANCES
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/mysys/THR_LOCK_myisam"; where name like "wait/synch/mutex/mysys/THR_LOCK_myisam";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/mysys/THR_LOCK_myisam_log";
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/mysys/THR_LOCK_heap"; where name like "wait/synch/mutex/mysys/THR_LOCK_heap";
...@@ -83,11 +79,6 @@ select count(name) from MUTEX_INSTANCES ...@@ -83,11 +79,6 @@ select count(name) from MUTEX_INSTANCES
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_delayed_insert"; where name like "wait/synch/mutex/sql/LOCK_delayed_insert";
# Named LOCK_uuid_short in 6.0 only
# select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/LOCK_uuid_short";
# Named LOCK_uuid_generator in 5.5, LOCK_uuid_short in 6.0
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_uuid_generator"; where name like "wait/synch/mutex/sql/LOCK_uuid_generator";
...@@ -130,14 +121,16 @@ select count(name) from MUTEX_INSTANCES ...@@ -130,14 +121,16 @@ select count(name) from MUTEX_INSTANCES
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_rpl_status"; where name like "wait/synch/mutex/sql/LOCK_rpl_status";
select count(name) from MUTEX_INSTANCES # LOG_INFO object are created on demand, and are not global.
where name like "wait/synch/mutex/sql/LOG_INFO::lock"; # select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/LOG_INFO::lock";
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex"; where name like "wait/synch/mutex/sql/Query_cache::structure_guard_mutex";
select count(name) from MUTEX_INSTANCES # The event scheduler may be disabled
where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state"; # select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/Event_scheduler::LOCK_scheduler_state";
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_event_metadata"; where name like "wait/synch/mutex/sql/LOCK_event_metadata";
...@@ -148,16 +141,11 @@ select count(name) from MUTEX_INSTANCES ...@@ -148,16 +141,11 @@ select count(name) from MUTEX_INSTANCES
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_user_locks"; where name like "wait/synch/mutex/sql/LOCK_user_locks";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/LOCK_mdl";
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/Cversion_lock"; where name like "wait/synch/mutex/sql/Cversion_lock";
# Does not exist in mysql 5.5, 6.0 only select count(name) from MUTEX_INSTANCES
# select count(name) from MUTEX_INSTANCES where name like "wait/synch/mutex/sql/LOCK_audit_mask";
# where name like "wait/synch/mutex/sql/LOCK_audit_mask";
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_xid_cache"; where name like "wait/synch/mutex/sql/LOCK_xid_cache";
...@@ -165,28 +153,13 @@ select count(name) from MUTEX_INSTANCES ...@@ -165,28 +153,13 @@ select count(name) from MUTEX_INSTANCES
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/LOCK_plugin"; where name like "wait/synch/mutex/sql/LOCK_plugin";
select count(name) from MUTEX_INSTANCES # Not a global variable, may be destroyed already.
where name like "wait/synch/mutex/sql/LOCK_gdl"; # select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/LOCK_gdl";
select count(name) from MUTEX_INSTANCES select count(name) from MUTEX_INSTANCES
where name like "wait/synch/mutex/sql/tz_LOCK"; where name like "wait/synch/mutex/sql/tz_LOCK";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/slave_start";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_active";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from MUTEX_INSTANCES
# where name like "wait/synch/mutex/sql/BML_class::THR_LOCK_BML_get";
# Verify that these global rwlocks have been properly initilized in sql # Verify that these global rwlocks have been properly initilized in sql
select count(name) from RWLOCK_INSTANCES select count(name) from RWLOCK_INSTANCES
...@@ -230,25 +203,10 @@ select count(name) from COND_INSTANCES ...@@ -230,25 +203,10 @@ select count(name) from COND_INSTANCES
select count(name) from COND_INSTANCES select count(name) from COND_INSTANCES
where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed"; where name like "wait/synch/cond/sql/Query_cache::COND_cache_status_changed";
select count(name) from COND_INSTANCES # The event scheduler may be disabled
where name like "wait/synch/cond/sql/Event_scheduler::COND_state"; # select count(name) from COND_INSTANCES
# where name like "wait/synch/cond/sql/Event_scheduler::COND_state";
select count(name) from COND_INSTANCES select count(name) from COND_INSTANCES
where name like "wait/synch/cond/sql/COND_queue_state"; where name like "wait/synch/cond/sql/COND_queue_state";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from COND_INSTANCES
# where name like "wait/synch/cond/sql/COND_mdl";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from COND_INSTANCES
# where name like "wait/synch/cond/sql/BML_class::COND_BML";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from COND_INSTANCES
# where name like "wait/synch/cond/sql/BML_class::COND_BML_registered";
# Does not exist in mysql 5.5, 6.0 only
# select count(name) from COND_INSTANCES
# where name like "wait/synch/cond/sql/BML_class::COND_BML_release";
...@@ -1509,5 +1509,14 @@ group by PAY.id + 1; ...@@ -1509,5 +1509,14 @@ group by PAY.id + 1;
DROP TABLE currencies, payments, sub_tasks; DROP TABLE currencies, payments, sub_tasks;
--echo #
--echo # BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions
--echo #
CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED);
INSERT INTO t1 VALUES (0);
SELECT AVG(DISTINCT a) FROM t1;
SELECT SUM(DISTINCT a) FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -9104,7 +9104,7 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, ...@@ -9104,7 +9104,7 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_NEWDECIMAL:
case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_DOUBLE:
pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER | pack_flag= FIELDFLAG_NUMBER |
(decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT; (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT;
break; break;
...@@ -9153,12 +9153,13 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, ...@@ -9153,12 +9153,13 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
(maybe_null ? FIELDFLAG_MAYBE_NULL : 0) | (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
(is_unsigned ? 0 : FIELDFLAG_DECIMAL); (is_unsigned ? 0 : FIELDFLAG_DECIMAL);
DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d", DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s%s, pack_type: %d",
FLAGSTR(pack_flag, FIELDFLAG_BINARY), FLAGSTR(pack_flag, FIELDFLAG_BINARY),
FLAGSTR(pack_flag, FIELDFLAG_NUMBER), FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
FLAGSTR(pack_flag, FIELDFLAG_INTERVAL), FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
FLAGSTR(pack_flag, FIELDFLAG_GEOM), FLAGSTR(pack_flag, FIELDFLAG_GEOM),
FLAGSTR(pack_flag, FIELDFLAG_BLOB), FLAGSTR(pack_flag, FIELDFLAG_BLOB),
FLAGSTR(pack_flag, FIELDFLAG_DECIMAL),
f_packtype(pack_flag))); f_packtype(pack_flag)));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -5284,11 +5284,8 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd, ...@@ -5284,11 +5284,8 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
const struct timespec *timeout) const struct timespec *timeout)
{ {
int ret= 0; int ret= 0;
const char* old_msg = thd->proc_info;
DBUG_ENTER("wait_for_update_bin_log"); DBUG_ENTER("wait_for_update_bin_log");
old_msg= thd->enter_cond(&update_cond, &LOCK_log,
"Master has sent all binlog to slave; "
"waiting for binlog to be updated");
if (!timeout) if (!timeout)
mysql_cond_wait(&update_cond, &LOCK_log); mysql_cond_wait(&update_cond, &LOCK_log);
else else
......
...@@ -460,6 +460,7 @@ public: ...@@ -460,6 +460,7 @@ public:
inline char* get_log_fname() { return log_file_name; } inline char* get_log_fname() { return log_file_name; }
inline char* get_name() { return name; } inline char* get_name() { return name; }
inline mysql_mutex_t* get_log_lock() { return &LOCK_log; } inline mysql_mutex_t* get_log_lock() { return &LOCK_log; }
inline mysql_cond_t* get_log_cond() { return &update_cond; }
inline IO_CACHE* get_log_file() { return &log_file; } inline IO_CACHE* get_log_file() { return &log_file; }
inline void lock_index() { mysql_mutex_lock(&LOCK_index);} inline void lock_index() { mysql_mutex_lock(&LOCK_index);}
......
...@@ -519,7 +519,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) ...@@ -519,7 +519,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
/* no op */; /* no op */;
cur= (struct st_mysql_plugin*) cur= (struct st_mysql_plugin*)
my_malloc(i*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME)); my_malloc((i+1)*sizeof(struct st_mysql_plugin), MYF(MY_ZEROFILL|MY_WME));
if (!cur) if (!cur)
{ {
free_plugin_mem(&plugin_dl); free_plugin_mem(&plugin_dl);
......
...@@ -448,6 +448,8 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ...@@ -448,6 +448,8 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
const char *errmsg = "Unknown error"; const char *errmsg = "Unknown error";
NET* net = &thd->net; NET* net = &thd->net;
mysql_mutex_t *log_lock; mysql_mutex_t *log_lock;
mysql_cond_t *log_cond;
bool binlog_can_be_corrupted= FALSE; bool binlog_can_be_corrupted= FALSE;
#ifndef DBUG_OFF #ifndef DBUG_OFF
int left_events = max_binlog_dump_events; int left_events = max_binlog_dump_events;
...@@ -591,7 +593,8 @@ impossible position"; ...@@ -591,7 +593,8 @@ impossible position";
mysql_bin_log, and it's already inited, and it will be destroyed mysql_bin_log, and it's already inited, and it will be destroyed
only at shutdown). only at shutdown).
*/ */
log_lock = mysql_bin_log.get_log_lock(); log_lock= mysql_bin_log.get_log_lock();
log_cond= mysql_bin_log.get_log_cond();
if (pos > BIN_LOG_HEADER_SIZE) if (pos > BIN_LOG_HEADER_SIZE)
{ {
/* reset transmit packet for the event read from binary log /* reset transmit packet for the event read from binary log
...@@ -826,6 +829,7 @@ impossible position"; ...@@ -826,6 +829,7 @@ impossible position";
#ifndef DBUG_OFF #ifndef DBUG_OFF
ulong hb_info_counter= 0; ulong hb_info_counter= 0;
#endif #endif
const char* old_msg= thd->proc_info;
signal_cnt= mysql_bin_log.signal_cnt; signal_cnt= mysql_bin_log.signal_cnt;
do do
{ {
...@@ -834,6 +838,9 @@ impossible position"; ...@@ -834,6 +838,9 @@ impossible position";
DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0); DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0);
set_timespec_nsec(*heartbeat_ts, heartbeat_period); set_timespec_nsec(*heartbeat_ts, heartbeat_period);
} }
thd->enter_cond(log_cond, log_lock,
"Master has sent all binlog to slave; "
"waiting for binlog to be updated");
ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts); ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts);
DBUG_ASSERT(ret == 0 || (heartbeat_period != 0 && coord != NULL)); DBUG_ASSERT(ret == 0 || (heartbeat_period != 0 && coord != NULL));
if (ret == ETIMEDOUT || ret == ETIME) if (ret == ETIMEDOUT || ret == ETIME)
...@@ -849,12 +856,15 @@ impossible position"; ...@@ -849,12 +856,15 @@ impossible position";
#endif #endif
/* reset transmit packet for the heartbeat event */ /* reset transmit packet for the heartbeat event */
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
{
thd->exit_cond(old_msg);
goto err; goto err;
}
if (send_heartbeat_event(net, packet, coord)) if (send_heartbeat_event(net, packet, coord))
{ {
errmsg = "Failed on my_net_write()"; errmsg = "Failed on my_net_write()";
my_errno= ER_UNKNOWN_ERROR; my_errno= ER_UNKNOWN_ERROR;
mysql_mutex_unlock(log_lock); thd->exit_cond(old_msg);
goto err; goto err;
} }
} }
...@@ -863,7 +873,7 @@ impossible position"; ...@@ -863,7 +873,7 @@ impossible position";
DBUG_PRINT("wait",("binary log received update or a broadcast signal caught")); DBUG_PRINT("wait",("binary log received update or a broadcast signal caught"));
} }
} while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed); } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed);
mysql_mutex_unlock(log_lock); thd->exit_cond(old_msg);
} }
break; break;
......
...@@ -223,6 +223,8 @@ int PFS_engine_table::read_row(TABLE *table, ...@@ -223,6 +223,8 @@ int PFS_engine_table::read_row(TABLE *table,
Field **fields) Field **fields)
{ {
my_bitmap_map *org_bitmap; my_bitmap_map *org_bitmap;
Field *f;
Field **fields_reset;
/* /*
Make sure the table structure is as expected before mapping Make sure the table structure is as expected before mapping
...@@ -240,6 +242,16 @@ int PFS_engine_table::read_row(TABLE *table, ...@@ -240,6 +242,16 @@ int PFS_engine_table::read_row(TABLE *table,
/* We internally write to Fields to support the read interface */ /* We internally write to Fields to support the read interface */
org_bitmap= dbug_tmp_use_all_columns(table, table->write_set); org_bitmap= dbug_tmp_use_all_columns(table, table->write_set);
/*
Some callers of the storage engine interface do not honor the
f->is_null() flag, and will attempt to read the data itself.
A known offender is mysql_checksum_table().
For robustness, reset every field.
*/
for (fields_reset= fields; (f= *fields_reset) ; fields_reset++)
f->reset();
int result= read_row_values(table, buf, fields, read_all); int result= read_row_values(table, buf, fields, read_all);
dbug_tmp_restore_column_map(table->write_set, org_bitmap); dbug_tmp_restore_column_map(table->write_set, org_bitmap);
......
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