mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-4280: Assertion `empty_size == empty_size_on_page' failure in ma_blockrec.c or ER_NOT_KEYFILE on query with DISTINCT and GROUP BY
This could happen when using Aria for internal temporary files (default case) and using DISTINCT. _ma_scan_restore_block_record() didn't work correctly if there was rows inserted, updated or deleted on the handler between calls to _ma_scan_remember_block_record() and _ma_scan_restore_block_record(). The effect was that some DISTINCT queries that used remove_dup_with_compare() could fail. .bzrignore: Ignore sql_yacc.hh mysql-test/suite/maria/r/distinct.result: Test case for MDEV-4280 mysql-test/suite/maria/t/distinct.test: Test case for MDEV-4280 mysql-test/t/mysql.test: Fixed test suite (we could get error -1 in some cases) sql/sql_select.cc: Break loop if restart_rnd_next() gives an error storage/maria/ha_maria.cc: scan_restore_pos() can return disk fault error. storage/maria/ma_blockrec.c: _ma_scan_remember_block_record() did incorrectly update scan.dir instead of scan_save.dir . _ma_scan_restore_block_record() didn't work correctly if there was rows inserted,updated or deleted on the handler between calls to _ma_scan_remember_block_record() and _ma_scan_restore_block_record(). Fixed by adding counters for row changes and reading the current scan page if changes had been made. storage/maria/ma_blockrec.h: scan_restore_pos() can return disk fault error. storage/maria/ma_delete.c: Increment row_changes storage/maria/ma_scan.c: scan_restore_pos() can return disk fault error. storage/maria/ma_update.c: Increment row_changes storage/maria/ma_write.c: Increment row_changes storage/maria/maria_def.h: scan_restore_pos() can return disk fault error.
This commit is contained in:
25
mysql-test/suite/maria/r/distinct.result
Normal file
25
mysql-test/suite/maria/r/distinct.result
Normal file
@ -0,0 +1,25 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
|
||||
INSERT t1 VALUES (3,2004),(2,2006),(1,2007),(3,2008),(2,2005),(2,2001);
|
||||
SELECT GROUP_CONCAT(a) FROM t1 GROUP BY b;
|
||||
GROUP_CONCAT(a)
|
||||
2
|
||||
3
|
||||
2
|
||||
2
|
||||
1
|
||||
3
|
||||
SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
|
||||
GROUP_CONCAT(a)
|
||||
2
|
||||
3
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (7,'q'),(2,NULL),(7,'g'),(6,'x');
|
||||
SELECT DISTINCT MAX( a ) FROM t1 GROUP BY b ORDER BY DES_DECRYPT( b );
|
||||
MAX( a )
|
||||
2
|
||||
7
|
||||
6
|
||||
DROP TABLE t1;
|
25
mysql-test/suite/maria/t/distinct.test
Normal file
25
mysql-test/suite/maria/t/distinct.test
Normal file
@ -0,0 +1,25 @@
|
||||
#
|
||||
# MDEV-4280:
|
||||
# Assertion `empty_size == empty_size_on_page' failure in ma_blockrec.c or
|
||||
# ER_NOT_KEYFILE on query with DISTINCT and GROUP BY
|
||||
#
|
||||
# This issue was a bug in how we delete row during duplicate removal when
|
||||
# we use Aria for internal temporary table.
|
||||
#
|
||||
|
||||
-- source include/have_maria.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
|
||||
INSERT t1 VALUES (3,2004),(2,2006),(1,2007),(3,2008),(2,2005),(2,2001);
|
||||
SELECT GROUP_CONCAT(a) FROM t1 GROUP BY b;
|
||||
SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (7,'q'),(2,NULL),(7,'g'),(6,'x');
|
||||
SELECT DISTINCT MAX( a ) FROM t1 GROUP BY b ORDER BY DES_DECRYPT( b );
|
||||
DROP TABLE t1;
|
@ -224,7 +224,7 @@ drop table t17583;
|
||||
--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
|
||||
|
||||
--echo The commands reported in the bug report
|
||||
--replace_regex /\([0-9]*\)/(errno)/
|
||||
--replace_regex /\([0-9|-]*\)/(errno)/
|
||||
--error 1
|
||||
--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
|
||||
|
||||
|
Reference in New Issue
Block a user