| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test will pass a new parameter to the already exisiting command |
| 4 |
# RESET MASTER, and will test the expected output and the corner cases. |
| 5 |
# |
| 6 |
# ==== References ==== |
| 7 |
# |
| 8 |
# WL9110: Add RESET MASTER TO x to allow specification of binlog file number |
| 9 |
# Bug#28980788: RESET MASTER TO ALLOWS INVALID INPUT WITHOUT ERROR'S, |
| 10 |
# CAN LEAD TO SERVER HALTS |
| 11 |
|
| 12 |
# This test case is binary log format agnostic |
| 13 |
--source include/have_binlog_format_mixed.inc |
| 14 |
--source include/force_restart.inc |
| 15 |
|
| 16 |
# This is to suppress the warnings generated after extension boundary value is reached. |
| 17 |
call mtr.add_suppression("Next log extension.* Remaining log filename extensions."); |
| 18 |
|
| 19 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 20 |
|
| 21 |
# Checking the old command this deletes all the old binary log |
| 22 |
# file and create a new one with index 1, this is implemented in the inc file below |
| 23 |
|
| 24 |
RESET MASTER; |
| 25 |
--let $binlog_number= 000001 |
| 26 |
--source suite/binlog/include/binlog_reset_master_to_option.inc |
| 27 |
|
| 28 |
# Extension to the existing command, this will delete the old |
| 29 |
# binary log and create a new one with index 1234, |
| 30 |
# this is implemented in the inc file below |
| 31 |
RESET MASTER TO 1234; |
| 32 |
|
| 33 |
# Check that old binary log is deleted |
| 34 |
--error 1 |
| 35 |
file_exists $MYSQLD_DATADIR/binlog.000001; |
| 36 |
|
| 37 |
--let $binlog_number= 001234 |
| 38 |
--source suite/binlog/include/binlog_reset_master_to_option.inc |
| 39 |
|
| 40 |
# Testing the boundary cases: |
| 41 |
# |
| 42 |
# 1) Test with non-integer values |
| 43 |
--error ER_PARSE_ERROR |
| 44 |
RESET MASTER TO 1.023; |
| 45 |
|
| 46 |
# 2) Test with negative numbers |
| 47 |
--error ER_PARSE_ERROR |
| 48 |
RESET MASTER TO -123; |
| 49 |
|
| 50 |
# 3) Test with 2 billion, as that is the limit for binary log file index |
| 51 |
# Check with numbers around the upper limit to show it passes. |
| 52 |
RESET MASTER TO 2000000000; |
| 53 |
--let $binlog_number= 2000000000 |
| 54 |
--source suite/binlog/include/binlog_reset_master_to_option.inc |
| 55 |
|
| 56 |
# Checking with 2000000001 |
| 57 |
--error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE |
| 58 |
RESET MASTER TO 2000000001; |
| 59 |
|
| 60 |
# Checking with a value > 32 bit |
| 61 |
--error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE |
| 62 |
RESET MASTER TO 5000000000; |
| 63 |
|
| 64 |
# Checking with a value > 64 bit |
| 65 |
--error ER_PARSE_ERROR |
| 66 |
RESET MASTER TO 20000000000000000000; |
| 67 |
|
| 68 |
# 4) Test with 0 |
| 69 |
--error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE |
| 70 |
RESET MASTER TO 0; |
| 71 |
|
| 72 |
# 5) Test with Character |
| 73 |
--error ER_PARSE_ERROR |
| 74 |
RESET MASTER TO q; |
| 75 |
--error ER_PARSE_ERROR |
| 76 |
RESET MASTER TO "qwe"; |
| 77 |
|
| 78 |
# 6) Test with special character |
| 79 |
--error ER_PARSE_ERROR |
| 80 |
RESET MASTER TO @; |
| 81 |
|
| 82 |
# 7) Test with a different user |
| 83 |
CREATE USER user1@localhost IDENTIFIED BY 'pass1'; |
| 84 |
connect (conn_user1,localhost,user1,pass1,); |
| 85 |
--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
| 86 |
RESET MASTER TO 100; |
| 87 |
|
| 88 |
# Grant priviliges to user1 |
| 89 |
--connection default |
| 90 |
GRANT RELOAD ON *.* TO 'user1'@'localhost'; |
| 91 |
|
| 92 |
connect (conn_user,localhost,user1,pass1,); |
| 93 |
RESET MASTER TO 100; |
| 94 |
|
| 95 |
--disconnect conn_user |
| 96 |
--disconnect conn_user1 |
| 97 |
|
| 98 |
--connection default |
| 99 |
--let $binlog_number= 000100 |
| 100 |
--source suite/binlog/include/binlog_reset_master_to_option.inc |
| 101 |
|
| 102 |
# 8) Test with hexa decimal numbers |
| 103 |
RESET MASTER TO 0xF; |
| 104 |
--let $binlog_number= 000015 |
| 105 |
--source suite/binlog/include/binlog_reset_master_to_option.inc |
| 106 |
|
| 107 |
-- error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE |
| 108 |
RESET MASTER TO 0x0; |
| 109 |
|
| 110 |
RESET MASTER TO 0xFFFF; |
| 111 |
--let $binlog_number= 065535 |
| 112 |
--source suite/binlog/include/binlog_reset_master_to_option.inc |
| 113 |
|
| 114 |
-- error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE |
| 115 |
RESET MASTER TO 0x7FFFFFFF; |
| 116 |
|
| 117 |
# 9) Check with function |
| 118 |
|
| 119 |
CREATE FUNCTION f1(a int) RETURNS INT RETURN (a+10); |
| 120 |
--error ER_PARSE_ERROR |
| 121 |
RESET MASTER TO f1(3); |
| 122 |
|
| 123 |
# Verify that warnings are printed in the error log after extension |
| 124 |
# boundary value is reached. |
| 125 |
RESET MASTER TO 2000000000; |
| 126 |
FLUSH BINARY LOGS; |
| 127 |
FLUSH BINARY LOGS; |
| 128 |
|
| 129 |
--let $assert_file=$MYSQLTEST_VARDIR/tmp/binlog_reset_master_to_option.err |
| 130 |
--let $assert_select=.* \[Warning\] \[[^]]*\] \[[^]]*\] Next log extension: .* Please consider archiving some logs. |
| 131 |
--let $assert_text= Found the expected log exhaustion warnings in the error log. |
| 132 |
--let $assert_count= 2 |
| 133 |
--source include/assert_grep.inc |
| 134 |
|
| 135 |
# Clean Up |
| 136 |
DROP USER 'user1'@'localhost'; |
| 137 |
DROP FUNCTION f1; |
| 138 |
RESET MASTER; |
| 139 |
file_exists $MYSQLD_DATADIR/binlog.000001; |