Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
10.0.1 , 5.5.30 , 5.1.67 , 5.2.14 , 5.3.12
Component/s:
None
CREATE TABLE t1 (a INT , b INT ) ENGINE=MyISAM;
INSERT t1 VALUES (3,2004),(2,2006),(1,2007),(3,2008),(2,2005),(2,2001);
SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
mysqld: ma_blockrec.c:701: check_directory: Assertion `empty_size == empty_size_on_page' failed.
mysqld got signal 6 ;
#7 0x00007f5cfcba5192 in __GI___assert_fail (assertion=0xd8b680 "empty_size == empty_size_on_page", file=0xd8b5b6 "ma_blockrec.c", line=701, function=0xd8d720 "check_directory") at assert.c:103
#8 0x00000000009ea8da in check_directory (buff=0x7f5cf054d038 "", block_size=8192, min_row_length=0, real_empty_size=73376) at ma_blockrec.c:701
#9 0x00000000009f3349 in delete_dir_entry (buff=0x7f5cf054d038 "", block_size=8192, record_number=3, empty_space_res=0x7f5cefd4943c) at ma_blockrec.c:4099
#10 0x00000000009f3557 in delete_head_or_tail (info=0x7f5ce003a438, page=1, record_number=3, head=1 '\001', from_update=0 '\000') at ma_blockrec.c:4161
#11 0x00000000009f3a8c in _ma_delete_block_record (info=0x7f5ce003a438, record=0x7f5ce001b248 "\376\376\326\a") at ma_blockrec.c:4280
#12 0x0000000000961d41 in maria_delete (info=0x7f5ce003a438, record=0x7f5ce001b248 "\376\376\326\a") at ma_delete.c:109
#13 0x000000000094025b in ha_maria::delete_row (this=0x7f5ce001b0b8, buf=0x7f5ce001b248 "\376\376\326\a") at ha_maria.cc:2125
#14 0x00000000007ce044 in handler::ha_delete_row (this=0x7f5ce001b0b8, buf=0x7f5ce001b248 "\376\376\326\a") at handler.cc:4829
#15 0x000000000071eb81 in remove_dup_with_compare (thd=0x3a98c98, table=0x7f5ce0032d60, first_field=0x7f5ce00339d0, offset=6, having=0x0) at sql_select.cc:14645
#16 0x000000000071e897 in remove_duplicates (join=0x7f5ce0030d70, entry=0x7f5ce0032d60, fields=..., having=0x0) at sql_select.cc:14575
#17 0x00000000006feafa in JOIN::exec (this=0x7f5ce0030d70) at sql_select.cc:2158
#18 0x00000000006fffe7 in mysql_select (thd=0x3a98c98, rref_pointer_array=0x3a9b030, tables=0x7f5ce001cd60, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f5ce001d1a0, having=0x0, proc_param=0x0, select_options=2147764737, result=0x7f5ce001d270, unit=0x3a9aa30, select_lex=0x3a9ae58) at sql_select.cc:2576
#19 0x00000000006f7e69 in handle_select (thd=0x3a98c98, lex=0x3a9a990, result=0x7f5ce001d270, setup_tables_done_option=0) at sql_select.cc:280
#20 0x0000000000695116 in execute_sqlcom_select (thd=0x3a98c98, all_tables=0x7f5ce001cd60) at sql_parse.cc:5247
#21 0x000000000068bf90 in mysql_execute_command (thd=0x3a98c98) at sql_parse.cc:2386
#22 0x00000000006978f9 in mysql_parse (thd=0x3a98c98, rawbuf=0x7f5ce001c690 "SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b", length=50, found_semicolon=0x7f5cefd4a900) at sql_parse.cc:6222
#23 0x0000000000689729 in dispatch_command (command=COM_QUERY, thd=0x3a98c98, packet=0x3b05969 "SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b", packet_length=50) at sql_parse.cc:1294
#24 0x0000000000688624 in do_command (thd=0x3a98c98) at sql_parse.cc:906
#25 0x00000000006855bb in handle_one_connection (arg=0x3a98c98) at sql_connect.cc:1238
#26 0x00007f5cfcf3ce9a in start_thread (arg=0x7f5cefd4b700) at pthread_create.c:308
#27 0x00007f5cfcc69cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
revision-id: holyfoot@askmonty.org-20130310190805-3jncxhq14nr7vw66
revno: 3188
branch-nick: 5.1
Built with BUILD/compile-pentium-debug-max-no-ndb
Also reproducible on current 5.2, 5.3, 5.5, 10.0 trees.
With a slightly different dataset, there is no assertion failure, but ER_NOT_KEYFILE is produced instead:
CREATE TABLE t1 (a INT , b INT ) ENGINE=MyISAM;
INSERT t1 VALUES (3,1),(2,2),(1,3),(3,4),(2,5),(2,6);
SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
Result:
MariaDB [test]> SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
ERROR 1034 (HY000): Incorrect key file for table '/home/elenst/bzr/5.1/data/tmp/#sql_1245_0' ; try to repair it
Yet another test case, now without GROUP_CONCAT:
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 );
Result:
query 'SELECT DISTINCT MAX( a ) FROM t1 GROUP BY b ORDER BY DES_DECRYPT( b )' failed: 1034: Incorrect key file for table '5.3/mysql-test/var/tmp/mysqld.1/#sql_5791_0'; try to repair it
{"report":{"fcp":799.6999999992549,"ttfb":264,"pageVisibility":"visible","entityId":23302,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"4275921e-610b-41fe-8d09-ffcf2f1abebd","navigationType":0,"readyForUser":874.8000000007451,"redirectCount":0,"resourceLoadedEnd":617.3000000007451,"resourceLoadedStart":270,"resourceTiming":[{"duration":11,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":270,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":270,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":281,"responseStart":0,"secureConnectionStart":0},{"duration":10.899999998509884,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":270.30000000074506,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":270.30000000074506,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":281.19999999925494,"responseStart":0,"secureConnectionStart":0},{"duration":86.10000000149012,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":270.5,"connectEnd":270.5,"connectStart":270.5,"domainLookupEnd":270.5,"domainLookupStart":270.5,"fetchStart":270.5,"redirectEnd":0,"redirectStart":0,"requestStart":283.1000000014901,"responseEnd":356.6000000014901,"responseStart":315.5,"secureConnectionStart":270.5},{"duration":111.90000000223517,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":270.69999999925494,"connectEnd":270.69999999925494,"connectStart":270.69999999925494,"domainLookupEnd":270.69999999925494,"domainLookupStart":270.69999999925494,"fetchStart":270.69999999925494,"redirectEnd":0,"redirectStart":0,"requestStart":284.5,"responseEnd":382.6000000014901,"responseStart":320.69999999925494,"secureConnectionStart":270.69999999925494},{"duration":44.599999997764826,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":270.80000000074506,"connectEnd":270.80000000074506,"connectStart":270.80000000074506,"domainLookupEnd":270.80000000074506,"domainLookupStart":270.80000000074506,"fetchStart":270.80000000074506,"redirectEnd":0,"redirectStart":0,"requestStart":285,"responseEnd":315.3999999985099,"responseStart":314.5,"secureConnectionStart":270.80000000074506},{"duration":43.600000001490116,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":270.8999999985099,"connectEnd":270.8999999985099,"connectStart":270.8999999985099,"domainLookupEnd":270.8999999985099,"domainLookupStart":270.8999999985099,"fetchStart":270.8999999985099,"redirectEnd":0,"redirectStart":0,"requestStart":286.30000000074506,"responseEnd":314.5,"responseStart":313.6000000014901,"secureConnectionStart":270.8999999985099},{"duration":54.900000002235174,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":271.19999999925494,"connectEnd":271.19999999925494,"connectStart":271.19999999925494,"domainLookupEnd":271.19999999925494,"domainLookupStart":271.19999999925494,"fetchStart":271.19999999925494,"redirectEnd":0,"redirectStart":0,"requestStart":288.30000000074506,"responseEnd":326.1000000014901,"responseStart":325.3999999985099,"secureConnectionStart":271.19999999925494},{"duration":16.699999999254942,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":271.30000000074506,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.30000000074506,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":288,"responseStart":0,"secureConnectionStart":0},{"duration":67.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":271.5,"connectEnd":271.5,"connectStart":271.5,"domainLookupEnd":271.5,"domainLookupStart":271.5,"fetchStart":271.5,"redirectEnd":0,"redirectStart":0,"requestStart":291.19999999925494,"responseEnd":339,"responseStart":338.30000000074506,"secureConnectionStart":271.5},{"duration":18.900000002235174,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":271.69999999925494,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":271.69999999925494,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":290.6000000014901,"responseStart":0,"secureConnectionStart":0},{"duration":40.69999999925494,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":271.80000000074506,"connectEnd":293.69999999925494,"connectStart":293.69999999925494,"domainLookupEnd":293.69999999925494,"domainLookupStart":293.69999999925494,"fetchStart":271.80000000074506,"redirectEnd":0,"redirectStart":0,"requestStart":293.80000000074506,"responseEnd":312.5,"responseStart":305.80000000074506,"secureConnectionStart":293.69999999925494},{"duration":40.69999999925494,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":283.69999999925494,"connectEnd":283.69999999925494,"connectStart":283.69999999925494,"domainLookupEnd":283.69999999925494,"domainLookupStart":283.69999999925494,"fetchStart":283.69999999925494,"redirectEnd":0,"redirectStart":0,"requestStart":311.69999999925494,"responseEnd":324.3999999985099,"responseStart":323.1000000014901,"secureConnectionStart":283.69999999925494},{"duration":331.9000000022352,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":285.3999999985099,"connectEnd":285.3999999985099,"connectStart":285.3999999985099,"domainLookupEnd":285.3999999985099,"domainLookupStart":285.3999999985099,"fetchStart":285.3999999985099,"redirectEnd":0,"redirectStart":0,"requestStart":322.6000000014901,"responseEnd":617.3000000007451,"responseStart":613.3999999985099,"secureConnectionStart":285.3999999985099},{"duration":214.09999999776483,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":562.6000000014901,"connectEnd":562.6000000014901,"connectStart":562.6000000014901,"domainLookupEnd":562.6000000014901,"domainLookupStart":562.6000000014901,"fetchStart":562.6000000014901,"redirectEnd":0,"redirectStart":0,"requestStart":740.6000000014901,"responseEnd":776.6999999992549,"responseStart":776,"secureConnectionStart":562.6000000014901}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":94,"responseStart":264,"responseEnd":286,"domLoading":268,"domInteractive":931,"domContentLoadedEventStart":931,"domContentLoadedEventEnd":969,"domComplete":1658,"loadEventStart":1658,"loadEventEnd":1658,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":912.6999999992549},{"name":"bigPipe.sidebar-id.end","time":913.3999999985099},{"name":"bigPipe.activity-panel-pipe-id.start","time":913.6000000014901},{"name":"bigPipe.activity-panel-pipe-id.end","time":914.6000000014901},{"name":"activityTabFullyLoaded","time":984.6999999992549}],"measures":[],"correlationId":"84ee8981212968","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":94,"dbReadsTimeInMs":9,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
_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.