mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-26710: Histogram field in mysql.column_stats is too short
Change it to LONGBLOB. Also, update_statistics_for_table() should not "swallow" an error from open_stat_tables.
This commit is contained in:
@ -67,7 +67,7 @@ column_stats CREATE TABLE `column_stats` (
|
|||||||
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
||||||
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
||||||
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
||||||
`histogram` blob DEFAULT NULL,
|
`histogram` longblob DEFAULT NULL,
|
||||||
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
||||||
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
||||||
select
|
select
|
||||||
|
@ -235,7 +235,7 @@ column_stats CREATE TABLE `column_stats` (
|
|||||||
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
||||||
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
||||||
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
||||||
`histogram` blob DEFAULT NULL,
|
`histogram` longblob DEFAULT NULL,
|
||||||
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
||||||
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
||||||
show create table index_stats;
|
show create table index_stats;
|
||||||
|
@ -273,7 +273,7 @@ column_stats CREATE TABLE `column_stats` (
|
|||||||
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
||||||
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
||||||
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
||||||
`histogram` blob DEFAULT NULL,
|
`histogram` longblob DEFAULT NULL,
|
||||||
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
||||||
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
||||||
show create table index_stats;
|
show create table index_stats;
|
||||||
|
@ -277,7 +277,7 @@ column_stats CREATE TABLE `column_stats` (
|
|||||||
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
||||||
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
||||||
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
||||||
`histogram` blob DEFAULT NULL,
|
`histogram` longblob DEFAULT NULL,
|
||||||
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
||||||
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
||||||
show create table index_stats;
|
show create table index_stats;
|
||||||
|
@ -257,7 +257,7 @@ column_stats CREATE TABLE `column_stats` (
|
|||||||
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
`avg_frequency` decimal(12,4) DEFAULT NULL,
|
||||||
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
`hist_size` tinyint(3) unsigned DEFAULT NULL,
|
||||||
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
`hist_type` enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') COLLATE utf8mb3_bin DEFAULT NULL,
|
||||||
`histogram` blob DEFAULT NULL,
|
`histogram` longblob DEFAULT NULL,
|
||||||
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
PRIMARY KEY (`db_name`,`table_name`,`column_name`)
|
||||||
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
) ENGINE=Aria DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin PAGE_CHECKSUM=1 TRANSACTIONAL=0 COMMENT='Statistics on Columns'
|
||||||
show create table index_stats;
|
show create table index_stats;
|
||||||
|
@ -13,7 +13,7 @@ def mysql column_stats avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL
|
|||||||
def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references NEVER NULL
|
def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references NEVER NULL
|
||||||
def mysql column_stats column_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI select,insert,update,references NEVER NULL
|
def mysql column_stats column_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI select,insert,update,references NEVER NULL
|
||||||
def mysql column_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI select,insert,update,references NEVER NULL
|
def mysql column_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI select,insert,update,references NEVER NULL
|
||||||
def mysql column_stats histogram 11 NULL YES blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL
|
def mysql column_stats histogram 11 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob select,insert,update,references NEVER NULL
|
||||||
def mysql column_stats hist_size 9 NULL YES tinyint NULL NULL 3 0 NULL NULL NULL tinyint(3) unsigned select,insert,update,references NEVER NULL
|
def mysql column_stats hist_size 9 NULL YES tinyint NULL NULL 3 0 NULL NULL NULL tinyint(3) unsigned select,insert,update,references NEVER NULL
|
||||||
def mysql column_stats hist_type 10 NULL YES enum 14 42 NULL NULL NULL utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') select,insert,update,references NEVER NULL
|
def mysql column_stats hist_type 10 NULL YES enum 14 42 NULL NULL NULL utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') select,insert,update,references NEVER NULL
|
||||||
def mysql column_stats max_value 5 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) select,insert,update,references NEVER NULL
|
def mysql column_stats max_value 5 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) select,insert,update,references NEVER NULL
|
||||||
@ -346,7 +346,7 @@ NULL mysql column_stats avg_length decimal NULL NULL NULL NULL decimal(12,4)
|
|||||||
NULL mysql column_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
|
NULL mysql column_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
|
||||||
NULL mysql column_stats hist_size tinyint NULL NULL NULL NULL tinyint(3) unsigned
|
NULL mysql column_stats hist_size tinyint NULL NULL NULL NULL tinyint(3) unsigned
|
||||||
3.0000 mysql column_stats hist_type enum 14 42 utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB')
|
3.0000 mysql column_stats hist_type enum 14 42 utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB')
|
||||||
1.0000 mysql column_stats histogram blob 65535 65535 NULL NULL blob
|
1.0000 mysql column_stats histogram longblob 4294967295 4294967295 NULL NULL longblob
|
||||||
3.0000 mysql db Host char 255 765 utf8mb3 utf8mb3_bin char(255)
|
3.0000 mysql db Host char 255 765 utf8mb3 utf8mb3_bin char(255)
|
||||||
3.0000 mysql db Db char 64 192 utf8mb3 utf8mb3_bin char(64)
|
3.0000 mysql db Db char 64 192 utf8mb3 utf8mb3_bin char(64)
|
||||||
3.0000 mysql db User char 128 384 utf8mb3 utf8mb3_bin char(128)
|
3.0000 mysql db User char 128 384 utf8mb3 utf8mb3_bin char(128)
|
||||||
|
@ -13,7 +13,7 @@ def mysql column_stats avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL
|
|||||||
def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) NEVER NULL
|
def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) NEVER NULL
|
||||||
def mysql column_stats column_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI NEVER NULL
|
def mysql column_stats column_name 3 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI NEVER NULL
|
||||||
def mysql column_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI NEVER NULL
|
def mysql column_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) PRI NEVER NULL
|
||||||
def mysql column_stats histogram 11 NULL YES blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL
|
def mysql column_stats histogram 11 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL NULL longblob NEVER NULL
|
||||||
def mysql column_stats hist_size 9 NULL YES tinyint NULL NULL 3 0 NULL NULL NULL tinyint(3) unsigned NEVER NULL
|
def mysql column_stats hist_size 9 NULL YES tinyint NULL NULL 3 0 NULL NULL NULL tinyint(3) unsigned NEVER NULL
|
||||||
def mysql column_stats hist_type 10 NULL YES enum 14 42 NULL NULL NULL utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') NEVER NULL
|
def mysql column_stats hist_type 10 NULL YES enum 14 42 NULL NULL NULL utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB') NEVER NULL
|
||||||
def mysql column_stats max_value 5 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) NEVER NULL
|
def mysql column_stats max_value 5 NULL YES varbinary 255 255 NULL NULL NULL NULL NULL varbinary(255) NEVER NULL
|
||||||
@ -343,7 +343,7 @@ NULL mysql column_stats avg_length decimal NULL NULL NULL NULL decimal(12,4)
|
|||||||
NULL mysql column_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
|
NULL mysql column_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4)
|
||||||
NULL mysql column_stats hist_size tinyint NULL NULL NULL NULL tinyint(3) unsigned
|
NULL mysql column_stats hist_size tinyint NULL NULL NULL NULL tinyint(3) unsigned
|
||||||
3.0000 mysql column_stats hist_type enum 14 42 utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB')
|
3.0000 mysql column_stats hist_type enum 14 42 utf8mb3 utf8mb3_bin enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB')
|
||||||
1.0000 mysql column_stats histogram blob 65535 65535 NULL NULL blob
|
1.0000 mysql column_stats histogram longblob 4294967295 4294967295 NULL NULL longblob
|
||||||
3.0000 mysql db Host char 255 765 utf8mb3 utf8mb3_bin char(255)
|
3.0000 mysql db Host char 255 765 utf8mb3 utf8mb3_bin char(255)
|
||||||
3.0000 mysql db Db char 64 192 utf8mb3 utf8mb3_bin char(64)
|
3.0000 mysql db Db char 64 192 utf8mb3 utf8mb3_bin char(64)
|
||||||
3.0000 mysql db User char 128 384 utf8mb3 utf8mb3_bin char(128)
|
3.0000 mysql db User char 128 384 utf8mb3 utf8mb3_bin char(128)
|
||||||
|
@ -314,7 +314,7 @@ DROP TABLE tmp_proxies_priv;
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS table_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) engine=Aria transactional=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';
|
CREATE TABLE IF NOT EXISTS table_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, cardinality bigint(21) unsigned DEFAULT NULL, PRIMARY KEY (db_name,table_name) ) engine=Aria transactional=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Tables';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS column_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varbinary(255) DEFAULT NULL, max_value varbinary(255) DEFAULT NULL, nulls_ratio decimal(12,4) DEFAULT NULL, avg_length decimal(12,4) DEFAULT NULL, avg_frequency decimal(12,4) DEFAULT NULL, hist_size tinyint unsigned, hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), histogram blob, PRIMARY KEY (db_name,table_name,column_name) ) engine=Aria transactional=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
|
CREATE TABLE IF NOT EXISTS column_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, column_name varchar(64) NOT NULL, min_value varbinary(255) DEFAULT NULL, max_value varbinary(255) DEFAULT NULL, nulls_ratio decimal(12,4) DEFAULT NULL, avg_length decimal(12,4) DEFAULT NULL, avg_frequency decimal(12,4) DEFAULT NULL, hist_size tinyint unsigned, hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), histogram longblob, PRIMARY KEY (db_name,table_name,column_name) ) engine=Aria transactional=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency decimal(12,4) DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) engine=Aria transactional=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';
|
CREATE TABLE IF NOT EXISTS index_stats (db_name varchar(64) NOT NULL, table_name varchar(64) NOT NULL, index_name varchar(64) NOT NULL, prefix_arity int(11) unsigned NOT NULL, avg_frequency decimal(12,4) DEFAULT NULL, PRIMARY KEY (db_name,table_name,index_name,prefix_arity) ) engine=Aria transactional=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Indexes';
|
||||||
|
|
||||||
|
@ -842,4 +842,4 @@ DELIMITER ;
|
|||||||
|
|
||||||
ALTER TABLE column_stats
|
ALTER TABLE column_stats
|
||||||
modify hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'),
|
modify hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'),
|
||||||
modify histogram blob;
|
modify histogram longblob;
|
||||||
|
@ -190,7 +190,7 @@ TABLE_FIELD_TYPE column_stat_fields[COLUMN_STAT_N_FIELDS] =
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
{ STRING_WITH_LEN("histogram") },
|
{ STRING_WITH_LEN("histogram") },
|
||||||
{ STRING_WITH_LEN("blob") },
|
{ STRING_WITH_LEN("longblob") },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2880,7 +2880,7 @@ int update_statistics_for_table(THD *thd, TABLE *table)
|
|||||||
|
|
||||||
start_new_trans new_trans(thd);
|
start_new_trans new_trans(thd);
|
||||||
|
|
||||||
if (open_stat_tables(thd, tables, TRUE))
|
if ((open_stat_tables(thd, tables, TRUE)))
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
|
|
||||||
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
|
save_binlog_format= thd->set_current_stmt_binlog_format_stmt();
|
||||||
|
Reference in New Issue
Block a user