File: binlog_reset_master_to_option.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (139 lines) | stat: -rw-r--r-- 4,043 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# ==== Purpose ====
#
# This test will pass a new parameter to the already exisiting command
# RESET MASTER, and will test the expected output and the corner cases.
#
# ==== References ====
#
# WL9110: Add RESET MASTER TO x to allow specification of binlog file number
# Bug#28980788: RESET MASTER TO ALLOWS INVALID INPUT WITHOUT ERROR'S,
#               CAN LEAD TO SERVER HALTS

# This test case is binary log format agnostic
--source include/have_binlog_format_mixed.inc
--source include/force_restart.inc

# This is to suppress the warnings generated after extension boundary value is reached.
call mtr.add_suppression("Next log extension.* Remaining log filename extensions.");

let $MYSQLD_DATADIR= `select @@datadir`;

# Checking the old command this deletes all the old binary log
# file and create a new one with index 1, this is implemented in the inc file below

RESET MASTER;
--let $binlog_number= 000001
--source suite/binlog/include/binlog_reset_master_to_option.inc

# Extension to the existing command, this will delete the old
# binary log and create a new one with index 1234,
# this is implemented in the inc file below
RESET MASTER TO 1234;

# Check that old binary log is deleted
--error 1
file_exists $MYSQLD_DATADIR/binlog.000001;

--let $binlog_number= 001234
--source suite/binlog/include/binlog_reset_master_to_option.inc

# Testing the boundary cases:
#
# 1) Test with non-integer values
--error ER_PARSE_ERROR
RESET MASTER TO 1.023;

# 2) Test with negative numbers
--error ER_PARSE_ERROR
RESET MASTER TO -123;

# 3) Test with 2 billion, as that is the limit for binary log file index
# Check with numbers around the upper limit to show it passes.
RESET MASTER TO 2000000000;
--let $binlog_number= 2000000000
--source suite/binlog/include/binlog_reset_master_to_option.inc

# Checking with 2000000001
--error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE
RESET MASTER TO 2000000001;

# Checking with a value > 32 bit
--error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE
RESET MASTER TO 5000000000;

# Checking with a value > 64 bit
--error ER_PARSE_ERROR
RESET MASTER TO 20000000000000000000;

# 4) Test with 0
--error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE
RESET MASTER TO 0;

# 5) Test with Character
--error ER_PARSE_ERROR
RESET MASTER TO q;
--error ER_PARSE_ERROR
RESET MASTER TO "qwe";

# 6) Test with special character
--error ER_PARSE_ERROR
RESET MASTER TO @;

# 7) Test with a different user
CREATE USER user1@localhost IDENTIFIED BY 'pass1';
connect (conn_user1,localhost,user1,pass1,);
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
RESET MASTER TO 100;

# Grant priviliges to user1
--connection default
GRANT RELOAD ON *.* TO 'user1'@'localhost';

connect (conn_user,localhost,user1,pass1,);
RESET MASTER TO 100;

--disconnect conn_user
--disconnect conn_user1

--connection default
--let $binlog_number= 000100
--source suite/binlog/include/binlog_reset_master_to_option.inc

# 8) Test with hexa decimal numbers
RESET MASTER TO 0xF;
--let $binlog_number= 000015
--source suite/binlog/include/binlog_reset_master_to_option.inc

-- error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE
RESET MASTER TO 0x0;

RESET MASTER TO 0xFFFF;
--let $binlog_number= 065535
--source suite/binlog/include/binlog_reset_master_to_option.inc

-- error ER_RESET_SOURCE_TO_VALUE_OUT_OF_RANGE
RESET MASTER TO 0x7FFFFFFF;

# 9) Check with function

CREATE FUNCTION f1(a int) RETURNS INT RETURN (a+10);
--error ER_PARSE_ERROR
RESET MASTER TO f1(3);

# Verify that warnings are printed in the error log after extension
# boundary value is reached.
RESET MASTER TO 2000000000;
FLUSH BINARY LOGS;
FLUSH BINARY LOGS;

--let $assert_file=$MYSQLTEST_VARDIR/tmp/binlog_reset_master_to_option.err
--let $assert_select=.* \[Warning\] \[[^]]*\] \[[^]]*\] Next log extension: .* Please consider archiving some logs.
--let $assert_text= Found the expected log exhaustion warnings in the error log.
--let $assert_count= 2
--source include/assert_grep.inc

# Clean Up
DROP USER 'user1'@'localhost';
DROP FUNCTION f1;
RESET MASTER;
file_exists $MYSQLD_DATADIR/binlog.000001;