Hi everyone, it seems there's a very "weird" and dangerous regression in mysql 10.4.6...
So basically for it to work you need myisam table with UNIQUE KEY ... USING HASH. I was reading in docs it doesn't make a difference, but when used in newest maria it'll make the table behave very strangely, so you can NOT do INSERT INTO with > 100 rows at once.
DROP TABLE IF EXISTS `_hits`;
|
CREATE TABLE `_hits` (
|
`creative_id` int(11) NOT NULL,
|
`ip` varchar(15) NOT NULL,
|
`date` date NOT NULL,
|
UNIQUE KEY (`creative_id`,`date`,`ip`) USING HASH
|
) ENGINE=myisam DEFAULT CHARSET=utf8;
|
|
INSERT INTO `_hits` VALUES
|
(0, '0.1.1.0', '2018-01-01'),(1, '1.1.1.1', '2018-01-01'),(2, '2.1.1.2', '2018-01-01'),(3, '3.1.1.3', '2018-01-01'),(4, '4.1.1.4', '2018-01-01'),(5, '5.1.1.5', '2018-01-01'),(6, '6.1.1.6', '2018-01-01'),(7, '7.1.1.7', '2018-01-01'),(8, '8.1.1.8', '2018-01-01'),(9, '9.1.1.9', '2018-01-01'),
|
(10, '10.1.1.10', '2018-01-01'),(11, '11.1.1.11', '2018-01-01'),(12, '12.1.1.12', '2018-01-01'),(13, '13.1.1.13', '2018-01-01'),(14, '14.1.1.14', '2018-01-01'),(15, '15.1.1.15', '2018-01-01'),(16, '16.1.1.16', '2018-01-01'),(17, '17.1.1.17', '2018-01-01'),(18, '18.1.1.18', '2018-01-01'),(19, '19.1.1.19', '2018-01-01'),
|
(20, '20.1.1.20', '2018-01-01'),(21, '21.1.1.21', '2018-01-01'),(22, '22.1.1.22', '2018-01-01'),(23, '23.1.1.23', '2018-01-01'),(24, '24.1.1.24', '2018-01-01'),(25, '25.1.1.25', '2018-01-01'),(26, '26.1.1.26', '2018-01-01'),(27, '27.1.1.27', '2018-01-01'),(28, '28.1.1.28', '2018-01-01'),(29, '29.1.1.29', '2018-01-01'),
|
(30, '30.1.1.30', '2018-01-01'),(31, '31.1.1.31', '2018-01-01'),(32, '32.1.1.32', '2018-01-01'),(33, '33.1.1.33', '2018-01-01'),(34, '34.1.1.34', '2018-01-01'),(35, '35.1.1.35', '2018-01-01'),(36, '36.1.1.36', '2018-01-01'),(37, '37.1.1.37', '2018-01-01'),(38, '38.1.1.38', '2018-01-01'),(39, '39.1.1.39', '2018-01-01'),
|
(40, '40.1.1.40', '2018-01-01'),(41, '41.1.1.41', '2018-01-01'),(42, '42.1.1.42', '2018-01-01'),(43, '43.1.1.43', '2018-01-01'),(44, '44.1.1.44', '2018-01-01'),(45, '45.1.1.45', '2018-01-01'),(46, '46.1.1.46', '2018-01-01'),(47, '47.1.1.47', '2018-01-01'),(48, '48.1.1.48', '2018-01-01'),(49, '49.1.1.49', '2018-01-01'),
|
(50, '50.1.1.50', '2018-01-01'),(51, '51.1.1.51', '2018-01-01'),(52, '52.1.1.52', '2018-01-01'),(53, '53.1.1.53', '2018-01-01'),(54, '54.1.1.54', '2018-01-01'),(55, '55.1.1.55', '2018-01-01'),(56, '56.1.1.56', '2018-01-01'),(57, '57.1.1.57', '2018-01-01'),(58, '58.1.1.58', '2018-01-01'),(59, '59.1.1.59', '2018-01-01'),
|
(60, '60.1.1.60', '2018-01-01'),(61, '61.1.1.61', '2018-01-01'),(62, '62.1.1.62', '2018-01-01'),(63, '63.1.1.63', '2018-01-01'),(64, '64.1.1.64', '2018-01-01'),(65, '65.1.1.65', '2018-01-01'),(66, '66.1.1.66', '2018-01-01'),(67, '67.1.1.67', '2018-01-01'),(68, '68.1.1.68', '2018-01-01'),(69, '69.1.1.69', '2018-01-01'),
|
(70, '70.1.1.70', '2018-01-01'),(71, '71.1.1.71', '2018-01-01'),(72, '72.1.1.72', '2018-01-01'),(73, '73.1.1.73', '2018-01-01'),(74, '74.1.1.74', '2018-01-01'),(75, '75.1.1.75', '2018-01-01'),(76, '76.1.1.76', '2018-01-01'),(77, '77.1.1.77', '2018-01-01'),(78, '78.1.1.78', '2018-01-01'),(79, '79.1.1.79', '2018-01-01'),
|
(80, '80.1.1.80', '2018-01-01'),(81, '81.1.1.81', '2018-01-01'),(82, '82.1.1.82', '2018-01-01'),(83, '83.1.1.83', '2018-01-01'),(84, '84.1.1.84', '2018-01-01'),(85, '85.1.1.85', '2018-01-01'),(86, '86.1.1.86', '2018-01-01'),(87, '87.1.1.87', '2018-01-01'),(88, '88.1.1.88', '2018-01-01'),(89, '89.1.1.89', '2018-01-01'),
|
(90, '90.1.1.90', '2018-01-01'),(91, '91.1.1.91', '2018-01-01'),(92, '92.1.1.92', '2018-01-01'),(93, '93.1.1.93', '2018-01-01'),(94, '94.1.1.94', '2018-01-01'),(95, '95.1.1.95', '2018-01-01'),(96, '96.1.1.96', '2018-01-01'),(97, '97.1.1.97', '2018-01-01'),(98, '98.1.1.98', '2018-01-01'),(99, '99.1.1.99', '2018-01-01')
|
So this code will produce
[Err] 1032 - Can't find record in '_hits'
To make it work correctly again you can do just one of the following:
- Change engine to innodb or memory
- Remove ANY dataset from insert so it'll do 99 items correctly
- Change key, remove "USING HASH"
- Change key, remove "UNIQUE"
When you change the engine to aria it exhibits same behaviour as myisam, but it gives different error:
[Err] 1904 - Key/Index cannot be defined on a virtual generated column
(and works correctly for USING BTREE)
It works totally fine in older versions eg. Maria 10.2.9, 10.1.22 etc. I was trying to find somethig related to this and found some report with same bug related to replication. I don't remember the URL and details, it wasn't resolved... so i think it could also be breaking statement based replication and it's probably hard to diagnose.
Most strange thing is that HASH indexes shouldn't even be supported by myisam so it should work like default b-tree index, so in fact it should make no difference if USING HASH is there or not, right?
Thanks for the help
{"report":{"fcp":1358.2000000476837,"ttfb":354,"pageVisibility":"visible","entityId":77406,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"e4063471-eb78-4da6-84f2-2fccf8436158","navigationType":0,"readyForUser":1512.7000000476837,"redirectCount":0,"resourceLoadedEnd":1556.2000000476837,"resourceLoadedStart":362.60000002384186,"resourceTiming":[{"duration":318.10000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":362.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":362.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":680.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":318.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":362.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":362.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":681,"responseStart":0,"secureConnectionStart":0},{"duration":327.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":363.10000002384186,"connectEnd":363.10000002384186,"connectStart":363.10000002384186,"domainLookupEnd":363.10000002384186,"domainLookupStart":363.10000002384186,"fetchStart":363.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":363.10000002384186,"responseEnd":690.5,"responseStart":690.5,"secureConnectionStart":363.10000002384186},{"duration":422.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":363.3000000715256,"connectEnd":363.3000000715256,"connectStart":363.3000000715256,"domainLookupEnd":363.3000000715256,"domainLookupStart":363.3000000715256,"fetchStart":363.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":363.3000000715256,"responseEnd":785.9000000953674,"responseStart":785.9000000953674,"secureConnectionStart":363.3000000715256},{"duration":428.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":363.5,"connectEnd":363.5,"connectStart":363.5,"domainLookupEnd":363.5,"domainLookupStart":363.5,"fetchStart":363.5,"redirectEnd":0,"redirectStart":0,"requestStart":363.5,"responseEnd":792.2000000476837,"responseStart":792.2000000476837,"secureConnectionStart":363.5},{"duration":428.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":363.7000000476837,"connectEnd":363.7000000476837,"connectStart":363.7000000476837,"domainLookupEnd":363.7000000476837,"domainLookupStart":363.7000000476837,"fetchStart":363.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":363.7000000476837,"responseEnd":792.6000000238419,"responseStart":792.5,"secureConnectionStart":363.7000000476837},{"duration":429,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":364,"connectEnd":364,"connectStart":364,"domainLookupEnd":364,"domainLookupStart":364,"fetchStart":364,"redirectEnd":0,"redirectStart":0,"requestStart":364,"responseEnd":793,"responseStart":793,"secureConnectionStart":364},{"duration":561.2000000476837,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":364.10000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":364.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":925.3000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":429.10000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":364.3000000715256,"connectEnd":364.3000000715256,"connectStart":364.3000000715256,"domainLookupEnd":364.3000000715256,"domainLookupStart":364.3000000715256,"fetchStart":364.3000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":364.3000000715256,"responseEnd":793.4000000953674,"responseStart":793.4000000953674,"secureConnectionStart":364.3000000715256},{"duration":561.1000000238419,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":364.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":364.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":925.6000000238419,"responseStart":0,"secureConnectionStart":0},{"duration":429.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":364.5,"connectEnd":364.5,"connectStart":364.5,"domainLookupEnd":364.5,"domainLookupStart":364.5,"fetchStart":364.5,"redirectEnd":0,"redirectStart":0,"requestStart":364.5,"responseEnd":794,"responseStart":794,"secureConnectionStart":364.5},{"duration":1115.8999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":371.2000000476837,"connectEnd":371.2000000476837,"connectStart":371.2000000476837,"domainLookupEnd":371.2000000476837,"domainLookupStart":371.2000000476837,"fetchStart":371.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":371.2000000476837,"responseEnd":1487.1000000238419,"responseStart":1487.1000000238419,"secureConnectionStart":371.2000000476837},{"duration":1109.3999999761581,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":378.60000002384186,"connectEnd":378.60000002384186,"connectStart":378.60000002384186,"domainLookupEnd":378.60000002384186,"domainLookupStart":378.60000002384186,"fetchStart":378.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":378.60000002384186,"responseEnd":1488,"responseStart":1488,"secureConnectionStart":378.60000002384186},{"duration":171.60000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":950.5,"connectEnd":950.5,"connectStart":950.5,"domainLookupEnd":950.5,"domainLookupStart":950.5,"fetchStart":950.5,"redirectEnd":0,"redirectStart":0,"requestStart":950.5,"responseEnd":1122.1000000238419,"responseStart":1122.1000000238419,"secureConnectionStart":950.5},{"duration":309.7000000476837,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1246.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1246.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1556.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":396.8000000715256,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1247.5,"connectEnd":1247.5,"connectStart":1247.5,"domainLookupEnd":1247.5,"domainLookupStart":1247.5,"fetchStart":1247.5,"redirectEnd":0,"redirectStart":0,"requestStart":1247.5,"responseEnd":1644.3000000715256,"responseStart":1644.2000000476837,"secureConnectionStart":1247.5},{"duration":403.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":1247.9000000953674,"connectEnd":1247.9000000953674,"connectStart":1247.9000000953674,"domainLookupEnd":1247.9000000953674,"domainLookupStart":1247.9000000953674,"fetchStart":1247.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":1247.9000000953674,"responseEnd":1651.2000000476837,"responseStart":1651.2000000476837,"secureConnectionStart":1247.9000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":156,"responseStart":354,"responseEnd":378,"domLoading":359,"domInteractive":1608,"domContentLoadedEventStart":1608,"domContentLoadedEventEnd":1688,"domComplete":2433,"loadEventStart":2433,"loadEventEnd":2434,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1572.8000000715256},{"name":"bigPipe.sidebar-id.end","time":1573.6000000238419},{"name":"bigPipe.activity-panel-pipe-id.start","time":1573.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":1577.9000000953674},{"name":"activityTabFullyLoaded","time":1709.3000000715256}],"measures":[],"correlationId":"97e29a14343f04","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":124,"dbReadsTimeInMs":15,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thanks a lot for the report! I repeated as described on MariaDB 10.4:
MariaDB [test]> CREATE TABLE `t2` (
-> `creative_id` int(11) NOT NULL,
-> `ip` varchar(15) NOT NULL,
-> `date` date NOT NULL,
-> UNIQUE KEY (`creative_id`,`date`,`ip`) USING HASH
-> ) ENGINE=myisam;
Query OK, 0 rows affected (0.021 sec)
MariaDB [test]> INSERT INTO `t2` select seq, CONCAT(seq,'1.1',seq), '2018-01-01' from seq_1_to_100;
ERROR 1032 (HY000): Can't find record in 't2'
MariaDB [test]> CREATE TABLE `t3` (
-> `creative_id` int(11) NOT NULL,
-> `ip` varchar(15) NOT NULL,
-> `date` date NOT NULL,
-> UNIQUE KEY (`creative_id`,`date`,`ip`) USING HASH
-> ) ENGINE=aria;
ERROR 1904 (HY000): Key/Index cannot be defined on a virtual generated column