AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/server/mysql/mysql-test/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/server/mysql/mysql-test/t/opt_costmodel_warnings.test
#
# Test that provides code coverage for the code that checks and handles
# entries in the cost constant tables that has invalid values.
# This will cause warnings to be written to the MySQL error log.
#
# The reason for having a separte test file for this is that we
# need to suppress warnings from the error log.
#

# Can not run with embedded server since it requires server restarts
-- source include/not_embedded.inc

# Before starting the test check that the cost constant tables exists and
# have the expected content.
#
# Table: server_cost
#
# Mask out the content of the last_update column
--replace_column 3 #
SELECT * FROM mysql.server_cost;

#
# Table: engine_cost
#
# Mask out the content of the last_update column
--replace_column 5 #
SELECT * FROM mysql.engine_cost;

#
# TEST: correct warning when one of the cost constant tables are missing
#
# This will cause a warning in the error log that needs to be ignored
--disable_query_log
call mtr.add_suppression('Failed to open optimizer cost constant tables');
--enable_query_log

# Rename one of the tables
RENAME TABLE mysql.engine_cost TO mysql.engine_cost_renamed;

# Restart the server to check that it handles the missing cost constant
# table
--echo "Restarting MySQL server"

--source include/restart_mysqld.inc

--echo "MySQL restarted"

# Restore the engine_cost table:
RENAME TABLE mysql.engine_cost_renamed TO mysql.engine_cost;

# Verify the content of engine_cost:
#
# Mask out the content of the last_update column
--replace_column 5 #
SELECT * FROM mysql.engine_cost;

#
# TEST: handling of unrecognized or illegal entries in the server_cost table
#
# This will cause the following warnings in the error log that needs to
# be ignored
--disable_query_log
call mtr.add_suppression('Unknown cost constant "lunch_cost" in mysql.server_cost table');
call mtr.add_suppression('Invalid value for cost constant "row_evaluate_cost" in mysql.server_cost table: -1.0');
call mtr.add_suppression('Invalid value for cost constant "key_compare_cost" in mysql.server_cost table: 0.0');
--enable_query_log

# Add an unrecognized cost constant name
INSERT INTO mysql.server_cost
VALUES ("lunch_cost", 1.0, CURRENT_TIMESTAMP, "Lunch is important");

# Change an existing cost constant to have a negative cost
UPDATE mysql.server_cost
SET cost_value=-1.0
WHERE cost_name="row_evaluate_cost";

# Change an existing cost constant to have zero cost
UPDATE mysql.server_cost
SET cost_value=0.0
WHERE cost_name="key_compare_cost";

# Restart the server to check that it handles the errors in the server_cost
# table
--echo "Restarting MySQL server"

--source include/restart_mysqld.inc

--echo "MySQL restarted"

# Clean-up:
DELETE FROM mysql.server_cost
WHERE cost_name LIKE "lunch_cost%";

UPDATE mysql.server_cost
SET cost_value=NULL
WHERE cost_name="row_evaluate_cost";

UPDATE mysql.server_cost
SET cost_value=NULL
WHERE cost_name="key_compare_cost";

#
# TEST: handling of unrecognized or illegal entries in the engine_cost table
#
# This will cause the following warnings in the error log that needs to
# be ignored
--disable_query_log
call mtr.add_suppression('Invalid value for cost constant "io_block_read_cost" for "default" storage engine and device type 0 in mysql.engine_cost table: 0.0');
call mtr.add_suppression('Unknown storage engine "Falcon" in mysql.engine_cost table');
call mtr.add_suppression('Invalid device type -1 for "InnoDB" storage engine for cost constant "io_block_read_cost" in mysql.engine_cost table');
call mtr.add_suppression('Unknown cost constant "lunch_cost" in mysql.engine_cost table');
--enable_query_log

# Add an unrecognized cost constant name
INSERT INTO mysql.engine_cost
VALUES ("InnoDB", 0, "lunch_cost", 1.0, CURRENT_TIMESTAMP, "Lunch is important");

# Change an existing cost constant to have zero cost
UPDATE mysql.engine_cost
SET cost_value=0.0
WHERE cost_name="io_block_read_cost";

# Add a cost constant for an unknown storage engine
INSERT INTO mysql.engine_cost
VALUES ("Falcon", 0, "io_block_read_cost", 1.0, CURRENT_TIMESTAMP, "Unknown storage engine");

# Add a cost constant where the device type is illegal
INSERT INTO mysql.engine_cost
VALUES ("InnoDB", -1, "io_block_read_cost", 1.0, CURRENT_TIMESTAMP, "1 is an illegal device type");


# Restart the server to check that it handles the errors in the server_cost
# table
--echo "Restarting MySQL server"

--source include/restart_mysqld.inc

--echo "MySQL restarted"

# Clean-up:
DELETE FROM mysql.engine_cost
WHERE cost_name LIKE "lunch_cost%";

UPDATE mysql.engine_cost
SET cost_value=NULL;

DELETE FROM mysql.engine_cost
WHERE device_type = -1;

DELETE FROM mysql.engine_cost
WHERE engine_name LIKE "Falcon";

# Before ending the test check that the cost constant tables still exists and
# have the expected content.
#
# Table: server_cost
#
# Mask out the content of the last_update column
--replace_column 3 #
SELECT * FROM mysql.server_cost;

#
# Table: engine_cost
#
# Mask out the content of the last_update column
--replace_column 5 #
SELECT * FROM mysql.engine_cost;

Anon7 - 2022
AnonSec Team