1RESET MASTER;
2CREATE TABLE t1 (a int);
3### assertion: index file contains regular entries
4SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
5SELECT @index;
6@index
7master-bin.000001
8
9### assertion: show original binlogs
10show binary logs;
11Log_name	File_size
12master-bin.000001	#
13### assertion: binlog contents from regular entries
14include/show_binlog_events.inc
15Log_name	Pos	Event_type	Server_id	End_log_pos	Info
16master-bin.000001	#	Gtid	#	#	GTID #-#-#
17master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
18FLUSH LOGS;
19### assertion: index file contains renamed binlog and the new one
20SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
21SELECT @index;
22@index
23master-bin-b34582.000001
24master-bin.000002
25
26### assertion: original binlog content still exists, despite we
27###            renamed and changed the index file
28include/show_binlog_events.inc
29Log_name	Pos	Event_type	Server_id	End_log_pos	Info
30master-bin-b34582.000001	#	Gtid	#	#	GTID #-#-#
31master-bin-b34582.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
32### assertion: user changed binlog index shows correct entries
33show binary logs;
34Log_name	File_size
35master-bin-b34582.000001	#
36master-bin.000002	#
37DROP TABLE t1;
38### assertion: purging binlogs up to binlog created after instrumenting index file should work
39PURGE BINARY LOGS TO 'master-bin.000002';
40### assertion: show binary logs should only contain latest binlog
41show binary logs;
42Log_name	File_size
43master-bin.000002	#
44### assertion: assert that binlog files were indeed purged (using file_exists calls)
45### assertion: assert that not purged binlog file exists
46### assertion: show index file contents and these should match show binary logs issued above
47SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
48SELECT @index;
49@index
50master-bin.000002
51
52RESET MASTER;
53