1# ==== Purpose ==== 2# 3# functional test for open_binlog call using when 4# 5# flush log reset master/slave called 6# 7# ==== Related ==== 8# 9# TXSQL feature 67 binlog rotate perf optimization 10 11let $engine= myisam; 12 13--source include/have_binlog_format_row.inc 14--connect(conn1,localhost,root,,test) 15 16reset master; 17create database test_rotate_db; 18use test_rotate_db; 19--echo #currrent engine=$engine 20# Create a new table 21--replace_column 2 # 22show binary logs; 23--eval CREATE TABLE t1_$engine (c1 INT) ENGINE=$engine 24--eval insert into t1_$engine values(0),(1) 25 26# do batch flush and show 27let $loop_times= 100; 28--source include/show_master_status.inc 29while ($loop_times) { 30 flush logs; 31 flush logs; 32 if ($loop_times < 5) 33 { 34 --source include/show_master_status.inc 35 if ($loop_times == 4) 36 { 37 --source include/show_binary_logs.inc 38 } 39 reset master; 40 } 41 if ($loop_times >= 5) 42 { 43 flush logs; 44 } 45 46 # 47 dec $loop_times; 48 --echo # left times= $loop_times 49} 50--echo # [engine=$engine] after first loop_times=$loop_times, show master logs results 51--source include/show_binary_logs.inc 52 53# do batch flush and show with restart mysql 54--source include/show_master_status.inc 55let $loop_times= 10; 56while ($loop_times) { 57 flush logs; 58 flush logs; 59 --echo #begin to restart mysqld current loop_times=$loop_times 60 --source include/restart_mysqld.inc 61 # 62 dec $loop_times; 63 --echo # left restart times= $loop_times 64} 65--echo # [engine=$engine] after second loop_times=$loop_times, show master logs results 66--source include/show_binary_logs.inc 67 68 69# try to change the log-bin configs and restart 70--echo # ======= now try to change the log-bin config for mysqld ======= 71--let $restart_parameters="--log-bin=new_log_bin" 72--echo #begin to restart mysqld 73--source include/restart_mysqld.inc 74--let $restart_parameters= "" 75 76--source include/show_binary_logs.inc 77let $loop_times= 10; 78while ($loop_times) { 79 flush logs; 80 flush logs; 81 if ($loop_times < 5) 82 { 83 if ($loop_times == 4) 84 { 85 --source include/show_binary_logs.inc 86 } 87 reset master; 88 } 89 if ($loop_times >= 5) 90 { 91 flush logs; 92 } 93 94 # 95 dec $loop_times; 96 --echo # left times= $loop_times 97} 98--echo # [engine=$engine] after third loop_times=$loop_times, show master logs results 99--source include/show_binary_logs.inc 100 101##cleanup 102drop database test_rotate_db; 103