Commit 8103526b authored by Jan Lindström's avatar Jan Lindström

MDEV-9667: Server hangs after select count(distinct name) from t2 where a=8366 and b>=5 and b<=5;

In row_search_for_mysql function on XtraDB there was a old logic
where null bytes were inited. This caused server to think that
key value is null and continue on incorrect path.
parent 8942824a
create table t2 (a smallint(6) not null, b int(10) not null, name varchar(20), primary key(a,b), key(name)) engine=InnoDB;
insert into t2 values (8355,3,"sanja"),(8355,4,"wlad"),(8366,5, "lawrin"),(8366,6,"markusjm");
select count(distinct name) from t2 where a=8366 and b>=5 and b<=5;
count(distinct name)
1
select count(distinct name) from t2 where a=8366 and b=5;
count(distinct name)
1
select count(distinct name) from t2 where a=8366 and b between 5 and 5.5;
count(distinct name)
1
select sum(distinct a) from t2 where a=8366 and b>=5 and b<=5;
sum(distinct a)
8366
select sum(distinct a) from t2 where a=8366 and b=5;
sum(distinct a)
8366
select sum(distinct a) from t2 where a=8366 and b between 5 and 5.5;
sum(distinct a)
8366
drop table t2;
--source include/have_innodb.inc
#
# MDEV-9667: Server hangs after select count(distinct name) from t2 where a=8366 and b>=5 and b<=5;
#
create table t2 (a smallint(6) not null, b int(10) not null, name varchar(20), primary key(a,b), key(name)) engine=InnoDB;
insert into t2 values (8355,3,"sanja"),(8355,4,"wlad"),(8366,5, "lawrin"),(8366,6,"markusjm");
select count(distinct name) from t2 where a=8366 and b>=5 and b<=5;
select count(distinct name) from t2 where a=8366 and b=5;
select count(distinct name) from t2 where a=8366 and b between 5 and 5.5;
select sum(distinct a) from t2 where a=8366 and b>=5 and b<=5;
select sum(distinct a) from t2 where a=8366 and b=5;
select sum(distinct a) from t2 where a=8366 and b between 5 and 5.5;
drop table t2;
......@@ -7559,7 +7559,7 @@ ha_innobase::write_row(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -7801,7 +7801,7 @@ func_exit:
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -8139,7 +8139,7 @@ ha_innobase::update_row(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -8242,7 +8242,7 @@ func_exit:
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -11117,7 +11117,7 @@ ha_innobase::truncate()
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -11138,7 +11138,7 @@ ha_innobase::truncate()
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -12439,7 +12439,7 @@ ha_innobase::analyze(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -12455,7 +12455,7 @@ ha_innobase::analyze(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......@@ -13629,7 +13629,7 @@ ha_innobase::transactional_table_lock(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
"InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
......
......@@ -3738,12 +3738,6 @@ row_search_for_mysql(
ut_error;
}
/* init null bytes with default values as they might be
left uninitialized in some cases and these uninited bytes
might be copied into mysql record buffer that leads to
valgrind warnings */
memcpy(buf, prebuilt->default_rec, prebuilt->null_bitmap_len);
#if 0
/* August 19, 2005 by Heikki: temporarily disable this error
print until the cursor lock count is done correctly.
......
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