Commit 557f0d3a authored by Sergei Golubchik's avatar Sergei Golubchik

5.2->5.3 merge

parents db0aed93 27095a24
......@@ -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;
......@@ -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;
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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" */
......
......@@ -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];
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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() */
......
......@@ -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] == '\\')) {
......
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