3657 kent.boortz@stripped 2012-08-27
applying patch for br14537277
modified:
VERSION
sql/ha_partition.cc
sql/ha_partition.h
3656 chuck.bell@stripped 2012-01-30 {clone-5.5.21-build} [merge]
Merge with main for BUG#12969301
added:
mysql-test/suite/innodb/r/innodb_bug12400341.result
mysql-test/suite/innodb/t/innodb_bug12400341-master.opt
mysql-test/suite/innodb/t/innodb_bug12400341.test
mysql-test/suite/rpl/r/rpl_start_stop_slave.result
mysql-test/suite/rpl/t/rpl_start_stop_slave.test
mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result
mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result
mysql-test/suite/sys_vars/r/stored_program_cache_basic.result
mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test
mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test
mysql-test/suite/sys_vars/t/stored_program_cache_basic.test
modified:
CMakeLists.txt
VERSION
client/mysql_upgrade.c
client/mysqldump.c
cmd-line-utils/libedit/chartype.h
cmd-line-utils/libedit/eln.c
cmd-line-utils/libedit/readline.c
include/m_ctype.h
include/my_global.h
libmysql/CMakeLists.txt
mysql-test/collections/default.experimental
mysql-test/extra/rpl_tests/rpl_extra_col_master.test
mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
mysql-test/include/have_example_plugin.inc
mysql-test/include/have_semisync_plugin.inc
mysql-test/include/have_simple_parser.inc
mysql-test/include/have_udf.inc
mysql-test/include/show_slave_status.inc
mysql-test/include/wait_for_ndb_to_binlog.inc
mysql-test/include/wait_for_slave_io_error.inc
mysql-test/r/bigint.result
mysql-test/r/ctype_utf8.result
mysql-test/r/func_in.result
mysql-test/r/func_str.result
mysql-test/r/func_time.result
mysql-test/r/init_connect.result
mysql-test/r/key_cache.result
mysql-test/r/mysqlcheck.result
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
mysql-test/r/mysqldump.result
mysql-test/r/partition_binlog_stmt.result
mysql-test/r/partition_key_cache.result
mysql-test/r/range.result
mysql-test/r/sp.result
mysql-test/r/xa.result
mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result
mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
mysql-test/suite/rpl/r/rpl_known_bugs_detection.result
mysql-test/suite/rpl/r/rpl_log_pos.result
mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
mysql-test/suite/rpl/r/rpl_packet.result
mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
mysql-test/suite/rpl/t/rpl_known_bugs_detection.test
mysql-test/suite/rpl/t/rpl_log_pos.test
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
mysql-test/suite/rpl/t/rpl_packet.test
mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test
mysql-test/suite/sys_vars/r/all_vars.result
mysql-test/suite/sys_vars/r/character_sets_dir_basic.result
mysql-test/suite/sys_vars/r/plugin_dir_basic.result
mysql-test/suite/sys_vars/t/all_vars.test
mysql-test/suite/sys_vars/t/character_sets_dir_basic.test
mysql-test/suite/sys_vars/t/disabled.def
mysql-test/t/bigint.test
mysql-test/t/ctype_utf8.test
mysql-test/t/func_str.test
mysql-test/t/func_time.test
mysql-test/t/init_connect.test
mysql-test/t/key_cache.test
mysql-test/t/mysqlcheck.test
mysql-test/t/mysqldump.test
mysql-test/t/partition_binlog_stmt.test
mysql-test/t/partition_key_cache.test
mysql-test/t/range.test
mysql-test/t/sp.test
mysql-test/t/udf_skip_grants-master.opt
mysql-test/t/xa.test
mysys/charset-def.c
scripts/mysqld_safe.sh
sql-common/my_time.c
sql/item.cc
sql/item_cmpfunc.cc
sql/item_timefunc.cc
sql/log_event.h
sql/mysqld.cc
sql/mysqld.h
sql/rpl_mi.cc
sql/rpl_mi.h
sql/rpl_rli.cc
sql/rpl_rli.h
sql/share/errmsg-utf8.txt
sql/slave.cc
sql/sp_cache.cc
sql/sp_cache.h
sql/sql_admin.cc
sql/sql_connect.cc
sql/sql_parse.cc
sql/sql_plugin.cc
sql/sql_prepare.cc
sql/sql_repl.cc
sql/sql_udf.cc
sql/sys_vars.cc
storage/federated/ha_federated.cc
storage/innobase/btr/btr0btr.c
storage/innobase/btr/btr0cur.c
storage/innobase/btr/btr0pcur.c
storage/innobase/buf/buf0buf.c
storage/innobase/dict/dict0load.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/handler0alter.cc
storage/innobase/ibuf/ibuf0ibuf.c
storage/innobase/include/btr0btr.h
storage/innobase/include/btr0pcur.h
storage/innobase/include/data0data.h
storage/innobase/include/data0data.ic
storage/innobase/include/mem0mem.ic
storage/innobase/include/mtr0log.ic
storage/innobase/include/row0mysql.h
storage/innobase/include/row0sel.h
storage/innobase/include/trx0rseg.ic
storage/innobase/include/trx0sys.h
storage/innobase/include/univ.i
storage/innobase/include/ut0mem.h
storage/innobase/include/ut0rnd.ic
storage/innobase/lock/lock0lock.c
storage/innobase/mem/mem0pool.c
storage/innobase/os/os0file.c
storage/innobase/os/os0proc.c
storage/innobase/page/page0page.c
storage/innobase/pars/pars0pars.c
storage/innobase/row/row0ins.c
storage/innobase/row/row0mysql.c
storage/innobase/row/row0sel.c
storage/innobase/row/row0umod.c
storage/innobase/row/row0upd.c
storage/innobase/srv/srv0srv.c
storage/innobase/trx/trx0purge.c
storage/innobase/trx/trx0rec.c
storage/innobase/trx/trx0sys.c
storage/innobase/ut/ut0mem.c
storage/myisam/mi_preload.c
strings/ctype-ucs2.c
strings/ctype-utf8.c
strings/dtoa.c
=== modified file 'VERSION'
--- a/VERSION 2012-01-11 17:50:47 +0000
+++ b/VERSION 2012-08-27 06:14:09 +0000
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=21
-MYSQL_VERSION_EXTRA=
+MYSQL_VERSION_EXTRA=-SR6052400001
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2011-10-12 12:07:15 +0000
+++ b/sql/ha_partition.cc 2012-08-27 06:14:09 +0000
@@ -319,7 +319,7 @@ ha_partition::~ha_partition()
for (i= 0; i < m_tot_parts; i++)
delete m_file[i];
}
- my_free(m_ordered_rec_buffer);
+ destroy_record_priority_queue();
clear_handler_file();
DBUG_VOID_RETURN;
@@ -2636,7 +2636,6 @@ int ha_partition::open(const char *name,
{
char *name_buffer_ptr;
int error= HA_ERR_INITIALIZATION;
- uint alloc_len;
handler **file;
char name_buff[FN_REFLEN];
bool is_not_tmp_table= (table_share->tmp_table == NO_TMP_TABLE);
@@ -2654,32 +2653,6 @@ int ha_partition::open(const char *name,
m_start_key.length= 0;
m_rec0= table->record[0];
m_rec_length= table_share->reclength;
- alloc_len= m_tot_parts * (m_rec_length + PARTITION_BYTES_IN_POS);
- alloc_len+= table_share->max_key_length;
- if (!m_ordered_rec_buffer)
- {
- if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME))))
- {
- DBUG_RETURN(error);
- }
- {
- /*
- We set-up one record per partition and each record has 2 bytes in
- front where the partition id is written. This is used by ordered
- index_read.
- We also set-up a reference to the first record for temporary use in
- setting up the scan.
- */
- char *ptr= (char*)m_ordered_rec_buffer;
- uint i= 0;
- do
- {
- int2store(ptr, i);
- ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
- } while (++i < m_tot_parts);
- m_start_key.key= (const uchar*)ptr;
- }
- }
/* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
@@ -2699,7 +2672,7 @@ int ha_partition::open(const char *name,
if (m_is_clone_of)
{
- uint i;
+ uint i, alloc_len;
DBUG_ASSERT(m_clone_mem_root);
/* Allocate an array of handler pointers for the partitions handlers. */
alloc_len= (m_tot_parts + 1) * sizeof(handler*);
@@ -2775,12 +2748,6 @@ int ha_partition::open(const char *name,
being opened once.
*/
clear_handler_file();
- /*
- Initialize priority queue, initialized to reading forward.
- */
- if ((error= init_queue(&m_queue, m_tot_parts, (uint) PARTITION_BYTES_IN_POS,
- 0, key_rec_cmp, (void*)this)))
- goto err_handler;
/*
Use table_share->ha_part_data to share auto_increment_value among
@@ -2905,7 +2872,7 @@ int ha_partition::close(void)
DBUG_ENTER("ha_partition::close");
DBUG_ASSERT(table->s == table_share);
- delete_queue(&m_queue);
+ destroy_record_priority_queue();
bitmap_free(&m_bulk_insert_started);
if (!m_is_clone_of)
bitmap_free(&(m_part_info->used_partitions));
@@ -4205,6 +4172,78 @@ int ha_partition::rnd_pos_by_record(ucha
subset of the partitions are used, then only use those partitions.
*/
+
+/**
+ Setup the ordered record buffer and the priority queue.
+*/
+
+bool ha_partition::init_record_priority_queue()
+{
+ DBUG_ENTER("ha_partition::init_record_priority_queue");
+ DBUG_ASSERT(!m_ordered_rec_buffer);
+ /*
+ Initialize the ordered record buffer.
+ */
+ if (!m_ordered_rec_buffer)
+ {
+ uint alloc_len;
+ uint used_parts= bitmap_bits_set(&m_part_info->used_partitions);
+ /* Allocate record buffer for each used partition. */
+ alloc_len= used_parts * (m_rec_length + PARTITION_BYTES_IN_POS);
+ /* Allocate a key for temporary use when setting up the scan. */
+ alloc_len+= table_share->max_key_length;
+
+ if (!(m_ordered_rec_buffer= (uchar*)my_malloc(alloc_len, MYF(MY_WME))))
+ DBUG_RETURN(true);
+
+ /*
+ We set-up one record per partition and each record has 2 bytes in
+ front where the partition id is written. This is used by ordered
+ index_read.
+ We also set-up a reference to the first record for temporary use in
+ setting up the scan.
+ */
+ char *ptr= (char*) m_ordered_rec_buffer;
+ uint16 i= 0;
+ do
+ {
+ if (bitmap_is_set(&m_part_info->used_partitions, i))
+ {
+ int2store(ptr, i);
+ ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
+ }
+ } while (++i < m_tot_parts);
+ m_start_key.key= (const uchar*)ptr;
+ /* Initialize priority queue, initialized to reading forward. */
+ if (init_queue(&m_queue, used_parts, (uint) PARTITION_BYTES_IN_POS,
+ 0, key_rec_cmp, (void*)m_curr_key_info))
+ {
+ my_free(m_ordered_rec_buffer);
+ m_ordered_rec_buffer= NULL;
+ DBUG_RETURN(true);
+ }
+ }
+ DBUG_RETURN(false);
+}
+
+
+/**
+ Destroy the ordered record buffer and the priority queue.
+*/
+
+void ha_partition::destroy_record_priority_queue()
+{
+ DBUG_ENTER("ha_partition::destroy_record_priority_queue");
+ if (m_ordered_rec_buffer)
+ {
+ delete_queue(&m_queue);
+ my_free(m_ordered_rec_buffer);
+ m_ordered_rec_buffer= NULL;
+ }
+ DBUG_VOID_RETURN;
+}
+
+
/*
Initialize handler before start of index scan
@@ -4246,6 +4285,10 @@ int ha_partition::index_init(uint inx, b
}
else
m_curr_key_info[1]= NULL;
+
+ if (init_record_priority_queue())
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+
/*
Some handlers only read fields as specified by the bitmap for the
read set. For partitioned handlers we always require that the
@@ -4320,11 +4363,11 @@ int ha_partition::index_end()
do
{
int tmp;
- /* TODO RONM: Change to index_end() when code is stable */
if (bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
if ((tmp= (*file)->ha_index_end()))
error= tmp;
} while (*(++file));
+ destroy_record_priority_queue();
DBUG_RETURN(error);
}
@@ -5063,6 +5106,7 @@ int ha_partition::handle_ordered_index_s
uint i;
uint j= 0;
bool found= FALSE;
+ uchar *part_rec_buf_ptr= m_ordered_rec_buffer;
DBUG_ENTER("ha_partition::handle_ordered_index_scan");
m_top_entry= NO_CURRENT_PART_ID;
@@ -5073,7 +5117,7 @@ int ha_partition::handle_ordered_index_s
{
if (!(bitmap_is_set(&(m_part_info->used_partitions), i)))
continue;
- uchar *rec_buf_ptr= rec_buf(i);
+ uchar *rec_buf_ptr= part_rec_buf_ptr + PARTITION_BYTES_IN_POS;
int error;
handler *file= m_file[i];
@@ -5120,12 +5164,13 @@ int ha_partition::handle_ordered_index_s
/*
Initialize queue without order first, simply insert
*/
- queue_element(&m_queue, j++)= (uchar*)queue_buf(i);
+ queue_element(&m_queue, j++)= part_rec_buf_ptr;
}
else if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
{
DBUG_RETURN(error);
}
+ part_rec_buf_ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
}
if (found)
{
@@ -5188,18 +5233,19 @@ int ha_partition::handle_ordered_next(uc
{
int error;
uint part_id= m_top_entry;
+ uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS;
handler *file= m_file[part_id];
DBUG_ENTER("ha_partition::handle_ordered_next");
if (m_index_scan_type == partition_read_range)
{
error= file->read_range_next();
- memcpy(rec_buf(part_id), table->record[0], m_rec_length);
+ memcpy(rec_buf, table->record[0], m_rec_length);
}
else if (!is_next_same)
- error= file->index_next(rec_buf(part_id));
+ error= file->index_next(rec_buf);
else
- error= file->index_next_same(rec_buf(part_id), m_start_key.key,
+ error= file->index_next_same(rec_buf, m_start_key.key,
m_start_key.length);
if (error)
{
@@ -5242,10 +5288,11 @@ int ha_partition::handle_ordered_prev(uc
{
int error;
uint part_id= m_top_entry;
+ uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS;
handler *file= m_file[part_id];
DBUG_ENTER("ha_partition::handle_ordered_prev");
- if ((error= file->index_prev(rec_buf(part_id))))
+ if ((error= file->index_prev(rec_buf)))
{
if (error == HA_ERR_END_OF_FILE)
{
=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h 2011-07-03 23:48:19 +0000
+++ b/sql/ha_partition.h 2012-08-27 06:14:09 +0000
@@ -505,21 +505,13 @@ public:
virtual int read_range_next();
private:
+ bool init_record_priority_queue();
+ void destroy_record_priority_queue();
int common_index_read(uchar * buf, bool have_start_key);
int common_first_last(uchar * buf);
int partition_scan_set_up(uchar * buf, bool idx_read_flag);
int handle_unordered_next(uchar * buf, bool next_same);
int handle_unordered_scan_next_partition(uchar * buf);
- uchar *queue_buf(uint part_id)
- {
- return (m_ordered_rec_buffer +
- (part_id * (m_rec_length + PARTITION_BYTES_IN_POS)));
- }
- uchar *rec_buf(uint part_id)
- {
- return (queue_buf(part_id) +
- PARTITION_BYTES_IN_POS);
- }
int handle_ordered_index_scan(uchar * buf, bool reverse_order);
int handle_ordered_next(uchar * buf, bool next_same);
int handle_ordered_prev(uchar * buf);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5 branch (kent.boortz:3656 to 3657) | Kent Boortz | 27 Aug |