From bd2b05df6c5806e599698eb239b3e44b971eb031 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 15 Nov 2019 11:14:25 +0100 Subject: [PATCH 1/5] update create_w_max_indexes_128.result using create_w_max_indexes_64.result as a template --- mysql-test/r/create_w_max_indexes_128.result | 256 +++++++++---------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/mysql-test/r/create_w_max_indexes_128.result b/mysql-test/r/create_w_max_indexes_128.result index cd23e493f5c..d86bc912e58 100644 --- a/mysql-test/r/create_w_max_indexes_128.result +++ b/mysql-test/r/create_w_max_indexes_128.result @@ -259,70 +259,70 @@ key a128_long_123456789_123456789_123456789_123456789_123456789_1234 ( c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) ); Warnings: -Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a065_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -881,70 +881,70 @@ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), add key a128_long_123456789_123456789_123456789_123456789_123456789_1234 ( c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); Warnings: -Note 1831 Duplicate index 'a002_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a003_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a004_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a005_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a006_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a007_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a008_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a009_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a010_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a011_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a012_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a013_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a014_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a015_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a016_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a017_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a018_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a019_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a020_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a021_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a022_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a023_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a024_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a025_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a026_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a027_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a028_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a029_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a030_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a031_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a032_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a033_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a034_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a035_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a036_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a037_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a038_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a039_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a040_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a041_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a042_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a043_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a044_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a045_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a046_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a047_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a048_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a049_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a050_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a051_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a052_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a053_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a054_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a055_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a056_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a057_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a058_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a059_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a060_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a061_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a062_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a063_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a064_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release -Note 1831 Duplicate index 'a065_long_123456789_123456789_123456789_123456789_123456789_1234' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a002_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a003_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a004_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a005_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a006_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a007_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a008_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a009_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a010_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a011_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a012_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a013_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a014_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a015_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a016_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a017_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a018_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a019_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a020_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a021_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a022_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a023_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a024_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a025_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a026_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a027_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a028_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a029_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a030_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a031_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a032_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a033_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a034_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a035_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a036_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a037_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a038_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a039_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a040_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a041_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a042_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a043_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a044_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a045_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a046_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a047_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a048_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a049_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a050_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a051_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a052_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a053_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a054_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a055_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a056_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a057_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a058_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a059_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a060_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a061_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a062_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a063_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a064_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release +Note 1831 Duplicate index `a065_long_123456789_123456789_123456789_123456789_123456789_1234`. This is deprecated and will be disallowed in a future release show create table t1; Table Create Table t1 CREATE TABLE `t1` ( From 86167e908fe5de6f6e9f5076b4ea8041514d0820 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 15 Nov 2019 23:37:28 +0300 Subject: [PATCH 2/5] MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error Fix partitioning and DS-MRR to work together - In ha_partition::index_end(): take into account that ha_innobase (and other engines using DS-MRR) will have inited=RND when initialized for DS-MRR scan. - In ha_partition::multi_range_read_next(): if the MRR scan is using HA_MRR_NO_ASSOCIATION mode, it is not guaranteed that the partition's handler will store anything into *range_info. - In DsMrr_impl::choose_mrr_impl(): ha_partition will inquire partitions about how much memory their MRR implementation needs by passing *buffer_size=0. DS-MRR code didn't know about this (actually it used uint for buffer size calculation and would have an under-flow). Returning *buffer_size=0 made ha_partition assume that partitions do not need MRR memory and pass the same buffer to each of them. Now, this is fixed. If DS-MRR gets *buffer_size=0, it will return the amount of buffer space needed, but not more than about @@mrr_buffer_size. * Fix ha_{innobase,maria,myisam}::clone. If ha_partition uses MRR on its partitions, and partition use DS-MRR, the code will call handler->clone with TABLE (*NOT partition*) name as an argument. DS-MRR has no way of knowing the partition name, so the solution was to have the ::clone() function for the affected storage engine to ignore the name argument and get it elsewhere. --- mysql-test/include/partition_mrr.inc | 46 ++++++++++++ mysql-test/main/partition_mrr_aria.result | 79 +++++++++++++++++++++ mysql-test/main/partition_mrr_aria.test | 2 + mysql-test/main/partition_mrr_innodb.result | 79 +++++++++++++++++++++ mysql-test/main/partition_mrr_innodb.test | 4 ++ mysql-test/main/partition_mrr_myisam.result | 79 +++++++++++++++++++++ mysql-test/main/partition_mrr_myisam.test | 3 + sql/ha_partition.cc | 14 +++- sql/multi_range_read.cc | 33 +++++++-- sql/multi_range_read.h | 5 +- storage/innobase/handler/ha_innodb.cc | 2 +- storage/maria/ha_maria.cc | 8 ++- storage/myisam/ha_myisam.cc | 7 +- 13 files changed, 343 insertions(+), 18 deletions(-) create mode 100644 mysql-test/include/partition_mrr.inc create mode 100644 mysql-test/main/partition_mrr_aria.result create mode 100644 mysql-test/main/partition_mrr_aria.test create mode 100644 mysql-test/main/partition_mrr_innodb.result create mode 100644 mysql-test/main/partition_mrr_innodb.test create mode 100644 mysql-test/main/partition_mrr_myisam.result create mode 100644 mysql-test/main/partition_mrr_myisam.test diff --git a/mysql-test/include/partition_mrr.inc b/mysql-test/include/partition_mrr.inc new file mode 100644 index 00000000000..4c285791ec7 --- /dev/null +++ b/mysql-test/include/partition_mrr.inc @@ -0,0 +1,46 @@ +--source include/have_partition.inc + +--disable_warnings +drop table if exists t1,t3; +--enable_warnings + +--echo # +--echo # MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error +--echo # +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +set @tmp=@@storage_engine; +eval set storage_engine=$engine_type; + +create table t3 ( + ID bigint(20) NOT NULL AUTO_INCREMENT, + part_id int, + key_col int, + col2 int, + key(key_col), + PRIMARY KEY (ID,part_id) +) PARTITION BY RANGE (part_id) +(PARTITION p1 VALUES LESS THAN (3), + PARTITION p2 VALUES LESS THAN (7), + PARTITION p3 VALUES LESS THAN (10) +); + +show create table t3; +set storage_engine= @tmp; + +insert into t3 select + A.a+10*B.a, + A.a, + B.a, + 123456 +from t1 A, t1 B; + +set optimizer_switch='mrr=on'; +--replace_column 9 # +explain +select * from t3 force index (key_col) where key_col < 3; +select * from t3 force index (key_col) where key_col < 3; + +drop table t1,t3; + diff --git a/mysql-test/main/partition_mrr_aria.result b/mysql-test/main/partition_mrr_aria.result new file mode 100644 index 00000000000..7a0c35a309e --- /dev/null +++ b/mysql-test/main/partition_mrr_aria.result @@ -0,0 +1,79 @@ +drop table if exists t1,t3; +# +# MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +set @tmp=@@storage_engine; +set storage_engine=Aria; +create table t3 ( +ID bigint(20) NOT NULL AUTO_INCREMENT, +part_id int, +key_col int, +col2 int, +key(key_col), +PRIMARY KEY (ID,part_id) +) PARTITION BY RANGE (part_id) +(PARTITION p1 VALUES LESS THAN (3), +PARTITION p2 VALUES LESS THAN (7), +PARTITION p3 VALUES LESS THAN (10) +); +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `ID` bigint(20) NOT NULL AUTO_INCREMENT, + `part_id` int(11) NOT NULL, + `key_col` int(11) DEFAULT NULL, + `col2` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`,`part_id`), + KEY `key_col` (`key_col`) +) ENGINE=Aria DEFAULT CHARSET=latin1 + PARTITION BY RANGE (`part_id`) +(PARTITION `p1` VALUES LESS THAN (3) ENGINE = Aria, + PARTITION `p2` VALUES LESS THAN (7) ENGINE = Aria, + PARTITION `p3` VALUES LESS THAN (10) ENGINE = Aria) +set storage_engine= @tmp; +insert into t3 select +A.a+10*B.a, +A.a, +B.a, +123456 +from t1 A, t1 B; +set optimizer_switch='mrr=on'; +explain +select * from t3 force index (key_col) where key_col < 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan +select * from t3 force index (key_col) where key_col < 3; +ID part_id key_col col2 +1 0 0 123456 +1 1 0 123456 +2 2 0 123456 +10 0 1 123456 +11 1 1 123456 +12 2 1 123456 +20 0 2 123456 +21 1 2 123456 +22 2 2 123456 +3 3 0 123456 +4 4 0 123456 +5 5 0 123456 +6 6 0 123456 +13 3 1 123456 +14 4 1 123456 +15 5 1 123456 +16 6 1 123456 +23 3 2 123456 +24 4 2 123456 +25 5 2 123456 +26 6 2 123456 +7 7 0 123456 +8 8 0 123456 +9 9 0 123456 +17 7 1 123456 +18 8 1 123456 +19 9 1 123456 +27 7 2 123456 +28 8 2 123456 +29 9 2 123456 +drop table t1,t3; diff --git a/mysql-test/main/partition_mrr_aria.test b/mysql-test/main/partition_mrr_aria.test new file mode 100644 index 00000000000..e3dfe8cd9b5 --- /dev/null +++ b/mysql-test/main/partition_mrr_aria.test @@ -0,0 +1,2 @@ +let $engine_type= Aria; +--source include/partition_mrr.inc diff --git a/mysql-test/main/partition_mrr_innodb.result b/mysql-test/main/partition_mrr_innodb.result new file mode 100644 index 00000000000..c188f7e9929 --- /dev/null +++ b/mysql-test/main/partition_mrr_innodb.result @@ -0,0 +1,79 @@ +drop table if exists t1,t3; +# +# MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +set @tmp=@@storage_engine; +set storage_engine=InnoDB; +create table t3 ( +ID bigint(20) NOT NULL AUTO_INCREMENT, +part_id int, +key_col int, +col2 int, +key(key_col), +PRIMARY KEY (ID,part_id) +) PARTITION BY RANGE (part_id) +(PARTITION p1 VALUES LESS THAN (3), +PARTITION p2 VALUES LESS THAN (7), +PARTITION p3 VALUES LESS THAN (10) +); +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `ID` bigint(20) NOT NULL AUTO_INCREMENT, + `part_id` int(11) NOT NULL, + `key_col` int(11) DEFAULT NULL, + `col2` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`,`part_id`), + KEY `key_col` (`key_col`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 + PARTITION BY RANGE (`part_id`) +(PARTITION `p1` VALUES LESS THAN (3) ENGINE = InnoDB, + PARTITION `p2` VALUES LESS THAN (7) ENGINE = InnoDB, + PARTITION `p3` VALUES LESS THAN (10) ENGINE = InnoDB) +set storage_engine= @tmp; +insert into t3 select +A.a+10*B.a, +A.a, +B.a, +123456 +from t1 A, t1 B; +set optimizer_switch='mrr=on'; +explain +select * from t3 force index (key_col) where key_col < 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan +select * from t3 force index (key_col) where key_col < 3; +ID part_id key_col col2 +1 0 0 123456 +1 1 0 123456 +2 2 0 123456 +10 0 1 123456 +11 1 1 123456 +12 2 1 123456 +20 0 2 123456 +21 1 2 123456 +22 2 2 123456 +3 3 0 123456 +4 4 0 123456 +5 5 0 123456 +6 6 0 123456 +13 3 1 123456 +14 4 1 123456 +15 5 1 123456 +16 6 1 123456 +23 3 2 123456 +24 4 2 123456 +25 5 2 123456 +26 6 2 123456 +7 7 0 123456 +8 8 0 123456 +9 9 0 123456 +17 7 1 123456 +18 8 1 123456 +19 9 1 123456 +27 7 2 123456 +28 8 2 123456 +29 9 2 123456 +drop table t1,t3; diff --git a/mysql-test/main/partition_mrr_innodb.test b/mysql-test/main/partition_mrr_innodb.test new file mode 100644 index 00000000000..1eccf070e5c --- /dev/null +++ b/mysql-test/main/partition_mrr_innodb.test @@ -0,0 +1,4 @@ +--source include/have_innodb.inc +let $engine_type= InnoDB; + +--source include/partition_mrr.inc diff --git a/mysql-test/main/partition_mrr_myisam.result b/mysql-test/main/partition_mrr_myisam.result new file mode 100644 index 00000000000..1f1cea8e9d6 --- /dev/null +++ b/mysql-test/main/partition_mrr_myisam.result @@ -0,0 +1,79 @@ +drop table if exists t1,t3; +# +# MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +set @tmp=@@storage_engine; +set storage_engine=myisam; +create table t3 ( +ID bigint(20) NOT NULL AUTO_INCREMENT, +part_id int, +key_col int, +col2 int, +key(key_col), +PRIMARY KEY (ID,part_id) +) PARTITION BY RANGE (part_id) +(PARTITION p1 VALUES LESS THAN (3), +PARTITION p2 VALUES LESS THAN (7), +PARTITION p3 VALUES LESS THAN (10) +); +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `ID` bigint(20) NOT NULL AUTO_INCREMENT, + `part_id` int(11) NOT NULL, + `key_col` int(11) DEFAULT NULL, + `col2` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`,`part_id`), + KEY `key_col` (`key_col`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + PARTITION BY RANGE (`part_id`) +(PARTITION `p1` VALUES LESS THAN (3) ENGINE = MyISAM, + PARTITION `p2` VALUES LESS THAN (7) ENGINE = MyISAM, + PARTITION `p3` VALUES LESS THAN (10) ENGINE = MyISAM) +set storage_engine= @tmp; +insert into t3 select +A.a+10*B.a, +A.a, +B.a, +123456 +from t1 A, t1 B; +set optimizer_switch='mrr=on'; +explain +select * from t3 force index (key_col) where key_col < 3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan +select * from t3 force index (key_col) where key_col < 3; +ID part_id key_col col2 +1 0 0 123456 +1 1 0 123456 +2 2 0 123456 +10 0 1 123456 +11 1 1 123456 +12 2 1 123456 +20 0 2 123456 +21 1 2 123456 +22 2 2 123456 +3 3 0 123456 +4 4 0 123456 +5 5 0 123456 +6 6 0 123456 +13 3 1 123456 +14 4 1 123456 +15 5 1 123456 +16 6 1 123456 +23 3 2 123456 +24 4 2 123456 +25 5 2 123456 +26 6 2 123456 +7 7 0 123456 +8 8 0 123456 +9 9 0 123456 +17 7 1 123456 +18 8 1 123456 +19 9 1 123456 +27 7 2 123456 +28 8 2 123456 +29 9 2 123456 +drop table t1,t3; diff --git a/mysql-test/main/partition_mrr_myisam.test b/mysql-test/main/partition_mrr_myisam.test new file mode 100644 index 00000000000..d67a37ab3d2 --- /dev/null +++ b/mysql-test/main/partition_mrr_myisam.test @@ -0,0 +1,3 @@ +let $engine_type= myisam; + +--source include/partition_mrr.inc diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index ccda01de6b7..09664deb458 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -5478,6 +5478,13 @@ int ha_partition::index_end() if ((tmp= (*file)->ha_index_end())) error= tmp; } + else if ((*file)->inited == RND) + { + // Possible due to MRR + int tmp; + if ((tmp= (*file)->ha_rnd_end())) + error= tmp; + } } while (*(++file)); destroy_record_priority_queue(); DBUG_RETURN(error); @@ -6519,8 +6526,11 @@ int ha_partition::multi_range_read_next(range_id_t *range_info) else if (unlikely((error= handle_unordered_next(table->record[0], FALSE)))) DBUG_RETURN(error); - *range_info= - ((PARTITION_KEY_MULTI_RANGE *) m_range_info[m_last_part])->ptr; + if (!(m_mrr_mode & HA_MRR_NO_ASSOCIATION)) + { + *range_info= + ((PARTITION_KEY_MULTI_RANGE *) m_range_info[m_last_part])->ptr; + } } DBUG_RETURN(0); } diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index f40c8d0fbd8..6d62ea07dfa 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -1589,11 +1589,10 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, } uint add_len= share->key_info[keyno].key_length + primary_file->ref_length; - *bufsz -= add_len; - if (get_disk_sweep_mrr_cost(keyno, rows, *flags, bufsz, &dsmrr_cost)) + if (get_disk_sweep_mrr_cost(keyno, rows, *flags, bufsz, add_len, + &dsmrr_cost)) return TRUE; - *bufsz += add_len; - + bool force_dsmrr; /* If mrr_cost_based flag is not set, then set cost of DS-MRR to be minimum of @@ -1682,6 +1681,11 @@ static void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, Cost_estimate * @param rows E(Number of rows to be scanned) @param flags Scan parameters (HA_MRR_* flags) @param buffer_size INOUT Buffer size + IN: Buffer of size 0 means the function + will determine the best size and return it. + @param extra_mem_overhead Extra memory overhead of the MRR implementation + (the function assumes this many bytes of buffer + space will not be usable by DS-MRR) @param cost OUT The cost @retval FALSE OK @@ -1690,7 +1694,9 @@ static void get_sort_and_sweep_cost(TABLE *table, ha_rows nrows, Cost_estimate * */ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, - uint *buffer_size, Cost_estimate *cost) + uint *buffer_size, + uint extra_mem_overhead, + Cost_estimate *cost) { ulong max_buff_entries, elem_size; ha_rows rows_in_full_step; @@ -1700,11 +1706,24 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, elem_size= primary_file->ref_length + sizeof(void*) * (!MY_TEST(flags & HA_MRR_NO_ASSOCIATION)); - max_buff_entries = *buffer_size / elem_size; - if (!max_buff_entries) + if (!*buffer_size) + { + /* + We are requested to determine how much memory we need. + Request memory to finish the scan in one pass but do not request + more than @@mrr_buff_size. + */ + *buffer_size = MY_MIN(extra_mem_overhead + rows*elem_size, + MY_MAX(table->in_use->variables.mrr_buff_size, + extra_mem_overhead)); + } + + if (elem_size + extra_mem_overhead > *buffer_size) return TRUE; /* Buffer has not enough space for even 1 rowid */ + max_buff_entries = (*buffer_size - extra_mem_overhead) / elem_size; + /* Number of iterations we'll make with full buffer */ n_full_steps= (uint)floor(rows2double(rows) / max_buff_entries); diff --git a/sql/multi_range_read.h b/sql/multi_range_read.h index 85578aa312c..0473fef04ae 100644 --- a/sql/multi_range_read.h +++ b/sql/multi_range_read.h @@ -631,8 +631,9 @@ private: bool choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, uint *bufsz, Cost_estimate *cost); - bool get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, - uint *buffer_size, Cost_estimate *cost); + bool get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, + uint *buffer_size, uint extra_mem_overhead, + Cost_estimate *cost); bool check_cpk_scan(THD *thd, TABLE_SHARE *share, uint keyno, uint mrr_flags); bool setup_buffer_sharing(uint key_size_in_keybuf, key_part_map key_tuple_map); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 29f29544f29..eecc72ad1f6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6466,7 +6466,7 @@ ha_innobase::clone( DBUG_ENTER("ha_innobase::clone"); ha_innobase* new_handler = static_cast( - handler::clone(name, mem_root)); + handler::clone(m_prebuilt->table->name.m_name, mem_root)); if (new_handler != NULL) { DBUG_ASSERT(new_handler->m_prebuilt != NULL); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 57537a69082..71456666fbe 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1000,10 +1000,12 @@ can_enable_indexes(1), bulk_insert_single_undo(BULK_INSERT_NONE) {} -handler *ha_maria::clone(const char *name, MEM_ROOT *mem_root) +handler *ha_maria::clone(const char *name __attribute__((unused)), + MEM_ROOT *mem_root) { - ha_maria *new_handler= static_cast (handler::clone(name, - mem_root)); + ha_maria *new_handler= + static_cast (handler::clone(file->s->open_file_name.str, + mem_root)); if (new_handler) { new_handler->file->state= file->state; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 40c8ea61ddc..9b4dff68683 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -702,10 +702,11 @@ ha_myisam::ha_myisam(handlerton *hton, TABLE_SHARE *table_arg) can_enable_indexes(1) {} -handler *ha_myisam::clone(const char *name, MEM_ROOT *mem_root) +handler *ha_myisam::clone(const char *name __attribute__((unused)), + MEM_ROOT *mem_root) { - ha_myisam *new_handler= static_cast (handler::clone(name, - mem_root)); + ha_myisam *new_handler= + static_cast (handler::clone(file->filename, mem_root)); if (new_handler) new_handler->file->state= file->state; return new_handler; From 409ed60bb844252d46127c5df37d23fecf52159f Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sat, 16 Nov 2019 13:18:24 +0300 Subject: [PATCH 3/5] Fix compile failure on Windows: use explicit type casts --- sql/multi_range_read.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 6d62ea07dfa..5e0afd6edb2 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -1714,9 +1714,9 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, Request memory to finish the scan in one pass but do not request more than @@mrr_buff_size. */ - *buffer_size = MY_MIN(extra_mem_overhead + rows*elem_size, - MY_MAX(table->in_use->variables.mrr_buff_size, - extra_mem_overhead)); + *buffer_size= (uint) MY_MIN(extra_mem_overhead + elem_size*(ulong)rows, + MY_MAX(table->in_use->variables.mrr_buff_size, + extra_mem_overhead)); } if (elem_size + extra_mem_overhead > *buffer_size) From b80df9eba23b4eb9694e770a41135127c6dbc5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sun, 17 Nov 2019 21:57:16 +0200 Subject: [PATCH 4/5] MDEV-21069 Crash on DROP TABLE if the data file is corrupted buf_read_ibuf_merge_pages(): Discard any page numbers that are outside the current bounds of the tablespace, by invoking the function ibuf_delete_recs() that was introduced in MDEV-20934. This could avoid an infinite change buffer merge loop on innodb_fast_shutdown=0, because normally the change buffer merge would only be attempted if a page was successfully loaded into the buffer pool. dict_drop_index_tree(): Add the parameter trx_t*. To prevent the DROP TABLE crash, do not invoke btr_free_if_exists() if the entire .ibd file will be dropped. Thus, we will avoid a crash if the BTR_SEG_LEAF or BTR_SEG_TOP of the index is corrupted, and we will also avoid unnecessarily accessing the to-be-dropped tablespace via the buffer pool. In MariaDB 10.2, we disable the DROP TABLE fix if innodb_safe_truncate=0, because the backup-unsafe MySQL 5.7 WL#6501 form of TRUNCATE TABLE requires that the individual pages be freed inside the tablespace. --- mysql-test/suite/innodb/t/ibuf_not_empty.test | 26 ++++++++++++++- storage/innobase/buf/buf0rea.cc | 33 ++++++++++++++----- storage/innobase/dict/dict0crea.cc | 24 ++++++++------ storage/innobase/ibuf/ibuf0ibuf.cc | 2 +- storage/innobase/include/dict0crea.h | 10 +++--- storage/innobase/include/ibuf0ibuf.h | 8 +++++ storage/innobase/row/row0trunc.cc | 20 +++++------ storage/innobase/row/row0uins.cc | 3 +- storage/innobase/row/row0upd.cc | 8 ++--- 9 files changed, 90 insertions(+), 44 deletions(-) diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test index 8b16d197e03..a5093892b35 100644 --- a/mysql-test/suite/innodb/t/ibuf_not_empty.test +++ b/mysql-test/suite/innodb/t/ibuf_not_empty.test @@ -73,8 +73,32 @@ EOF --replace_regex /contains \d+ entries/contains #### entries/ check table t1; +--source include/shutdown_mysqld.inc + +# Truncate the file to 5 pages, as if it were empty +perl; +do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; +my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open(FILE, "+<$file") || die "Unable to open $file"; +binmode FILE; +my $ps= $ENV{PAGE_SIZE}; +my $pages=5; +my $page; +die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; +substr($page,46,4)=pack("N", $pages); +my $polynomial = 0x82f63b78; # CRC-32C +my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^ + mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial)); +substr($page,0,4)=$ck; +substr($page,$ps-8,4)=$ck; +sysseek(FILE, 0, 0) || die "Unable to rewind $file\n"; +syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; +truncate(FILE, $ps * $pages); +close(FILE) || die "Unable to close $file"; +EOF + --let $restart_parameters= ---source include/restart_mysqld.inc +--source include/start_mysqld.inc SET GLOBAL innodb_fast_shutdown=0; --source include/restart_mysqld.inc diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 188d0aa24b6..e25c0e853e4 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -819,11 +819,8 @@ buf_read_ibuf_merge_pages( #endif for (ulint i = 0; i < n_stored; i++) { - bool found; - const page_size_t page_size(fil_space_get_page_size( - space_ids[i], &found)); - - if (!found) { + fil_space_t* space = fil_space_acquire_silent(space_ids[i]); + if (!space) { tablespace_deleted: /* The tablespace was not found: remove all entries for it */ @@ -835,6 +832,19 @@ tablespace_deleted: continue; } + if (UNIV_UNLIKELY(page_nos[i] >= space->size)) { + do { + ibuf_delete_recs(page_id_t(space_ids[i], + page_nos[i])); + } while (++i < n_stored + && space_ids[i - 1] == space_ids[i] + && page_nos[i] >= space->size); + i--; +next: + fil_space_release(space); + continue; + } + const page_id_t page_id(space_ids[i], page_nos[i]); buf_pool_t* buf_pool = buf_pool_get(page_id); @@ -849,8 +859,8 @@ tablespace_deleted: buf_read_page_low(&err, sync && (i + 1 == n_stored), 0, - BUF_READ_ANY_PAGE, page_id, page_size, - true, true /* ignore_missing_space */); + BUF_READ_ANY_PAGE, page_id, + page_size_t(space->flags), true); switch(err) { case DB_SUCCESS: @@ -858,15 +868,20 @@ tablespace_deleted: case DB_ERROR: break; case DB_TABLESPACE_DELETED: + fil_space_release(space); goto tablespace_deleted; case DB_PAGE_CORRUPTED: case DB_DECRYPTION_FAILED: - ib::error() << "Failed to read or decrypt " << page_id - << " for change buffer merge"; + ib::error() << "Failed to read or decrypt page " + << page_nos[i] + << " of '" << space->chain.start->name + << "' for change buffer merge"; break; default: ut_error; } + + goto next; } os_aio_simulated_wake_handler_threads(); diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 0687875211a..4ef87dae22d 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -954,17 +954,13 @@ dict_create_index_tree_in_mem( /** Drop the index tree associated with a row in SYS_INDEXES table. @param[in,out] rec SYS_INDEXES record @param[in,out] pcur persistent cursor on rec +@param[in,out] trx dictionary transaction @param[in,out] mtr mini-transaction @return whether freeing the B-tree was attempted */ -bool -dict_drop_index_tree( - rec_t* rec, - btr_pcur_t* pcur, - mtr_t* mtr) +bool dict_drop_index_tree(rec_t* rec, btr_pcur_t* pcur, trx_t* trx, mtr_t* mtr) { const byte* ptr; ulint len; - ulint space; ulint root_page_no; ut_ad(mutex_own(&dict_sys->mutex)); @@ -991,7 +987,15 @@ dict_drop_index_tree( ut_ad(len == 4); - space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr); + const uint32_t space_id = mach_read_from_4(ptr); + ut_ad(space_id < SRV_TMP_SPACE_ID); + if (space_id != TRX_SYS_SPACE + && srv_safe_truncate + && trx_get_dict_operation(trx) == TRX_DICT_OP_TABLE) { + /* We are about to delete the entire .ibd file; + do not bother to free pages inside it. */ + return false; + } ptr = rec_get_nth_field_old( rec, DICT_FLD__SYS_INDEXES__ID, &len); @@ -999,7 +1003,7 @@ dict_drop_index_tree( ut_ad(len == 8); bool found; - const page_size_t page_size(fil_space_get_page_size(space, + const page_size_t page_size(fil_space_get_page_size(space_id, &found)); if (!found) { @@ -1012,11 +1016,11 @@ dict_drop_index_tree( /* If tablespace is scheduled for truncate, do not try to drop the indexes in that tablespace. There is a truncate fixup action which will take care of it. */ - if (srv_is_tablespace_truncated(space)) { + if (srv_is_tablespace_truncated(space_id)) { return(false); } - btr_free_if_exists(page_id_t(space, root_page_no), page_size, + btr_free_if_exists(page_id_t(space_id, root_page_no), page_size, mach_read_from_8(ptr), mtr); return(true); diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index ce6bfe02351..7bf00eaa7c8 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -4333,7 +4333,7 @@ This prevents an infinite loop on slow shutdown in the case where the change buffer bitmap claims that no buffered changes exist, while entries exist in the change buffer tree. @param page_id page number for which there should be no unbuffered changes */ -ATTRIBUTE_COLD static void ibuf_delete_recs(const page_id_t page_id) +ATTRIBUTE_COLD void ibuf_delete_recs(const page_id_t page_id) { ulint dops[IBUF_OP_COUNT]; mtr_t mtr; diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h index 67afa099ccc..7d87686e010 100644 --- a/storage/innobase/include/dict0crea.h +++ b/storage/innobase/include/dict0crea.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -121,13 +121,11 @@ dict_recreate_index_tree( /** Drop the index tree associated with a row in SYS_INDEXES table. @param[in,out] rec SYS_INDEXES record @param[in,out] pcur persistent cursor on rec +@param[in,out] trx dictionary transaction @param[in,out] mtr mini-transaction @return whether freeing the B-tree was attempted */ -bool -dict_drop_index_tree( - rec_t* rec, - btr_pcur_t* pcur, - mtr_t* mtr); +bool dict_drop_index_tree(rec_t* rec, btr_pcur_t* pcur, trx_t* trx, mtr_t* mtr) + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Creates an index tree for the index if it is not a member of a cluster. diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index 09dc61496f3..a69b63ee16b 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -326,6 +326,14 @@ ibuf_insert( const page_size_t& page_size, que_thr_t* thr); +/** +Delete any buffered entries for a page. +This prevents an infinite loop on slow shutdown +in the case where the change buffer bitmap claims that no buffered +changes exist, while entries exist in the change buffer tree. +@param page_id page number for which there should be no unbuffered changes */ +ATTRIBUTE_COLD void ibuf_delete_recs(const page_id_t page_id); + /** When an index page is read from a disk to the buffer pool, this function applies any buffered operations to the page and deletes the entries from the insert buffer. If the page is not read, but created in the buffer pool, this diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc index 648a83f7dc6..5e512c602e6 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -748,14 +748,10 @@ public: Constructor @param[in,out] table Table to truncate + @param[in,out] trx dictionary transaction @param[in] noredo whether to disable redo logging */ - DropIndex(dict_table_t* table, bool noredo) - : - Callback(table->id, noredo), - m_table(table) - { - /* No op */ - } + DropIndex(dict_table_t* table, trx_t* trx, bool noredo) + : Callback(table->id, noredo), m_trx(trx), m_table(table) {} /** @param mtr mini-transaction covering the read @@ -764,8 +760,10 @@ public: dberr_t operator()(mtr_t* mtr, btr_pcur_t* pcur) const; private: + /** dictionary transaction */ + trx_t* const m_trx; /** Table to be truncated */ - dict_table_t* m_table; + dict_table_t* const m_table; }; /** Callback to create the indexes during TRUNCATE */ @@ -907,7 +905,7 @@ DropIndex::operator()(mtr_t* mtr, btr_pcur_t* pcur) const { rec_t* rec = btr_pcur_get_rec(pcur); - bool freed = dict_drop_index_tree(rec, pcur, mtr); + bool freed = dict_drop_index_tree(rec, pcur, m_trx, mtr); #ifdef UNIV_DEBUG { @@ -1122,7 +1120,7 @@ row_truncate_rollback( it can be recovered using drop/create sequence. */ dict_table_x_lock_indexes(table); - DropIndex dropIndex(table, no_redo); + DropIndex dropIndex(table, trx, no_redo); SysIndexIterator().for_each(dropIndex); @@ -1936,7 +1934,7 @@ dberr_t row_truncate_table_for_mysql(dict_table_t* table, trx_t* trx) indexes) */ if (!dict_table_is_temporary(table)) { - DropIndex dropIndex(table, no_redo); + DropIndex dropIndex(table, trx, no_redo); err = SysIndexIterator().for_each(dropIndex); diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index 62a6f013255..7d0664006bb 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -126,7 +126,8 @@ row_undo_ins_remove_clust_rec( ut_ad(node->trx->dict_operation_lock_mode == RW_X_LATCH); dict_drop_index_tree( - btr_pcur_get_rec(&node->pcur), &(node->pcur), &mtr); + btr_pcur_get_rec(&node->pcur), &node->pcur, node->trx, + &mtr); mtr.commit(); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index db4b7b18269..0153d618ab8 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -3092,9 +3092,7 @@ row_upd_clust_step( ulint mode; - DEBUG_SYNC_C_IF_THD( - thr_get_trx(thr)->mysql_thd, - "innodb_row_upd_clust_step_enter"); + DEBUG_SYNC_C_IF_THD(trx->mysql_thd, "innodb_row_upd_clust_step_enter"); if (dict_index_is_online_ddl(index)) { ut_ad(node->table->id != DICT_INDEXES_ID); @@ -3123,7 +3121,7 @@ row_upd_clust_step( ut_ad(!dict_index_is_online_ddl(index)); dict_drop_index_tree( - btr_pcur_get_rec(pcur), pcur, &mtr); + btr_pcur_get_rec(pcur), pcur, trx, &mtr); mtr.commit(); @@ -3155,7 +3153,7 @@ row_upd_clust_step( } } - ut_ad(lock_trx_has_rec_x_lock(thr_get_trx(thr), index->table, + ut_ad(lock_trx_has_rec_x_lock(trx, index->table, btr_pcur_get_block(pcur), page_rec_get_heap_no(rec))); From 39d8652ca529e712430f57addc098b71521449e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 19 Nov 2019 00:42:10 +0200 Subject: [PATCH 5/5] MDEV-13564 follow-up: Remove unused code DropIndex, CreateIndex: Remove. The file row0trunc.cc only exists in MariaDB Server 10.3 so that the crash recovery of TRUNCATE TABLE operations from older 10.2 and 10.3 servers will work. This dead code was being used for implementing the MySQL 5.7 WL#6501 TRUNCATE TABLE that was replaced with a backup-safe implementation in MDEV-13564. --- storage/innobase/row/row0trunc.cc | 217 ------------------------------ 1 file changed, 217 deletions(-) diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc index d2d2c766666..a696d0c56ef 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -440,68 +440,6 @@ TruncateLogParser::scan_and_parse( return(err); } -/** Callback to drop indexes during TRUNCATE */ -class DropIndex : public Callback { - -public: - /** - Constructor - - @param[in,out] table Table to truncate - @param[in,out] trx dictionary transaction - @param[in] noredo whether to disable redo logging */ - DropIndex(dict_table_t* table, trx_t* trx, bool noredo) - : Callback(table->id, noredo), m_trx(trx), m_table(table) {} - - /** - @param mtr mini-transaction covering the read - @param pcur persistent cursor used for reading - @return DB_SUCCESS or error code */ - dberr_t operator()(mtr_t* mtr, btr_pcur_t* pcur) const; - -private: - /** dictionary transaction */ - trx_t* const m_trx; - /** Table to be truncated */ - dict_table_t* const m_table; -}; - -/** Callback to create the indexes during TRUNCATE */ -class CreateIndex : public Callback { - -public: - /** - Constructor - - @param[in,out] table Table to truncate - @param[in] noredo whether to disable redo logging */ - CreateIndex(dict_table_t* table, bool noredo) - : - Callback(table->id, noredo), - m_table(table) - { - /* No op */ - } - - /** - Create the new index and update the root page number in the - SysIndex table. - - @param mtr mini-transaction covering the read - @param pcur persistent cursor used for reading - @return DB_SUCCESS or error code */ - dberr_t operator()(mtr_t* mtr, btr_pcur_t* pcur) const; - -private: - // Disably copying - CreateIndex(const CreateIndex&); - CreateIndex& operator=(const CreateIndex&); - -private: - /** Table to be truncated */ - dict_table_t* m_table; -}; - /** Check for presence of table-id in SYS_XXXX tables. */ class TableLocator : public Callback { @@ -540,161 +478,6 @@ private: bool m_table_found; }; -/** -Drop an index in the table. - -@param mtr mini-transaction covering the read -@param pcur persistent cursor used for reading -@return DB_SUCCESS or error code */ -dberr_t -DropIndex::operator()(mtr_t* mtr, btr_pcur_t* pcur) const -{ - rec_t* rec = btr_pcur_get_rec(pcur); - - bool freed = dict_drop_index_tree(rec, pcur, m_trx, mtr); - -#ifdef UNIV_DEBUG - { - ulint len; - const byte* field; - ulint index_type; - - field = rec_get_nth_field_old( - btr_pcur_get_rec(pcur), DICT_FLD__SYS_INDEXES__TYPE, - &len); - ut_ad(len == 4); - - index_type = mach_read_from_4(field); - - if (index_type & DICT_CLUSTERED) { - /* Clustered index */ - DBUG_EXECUTE_IF("ib_trunc_crash_on_drop_of_clust_index", - log_buffer_flush_to_disk(); - os_thread_sleep(2000000); - DBUG_SUICIDE();); - } else if (index_type & DICT_UNIQUE) { - /* Unique index */ - DBUG_EXECUTE_IF("ib_trunc_crash_on_drop_of_uniq_index", - log_buffer_flush_to_disk(); - os_thread_sleep(2000000); - DBUG_SUICIDE();); - } else if (index_type == 0) { - /* Secondary index */ - DBUG_EXECUTE_IF("ib_trunc_crash_on_drop_of_sec_index", - log_buffer_flush_to_disk(); - os_thread_sleep(2000000); - DBUG_SUICIDE();); - } - } -#endif /* UNIV_DEBUG */ - - DBUG_EXECUTE_IF("ib_err_trunc_drop_index", return DB_ERROR;); - - if (freed) { - - /* We will need to commit and restart the - mini-transaction in order to avoid deadlocks. - The dict_drop_index_tree() call has freed - a page in this mini-transaction, and the rest - of this loop could latch another index page.*/ - const mtr_log_t log_mode = mtr->get_log_mode(); - mtr_commit(mtr); - - mtr_start(mtr); - mtr->set_log_mode(log_mode); - - btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr); - } else { - if (!m_table->space) { - return DB_ERROR; - } - } - - return(DB_SUCCESS); -} - -/** -Create the new index and update the root page number in the -SysIndex table. - -@param mtr mini-transaction covering the read -@param pcur persistent cursor used for reading -@return DB_SUCCESS or error code */ -dberr_t -CreateIndex::operator()(mtr_t* mtr, btr_pcur_t* pcur) const -{ - ulint root_page_no; - - root_page_no = dict_recreate_index_tree(m_table, pcur, mtr); - -#ifdef UNIV_DEBUG - { - ulint len; - const byte* field; - ulint index_type; - - field = rec_get_nth_field_old( - btr_pcur_get_rec(pcur), DICT_FLD__SYS_INDEXES__TYPE, - &len); - ut_ad(len == 4); - - index_type = mach_read_from_4(field); - - if (index_type & DICT_CLUSTERED) { - /* Clustered index */ - DBUG_EXECUTE_IF( - "ib_trunc_crash_on_create_of_clust_index", - log_buffer_flush_to_disk(); - os_thread_sleep(2000000); - DBUG_SUICIDE();); - } else if (index_type & DICT_UNIQUE) { - /* Unique index */ - DBUG_EXECUTE_IF( - "ib_trunc_crash_on_create_of_uniq_index", - log_buffer_flush_to_disk(); - os_thread_sleep(2000000); - DBUG_SUICIDE();); - } else if (index_type == 0) { - /* Secondary index */ - DBUG_EXECUTE_IF( - "ib_trunc_crash_on_create_of_sec_index", - log_buffer_flush_to_disk(); - os_thread_sleep(2000000); - DBUG_SUICIDE();); - } - } -#endif /* UNIV_DEBUG */ - - DBUG_EXECUTE_IF("ib_err_trunc_create_index", return DB_ERROR;); - - if (root_page_no != FIL_NULL) { - ulint len; - byte* data = rec_get_nth_field_old( - btr_pcur_get_rec(pcur), - DICT_FLD__SYS_INDEXES__PAGE_NO, &len); - ut_ad(len == 4); - mlog_write_ulint(data, root_page_no, MLOG_4BYTES, mtr); - - /* We will need to commit and restart the - mini-transaction in order to avoid deadlocks. - The dict_create_index_tree() call has allocated - a page in this mini-transaction, and the rest of - this loop could latch another index page. */ - mtr_commit(mtr); - - mtr_start(mtr); - - btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr); - - } else { - if (!m_table->space) { - return(DB_ERROR); - } - } - - return(DB_SUCCESS); -} - /** Update system table to reflect new table id. @param old_table_id old table id