summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-11-12 18:08:12 +0100
committerSergei Golubchik <sergii@pisem.net>2011-11-12 18:08:12 +0100
commit557f0d3ad04111e274d709de5fd9879961772210 (patch)
treed7d1767519b4631349ca244a988478f808163919
parentdb0aed93482759844af7b39c9bf6e7fe141f28f6 (diff)
parent27095a24f6cb0e8c859c1a3f76050e6b5a6434c6 (diff)
downloadmariadb-git-557f0d3ad04111e274d709de5fd9879961772210.tar.gz
5.2->5.3 merge
-rw-r--r--mysql-test/r/table_elim.result19
-rw-r--r--mysql-test/t/table_elim.test18
-rw-r--r--plugin/feedback/utils.cc17
-rw-r--r--sql-common/my_time.c2
-rw-r--r--sql/opt_table_elimination.cc2
-rw-r--r--sql/records.cc2
-rw-r--r--storage/maria/ma_blockrec.c8
-rw-r--r--storage/maria/ma_ft_update.c8
-rw-r--r--storage/maria/ma_loghandler.c4
-rw-r--r--storage/maria/ma_open.c5
-rw-r--r--storage/myisam/mi_check.c15
-rw-r--r--storage/pbxt/src/ha_pbxt.cc2
-rw-r--r--storage/pbxt/src/thread_xt.cc3
-rw-r--r--storage/xtradb/buf/buf0buf.c4
-rw-r--r--storage/xtradb/handler/ha_innodb.cc2
15 files changed, 75 insertions, 36 deletions
diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result
index b4d3a2f6f2f..892ac29d6d5 100644
--- a/mysql-test/r/table_elim.result
+++ b/mysql-test/r/table_elim.result
@@ -567,3 +567,22 @@ id select_type table type possible_keys key key_len ref rows Extra
# ^^ The above must not produce a QEP of t3,t5,t2,t4
# as that violates the "no interleaving of outer join nests" rule.
DROP TABLE t1,t2,t3,t4,t5;
+#
+# BUG#884184: Wrong result with RIGHT JOIN + derived_merge
+#
+CREATE TABLE t1 (a int(11), b varchar(1)) ;
+INSERT IGNORE INTO t1 VALUES (0,'g');
+CREATE TABLE t3 ( a varchar(1)) ;
+INSERT IGNORE INTO t3 VALUES ('g');
+CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a)) ;
+create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
+SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
+a b
+NULL NULL
+EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 system NULL NULL NULL NULL 1
+1 SIMPLE t1 ALL NULL NULL NULL NULL 1 Using where
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where; Using index
+drop view v1;
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
index 3d17c7f5513..3b584ce2b38 100644
--- a/mysql-test/t/table_elim.test
+++ b/mysql-test/t/table_elim.test
@@ -500,3 +500,21 @@ WHERE t3.f2 ;
DROP TABLE t1,t2,t3,t4,t5;
+--echo #
+--echo # BUG#884184: Wrong result with RIGHT JOIN + derived_merge
+--echo #
+CREATE TABLE t1 (a int(11), b varchar(1)) ;
+INSERT IGNORE INTO t1 VALUES (0,'g');
+
+CREATE TABLE t3 ( a varchar(1)) ;
+INSERT IGNORE INTO t3 VALUES ('g');
+
+CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a)) ;
+create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
+
+SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
+EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
+
+drop view v1;
+DROP TABLE t1,t2,t3;
+
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc
index f32b527c052..48bbd72d530 100644
--- a/plugin/feedback/utils.cc
+++ b/plugin/feedback/utils.cc
@@ -188,24 +188,24 @@ int fill_plugin_version(THD *thd, TABLE_LIST *tables)
*/
static ulonglong my_getphysmem()
{
+#ifdef _WIN32
+ MEMORYSTATUSEX memstatus;
+ memstatus.dwLength= sizeof(memstatus);
+ GlobalMemoryStatusEx(&memstatus);
+ return memstatus.ullTotalPhys;
+#else
ulonglong pages= 0;
+
#ifdef _SC_PHYS_PAGES
pages= sysconf(_SC_PHYS_PAGES);
-#else
- return 0;
#endif
#ifdef _SC_PAGESIZE
return pages * sysconf(_SC_PAGESIZE);
-#endif
-#ifdef _WIN32
- MEMORYSTATUSEX memstatus;
- memstatus.dwLength= sizeof(memstatus);
- GlobalMemoryStatusEx(&memstatus);
- return memstatus.ullTotalPhys;
#else
return pages * my_getpagesize();
#endif
+#endif
}
/* get the number of (online) CPUs */
@@ -356,6 +356,7 @@ int fill_misc_data(THD *thd, TABLE_LIST *tables)
INSERT1("Cpu_count", (my_getncpus(), UNSIGNED));
#endif
INSERT1("Mem_total", (my_getphysmem(), UNSIGNED));
+ INSERT1("Now", (thd->query_start(), UNSIGNED));
return 0;
}
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 1d7960101a7..d2f7a8641ba 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -345,7 +345,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
{
if (str[0] == 'p' || str[0] == 'P')
add_hours= 12;
- else if (str[0] != 'a' || str[0] != 'A')
+ else if (str[0] != 'a' && str[0] != 'A')
continue; /* Not AM/PM */
str+= 2; /* Skip AM/PM */
/* Skip space after AM/PM */
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index 56396181619..545001c9df1 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -693,6 +693,8 @@ eliminate_tables_for_list(JOIN *join, List<TABLE_LIST> *join_list,
{
table_map outside_used_tables= tables_used_elsewhere |
tables_used_on_left;
+ if (on_expr)
+ outside_used_tables |= on_expr->used_tables();
if (tbl->nested_join)
{
/* This is "... LEFT JOIN (join_nest) ON cond" */
diff --git a/sql/records.cc b/sql/records.cc
index b125c201621..400287ec57c 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -626,7 +626,7 @@ static int rr_cmp(uchar *a,uchar *b)
if (a[4] != b[4])
return (int) a[4] - (int) b[4];
if (a[5] != b[5])
- return (int) a[1] - (int) b[5];
+ return (int) a[5] - (int) b[5];
if (a[6] != b[6])
return (int) a[6] - (int) b[6];
return (int) a[7] - (int) b[7];
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 670be915570..74898d981e9 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -5015,6 +5015,7 @@ static my_bool read_row_extent_info(MARIA_HA *info, uchar *buff,
MARIA_RECORD_POS *tail_pos;
uchar *data, *end_of_data;
uint flag, row_extents, row_extents_size;
+ uint field_lengths __attribute__ ((unused));
uchar *extents, *end;
DBUG_ENTER("read_row_extent_info");
@@ -5049,6 +5050,13 @@ static my_bool read_row_extent_info(MARIA_HA *info, uchar *buff,
}
info->cur_row.extents_count= row_extents;
+ /*
+ field_lengths looks unused but get_key_length will
+ increment data, which is required as data it's used later.
+ */
+ if (share->base.max_field_lengths)
+ get_key_length(field_lengths, data);
+
if (share->calc_checksum)
info->cur_row.checksum= (uint) (uchar) *data++;
if (row_extents > 1)
diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c
index 8576746981e..e99366033b4 100644
--- a/storage/maria/ma_ft_update.c
+++ b/storage/maria/ma_ft_update.c
@@ -319,6 +319,7 @@ my_bool _ma_ft_convert_to_ft2(MARIA_HA *info, MARIA_KEY *key)
uchar *key_ptr= (uchar*) dynamic_array_ptr(da, 0), *end;
uint length, key_length;
MARIA_PINNED_PAGE tmp_page_link, *page_link= &tmp_page_link;
+ MARIA_KEY tmp_key;
MARIA_PAGE page;
DBUG_ENTER("_ma_ft_convert_to_ft2");
@@ -356,9 +357,14 @@ my_bool _ma_ft_convert_to_ft2(MARIA_HA *info, MARIA_KEY *key)
/* inserting the rest of key values */
end= (uchar*) dynamic_array_ptr(da, da->elements);
+ tmp_key.keyinfo= keyinfo;
+ tmp_key.data_length= keyinfo->keylength;
+ tmp_key.ref_length= 0;
+ tmp_key.flag= 0;
for (key_ptr+=length; key_ptr < end; key_ptr+=keyinfo->keylength)
{
- if (_ma_ck_real_write_btree(info, key, &root, SEARCH_SAME))
+ tmp_key.data= key_ptr;
+ if (_ma_ck_real_write_btree(info, &tmp_key, &root, SEARCH_SAME))
DBUG_RETURN(1);
}
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index d54b0ed430f..874f4b56e37 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -2611,11 +2611,11 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
i < buffer->size;
i+= TRANSLOG_PAGE_SIZE, pg++)
{
+ TRANSLOG_ADDRESS addr __attribute__((unused))= (buffer->offset + i);
DBUG_PRINT("info", ("send log form %lu till %lu address: (%lu,0x%lx) "
"page #: %lu buffer size: %lu buffer: 0x%lx",
(ulong) i, (ulong) (i + TRANSLOG_PAGE_SIZE),
- LSN_IN_PARTS(buffer->offset + i), (ulong) pg,
- (ulong) buffer->size,
+ LSN_IN_PARTS(addr), (ulong) pg, (ulong) buffer->size,
(ulong) buffer));
DBUG_ASSERT(log_descriptor.pagecache->block_size == TRANSLOG_PAGE_SIZE);
DBUG_ASSERT(i + TRANSLOG_PAGE_SIZE <= buffer->size);
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index a7287e75127..5c507ba1bfa 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -1842,6 +1842,7 @@ void _ma_set_index_pagecache_callbacks(PAGECACHE_FILE *file,
int _ma_open_datafile(MARIA_HA *info, MARIA_SHARE *share, const char *org_name,
File file_to_dup __attribute__((unused)))
{
+ char *data_name= share->data_file_name.str;
char real_data_name[FN_REFLEN];
if (org_name)
@@ -1855,12 +1856,12 @@ int _ma_open_datafile(MARIA_HA *info, MARIA_SHARE *share, const char *org_name,
my_errno= HA_WRONG_CREATE_OPTION;
return 1;
}
+ data_name= real_data_name;
}
}
info->dfile.file= share->bitmap.file.file=
- my_open(share->data_file_name.str, share->mode | O_SHARE,
- MYF(MY_WME));
+ my_open(data_name, share->mode | O_SHARE, MYF(MY_WME));
return info->dfile.file >= 0 ? 0 : 1;
}
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index eb4592f4459..3dae65eed0b 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -941,7 +941,7 @@ static uint isam_key_length(MI_INFO *info, register MI_KEYDEF *keyinfo)
int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend)
{
int error,got_error,flag;
- uint key,UNINIT_VAR(left_length),b_type,field;
+ uint key, UNINIT_VAR(left_length), b_type;
ha_rows records,del_blocks;
my_off_t used,empty,pos,splits,UNINIT_VAR(start_recpos),
del_length,link_used,start_block;
@@ -972,19 +972,6 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend)
got_error=error=0;
empty=info->s->pack.header_length;
- /* Check how to calculate checksum of rows */
- if (info->s->data_file_type == COMPRESSED_RECORD)
- {
- for (field=0 ; field < info->s->base.fields ; field++)
- {
- if (info->s->rec[field].base_type == FIELD_BLOB ||
- info->s->rec[field].base_type == FIELD_VARCHAR)
- {
- break;
- }
- }
- }
-
pos=my_b_tell(&param->read_cache);
bzero((char*) key_checksum, info->s->base.keys * sizeof(key_checksum[0]));
while (pos < info->state->data_file_length)
diff --git a/storage/pbxt/src/ha_pbxt.cc b/storage/pbxt/src/ha_pbxt.cc
index bca4f017e7d..e551843a7b8 100644
--- a/storage/pbxt/src/ha_pbxt.cc
+++ b/storage/pbxt/src/ha_pbxt.cc
@@ -2898,11 +2898,9 @@ int ha_pbxt::update_row(const byte * old_data, byte * new_data)
* insert into t1 (val) values (1);
*/
if (table->found_next_number_field && new_data == table->record[0]) {
- MX_LONGLONG_T nr __attribute__ ((unused));
my_bitmap_map *old_map;
old_map = mx_tmp_use_all_columns(table, table->read_set);
- nr = table->found_next_number_field->val_int();
ha_set_auto_increment(pb_open_tab, table->found_next_number_field);
mx_tmp_restore_column_map(table, old_map);
}
diff --git a/storage/pbxt/src/thread_xt.cc b/storage/pbxt/src/thread_xt.cc
index 07f642e34b6..2ba287c1848 100644
--- a/storage/pbxt/src/thread_xt.cc
+++ b/storage/pbxt/src/thread_xt.cc
@@ -489,8 +489,7 @@ static void thr_free_resources(XTThreadPtr self, XTResourcePtr top)
xtPublic void xt_bug(XTThreadPtr XT_UNUSED(self))
{
static int *bug_ptr __attribute__ ((unused));
- bug_ptr= NULL;
-
+
bug_ptr = NULL;
}
diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c
index 8f9c40878f7..40a907b4199 100644
--- a/storage/xtradb/buf/buf0buf.c
+++ b/storage/xtradb/buf/buf0buf.c
@@ -3895,7 +3895,6 @@ buf_page_io_complete(
enum buf_io_fix io_type;
const ibool uncompressed = (buf_page_get_state(bpage)
== BUF_BLOCK_FILE_PAGE);
- //enum buf_flush flush_type;
mutex_t* block_mutex;
ut_a(buf_page_in_file(bpage));
@@ -4049,7 +4048,8 @@ corrupt:
}
}
- //buf_pool_mutex_enter();
+ //enum buf_flush flush_type;
+ //buf_pool_mutex_enter();
if (io_type == BUF_IO_WRITE) {
//flush_type = buf_page_get_flush_type(bpage);
/* to keep consistency at buf_LRU_insert_zip_clean() */
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 4eee85db06b..783508658a3 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -7289,7 +7289,7 @@ ha_innobase::create(
if (srv_file_per_table
&& !mysqld_embedded
- && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
+ && !(create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
if ((name[1] == ':')
|| (name[0] == '\\' && name[1] == '\\')) {