403Webshell
Server IP : 88.99.149.37  /  Your IP : 216.73.216.141
Web Server : nginx/1.31.2
System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64
User : muralimurth ( 1015)
PHP Version : 8.4.23
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/mysql/mysql-test/main/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/mysql/mysql-test/main/statistics_upgrade.test
-- source include/mysql_upgrade_preparation.inc
--source include/have_sequence.inc

call mtr.add_suppression("Incorrect definition of table mysql.column_stats:.*");

set histogram_type=single_prec_hb;
create table t1 (a int);
insert into t1 select seq from seq_1_to_100;
analyze table t1 persistent for all;

set histogram_type=double_prec_hb, histogram_size=20;
create table t2 (a int);
insert into t2 select seq from seq_1_to_100;
analyze table t2 persistent for all;

# Create a table with old definition
CREATE TABLE IF NOT EXISTS t3 (
  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'), 
  histogram varbinary(255), 
  PRIMARY KEY (db_name,table_name,column_name)
) engine=Aria transactional=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Statistics on Columns';

# Copy the data there
insert into t3 select * from mysql.column_stats;

create table t4 like t3;
insert into t4 select * from t3;

# Put the old table in place of mysql.column_stats

drop table mysql.column_stats;
alter table t3 rename mysql.column_stats;
--echo # Run mysql_upgrade

--exec $MYSQL_UPGRADE --upgrade-system-tables  --force --silent 2>&1 

let $MYSQLD_DATADIR= `select @@datadir`;
--file_exists $MYSQLD_DATADIR/mysql_upgrade_info
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info

--echo #
--echo # Table definition after upgrade:
--echo #
show create table mysql.column_stats;

select 
  A.db_name, 
  A.table_name, 
  A.hist_type = B.hist_type as hist_type_equal,
  A.histogram = B.histogram as histogram_equal
from
  t4 A 
  left join 
  mysql.column_stats B on A.db_name=B.db_name and
                          A.table_name=B.table_name and
                          A.column_name=B.column_name;

drop table t1,t2,t4;

--echo #
--echo # MDEV-28866 mariadb-upgrade to 10.8 mysql.column_stats hist_type + histogram errors
--echo #
# There should only be two count here corresponding the test creation of mysql.column_stats, and
# none generated by the $MYSQL_UPGRADE run.
--let $error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let SEARCH_FILE= $error_log
--let SEARCH_PATTERN= Incorrect definition of table mysql.column_stats:
--source include/search_pattern_in_file.inc

Youez - 2016 - github.com/yon3zu
LinuXploit