1# Check that the latest checkpoint in the redo log files
2# is not newer than the checkpoint sampled by no_checkpoint_start.inc
3
4--source include/kill_mysqld.inc
5
6perl;
7my $cp = $ENV{CHECKPOINT_LSN};
8$cp =~ s/^InnoDB\t\t//;
9my $log = "$ENV{MYSQLD_DATADIR}ib_logfile0";
10open(LOG, "<$log") || die "Unable to open $log";
11seek(LOG, 512, 0) || die "Unable to seek $log";
12die unless read(LOG, $_, 16) == 16;
13my ($no1hi,$no1lo,$cp1hi,$cp1lo) = unpack("N*", $_);
14seek(LOG, 3 * 512, 0) || die "Unable to seek $log";
15die unless read(LOG, $_, 16) == 16;
16my ($no2hi,$no2lo,$cp2hi,$cp2lo) = unpack("N*", $_);
17close(LOG);
18
19my $cp1 = $cp1hi << 32 | $cp1lo;
20my $cp2 = $cp2hi << 32 | $cp2lo;
21
22open(OUT, ">$ENV{MYSQLTEST_VARDIR}/log/check.txt") || die;
23
24if ($cp1 > $cp || $cp2 > $cp) {
25   print OUT "--source include/start_mysqld.inc\n";
26   print OUT "$ENV{CLEANUP_IF_CHECKPOINT}\n";
27   print OUT "$ENV{CLEANUP_FILES_IF_CHECKPOINT}\n";
28   print OUT "--skip Extra checkpoint 1 after $cp";
29   print OUT " ($no1hi:$no1lo=$cp1,$no2hi:$no2lo=$cp2)\n";
30}
31
32close(OUT);
33EOF
34
35--source $MYSQLTEST_VARDIR/log/check.txt
36--remove_file $MYSQLTEST_VARDIR/log/check.txt
37