Merge lp:~sergei.glushchenko/percona-server/ps56-univ-log-archive into lp:percona-server/5.6

Proposed by Sergei Glushchenko
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 326
Proposed branch: lp:~sergei.glushchenko/percona-server/ps56-univ-log-archive
Merge into: lp:percona-server/5.6
Prerequisite: lp:~sergei.glushchenko/percona-server/56-bug1157078-bug1157075
Diff against target: 2357 lines (+1394/-155)
43 files modified
Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_check.inc (+15/-0)
Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_cleanup.inc (+15/-0)
Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_count.inc (+9/-0)
Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_last_file.inc (+24/-0)
Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_setup.inc (+49/-0)
Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_stat.inc (+72/-0)
Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_workload.inc (+5/-0)
Percona-Server/mysql-test/suite/innodb/r/pecona_bug1155475.result (+23/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_innodb_log_archive_func.result (+24/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_expire_sec.result (+27/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_func.result (+21/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_before.result (+37/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_to.result (+35/-0)
Percona-Server/mysql-test/suite/innodb/t/pecona_bug1155475.test (+30/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_innodb_log_archive_func.test (+31/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_expire_sec.test (+29/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_func.test (+19/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_before.test (+43/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_to.test (+39/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result (+38/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result (+38/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result (+38/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test (+60/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test (+60/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test (+61/-0)
Percona-Server/sql/handler.cc (+42/-0)
Percona-Server/sql/handler.h (+8/-0)
Percona-Server/sql/lex.h (+1/-0)
Percona-Server/sql/mysqld.cc (+2/-0)
Percona-Server/sql/sql_cmd.h (+2/-0)
Percona-Server/sql/sql_parse.cc (+43/-0)
Percona-Server/sql/sql_yacc.yy (+19/-1)
Percona-Server/storage/innobase/fil/fil0fil.cc (+34/-33)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+78/-8)
Percona-Server/storage/innobase/include/fil0fil.h (+8/-6)
Percona-Server/storage/innobase/include/log0log.h (+20/-7)
Percona-Server/storage/innobase/include/log0recv.h (+2/-2)
Percona-Server/storage/innobase/include/srv0srv.h (+14/-0)
Percona-Server/storage/innobase/include/univ.i (+3/-0)
Percona-Server/storage/innobase/log/log0log.cc (+101/-62)
Percona-Server/storage/innobase/log/log0recv.cc (+18/-16)
Percona-Server/storage/innobase/srv/srv0srv.cc (+140/-0)
Percona-Server/storage/innobase/srv/srv0start.cc (+17/-20)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-server/ps56-univ-log-archive
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+154428@code.launchpad.net

This proposal supersedes a proposal from 2013-02-10.

Description of the change

Implementation of log archiving based on branch by KAlexey
which enables UNIV_LOG_ARCHIVE
* variables names and startup parameters have been changed
  from InnoDB original to be same as were used in previous
  implementation
* archive log files naming has been changed from original
  zero-based sequence (0, 1, 2, 3) to sequence of start lsn
  of archived file. Also prefix has been changed to be
  the same as in previous implementation
* purge commands have been implemented
  (PURGE ARCHIVED LOGS BEFORE/TO)
* innodb_xtra_expire_archive_logs_sec has been implemented
* innodb_xtra_log_archive_throttle has not been implemented
  as not applicable
* testcase has been added (modified from original, as purge
  commands do not delete current archive in progress)

To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Will post couple of questions here
1. This implementation is different from described in https://blueprints.launchpad.net/percona-server/+spec/log-archiving, do we need to disapprove this blueprint and create new one, or just change existing one to describe current implementation?
2. This "I would like to have corresponding binary log position for log archive.
This will allow to have point in time recovery with binary logs." has not been implemented in original implementation and there is no comments about it in previous MP. Do we need this feature?
3. Do we need variable (like have_xtra_log_archiving) to indicate that server has archiving support?
4. Do we really need to be able enable/disable archiving at runtime as BP above describes? We should handle partially written archives somehow in this case.

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

Hi Sergei,

On Mon, Feb 11 2013 14:17:20 +0400, Sergei Glushchenko wrote:

> Will post couple of questions here
> 1. This implementation is different from described in https://blueprints.launchpad.net/percona-server/+spec/log-archiving, do we need to disapprove this blueprint and create new one, or just change existing one to describe current implementation?

I think just changing the existing one is fine.

> 2. This "I would like to have corresponding binary log position for log archive.
> This will allow to have point in time recovery with binary logs." has not been implemented in original implementation and there is no comments about it in previous MP. Do we need this feature?

Yes, was probably left out from the original implementation. How hard
would it be to implement it?

> 3. Do we need variable (like have_xtra_log_archiving) to indicate that
> server has archiving support?

I don't think so.

> 4. Do we really need to be able enable/disable archiving at runtime as BP above describes? We should handle partially written archives somehow in this case.

I think ability to control it at runtime is good. Partially written
files and gaps in archived files are IMHO a user's problem, i.e. there's
not much _we_ can do to _handle_ them.

--
Best regards,
Alexey.

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Alexey,

It's not clear to me how to obtain corresponding binlog position for the LSN at the start of archive. InnoDB know binlog position at transaction commit. And it possible to obtain current binlog position by invoking thd_binlog_pos, but the problem here is that at the moment when we write archived file current LSN might be much further than LSN we write into archive.

Is there any other way to get this?

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

http://jenkins.percona.com/view/PS%205.6/job/percona-server-5.6-param/41/

  Implementation of log archiving based on branch by KAlexey
  which enables UNIV_LOG_ARCHIVE
  * variables and startup parameters have following names:
    - innodb_log_archive = ON/OFF
    - innodb_log_arch_dir = DIR
    - innodb_log_arch_expire_sec = N
  * archive log files naming has been changed from original
    zero-based sequence (0, 1, 2, 3) to sequence of start lsn
    of archived file. Also prefix has been changed to be
    the same as in previous implementation
  * purge commands have been implemented
    (PURGE ARCHIVED LOGS BEFORE/TO)
  * innodb_log_arch_expire_sec has been implemented
  * innodb_xtra_log_archive_throttle has not been implemented
    as it is not applicable
  * testcases were implemented

Revision history for this message
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal

Sergey, it seems percona_log_archiving-master.opt is needless because there is no corresponding .test-.result files and at least one option in the .opt file is wrong.

Revision history for this message
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal

It's just partial review:

1. Unused local variable space_arch_log_no in fil_open_single_table_tablespace();
2. I would use "#define IB_ARCHIVED_LOGS_PREFIX_LEN (sizeof(IB_ARCHIVED_LOGS_PREFIX) - 1)" instead of using the number;
3. I don't think it's a good idea to abort the server if the file name does not fit into the buffer in log_archived_file_name_gen(). We could use strncpy() and snprintf() instead of strcpy() and sprintf() and return some value that shows if operation is completed successfully. If it does not some warning should be emitted.

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Vlad,

What behavior do you propose for case 3? Server obviously cannot continue operation with given settings. Should log_archiving be turned off (silently or with warning issued to error log)? How can it will be visible to DBA (logs aren't being archived)?

Revision history for this message
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal

> Vlad,
>
> What behavior do you propose for case 3? Server obviously cannot continue
> operation with given settings. Should log_archiving be turned off (silently or
> with warning issued to error log)? How can it will be visible to DBA (logs
> aren't being archived)?

Logs archiving - its a backup feature. I think server must not stop if backup does not work. There should be error in error log with stopped log archiving.

Revision history for this message
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal
Download full text (4.3 KiB)

I'm testing the latest xtrabackup(lp:percona-xtrabackup) with this server and I have the following issue when I try to do backup:

xtrabackup: uses posix_fadvise().
xtrabackup: cd to /tmp/1/src/data
xtrabackup: Target instance is assumed as followings.
xtrabackup: innodb_data_home_dir = ./
xtrabackup: innodb_data_file_path = ibdata1:10M:autoextend
xtrabackup: innodb_log_group_home_dir = ./
xtrabackup: innodb_log_files_in_group = 2
xtrabackup: innodb_log_file_size = 2097152
130313 0:06:46 InnoDB: Assertion failure in thread 140183767389952 in file fil0fil.c line 5519
InnoDB: Failing assertion: byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.

I use the following test script to repeat it:
#!/bin/bash

BASE_DIR=/tmp/1/percona-current
DATA_DIR=/tmp/1/src/data
ARCHIVED_LOGS_DIR=/tmp/1/src/archived_logs
BACKUP_DIR=/tmp/1/src/backup
DST_DIR=/tmp/1/dst
XTRABACKUP_DIR=.
XTRABACKUP=$XTRABACKUP_DIR/xtrabackup_55
USER=some_user
EXTRA_OPTIONS="--innodb-file-per-table --innodb_log_file_size=2M"
SERVER_OPTIONS="--innodb_log_archive=ON --innodb_log_arch_dir=$ARCHIVED_LOGS_DIR"
LD_LIBRARY_PATH=$BASE_DIR/lib/mysql:$LD_LIBRARY_PATH
INSTALL_DB=$BASE_DIR/scripts/mysql_install_db
MYSQLD=$BASE_DIR/bin/mysqld
MYSQL=$BASE_DIR/bin/mysql

mkdir -p $DATA_DIR $ARCHIVED_LOGS_DIR $BACKUP_DIR $DST_DIR
rm -rf $DATA_DIR/* $ARCHIVED_LOGS_DIR/* $BACKUP_DIR/* $DST_DIR/*

$INSTALL_DB --no-defaults --basedir=$BASE_DIR --datadir=$DATA_DIR --user=$USER $EXTRA_OPTIONS
PID1=$!
sleep 2
echo '--------------------------after start-----------------------------'
                               ...

Read more...

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Vlad,

So we shouldn't probably fail in case if we cannot write to create new archive file (os_file_create is failed), any problems with IO and so on, which could lead to some nontrivial changes of InnoDB code. Your thoughts?

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal

Xtradb based version are failed with same assertion, however xtrabackup_plugin seems to able to perform backup.

Revision history for this message
Alexey Kopytov (akopytov) wrote : Posted in a previous version of this proposal

   - multiple lines violate the 80 chars limit, try:

: bzr diff -c-1 | grep -0 '^+ ' | awk 'length > 82'

   - there's still no reply in http://bugs.mysql.com/bug.php?id=68635
     We obviously cannot afford similar changes for every new statement
     type, so we should do something about it. What about adding
     performance_schema_max_statement_classes = 167 to
     mysql-test/include/default_mysqld.cnf?

   - the changes related to digest values is another "gift" from
     performance schema. Not sure what to do about it. Probably just
     "--replace-column ... <digest>" in the corresponding tests?

  - please use OS_FILE_MAX_PATH instead of hard-coded (and
    inconsistent) constants in log_group_archive() and
    log_group_recover_from_archive_file(). I don't think it then makes
    sense to assert on sufficient buffer space, as a lot of things
    would break if paths are longer than that. But you can keep the
    assertion if you like. The rest of InnoDB code seems to assume that
    never happens, but I agree we should fail *if* it does.

review: Needs Fixing
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Failure of XtraDB based xtrabackup binaries is a result of change which comes from innodb_files_extend.patch. This patch uses LOG_CHECKPOINT_ARCHIVED_LSN to store LSN offset of checkpoint within the group, assuming that "UNIV_LOG_ARCHIVE could not be enabled". So this feature is incompatible with any XtraDB based XtraBackup binary. It also should be taken into account when feature will be ported to 5.6.

Revision history for this message
Alexey Kopytov (akopytov) wrote :

The part of innodb_files_extend.patch that conflicts with UNIV_LOG_ARCHIVE is support for log files > 4G and thus will not be ported to 5.6, because it is implemented in upstream 5.6, but in a different way and without breaking UNIV_LOG_ARCHIVE.

Revision history for this message
Alexey Kopytov (akopytov) wrote :

Sergei,

   Summary of our IRC discussion for the record:
   - test case for bug #1155475
   - unified return types in sql/handler.cc
   - error on bogus filename in innobase_purge_archive_logs()

   Other comments:

   - archived_file_no / next_archived_file_no are now LSNs rather that
     ordinal file numbers. Which means their type should be lsn_t, not
     ulint. The same for 'file_no' argument f
     log_archived_file_name_gen().

   - the assertion and sprintf() in log_archived_file_name_gen() seem to
     assume the maximum length for a decimal representation of file_no
     is 16 characters, but it is a 64-bit integer, so the maximum length
     is 20 characters.

   - the following line in log_archived_file_name_gen() still is still
     longer than 80 chars:

: sprintf(buf + dirnamelen, IB_ARCHIVED_LOGS_PREFIX "%016lu", (ulong) file_no);

   - the following line in log_group_archive() is still longer than 80
     chars:

: n_files * (group->file_size - LOG_FILE_HDR_SIZE),

review: Needs Fixing
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

There is an issue with archived file number and archived file offset. These values are written to checkpoint as 4-byte values, however they are naturally 64-bit (type of archived_offset/next_archived_offset should be changed to lsn_t as well).
Possible solution is not to write archived file number to archived file header and to checkpoint. Archived file number is the same as first LSN for archived log file.
I'm going to implement this and look how it goes.

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Unfortunately archived file number have to be written to checkpoint. It cannot be calculated using checkpoint LSN as archive may be start by user at any time starting with any LSN. So I introduced two additional 4-byte fields in checkpoint to hold high 4-byte values for archive file number and archive file offset

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

Alexey,

This is what have been done to address your comments and issues
above

* type of archived_file_no, archived_offset, next_archived_file_no,
  next_archived_offset members of log_group_t has been changed to
  lsn_t
* two additional fields in chechpoint record have been introduced
  to store high 4 bytes of archived file number and offset in
  archived file
* numeric part of archived log file name has been changed to be
  20 characters width, zero padded
* testcase for bug #1155475 has been added
* return types has been changed to my_bool for MySQL handlers,
  and to dberr_t for InnoDB function (PURGE ARCHIVED LOGS commands)
* error on bogus file name has been fixed, check for it has been
  added to appropriate test case

http://jenkins.percona.com/view/PS%205.6/job/percona-server-5.6-param/65/

Revision history for this message
Alexey Kopytov (akopytov) wrote :

Sergei,

Introducing new fields to the on-disk data format doesn't look good.

It looks like we can just avoid using LOG_CHECKPOINT_ARCHIVED_FILE_NO
and LOG_CHECKPOINT_ARCHIVED_OFFSET altogether. Upstream InnoDB code
stores archived_file_no and archived_offset on disk, because it uses
file naming based on ordinal file numbers. So on a restart it has to get
the file number from the checkpoint header to figure out the file _name_
that should be used for further archive writes. It normally doesn't need
the offset, because on a clean restart or when log archiving is
re-enabled, it starts a new file (i.e. with a zero file offset). The
only case when the offset is used is when InnoDB recovers from a
crash. In which case it will proceed with writing to the incompletely
written file starting from archived_offset, so it can eventually write
the file full and mark it as completed.

Now we use LSN-based file naming, so we don't have that problem. With
the new archived_file_no semantics we have archived_lsn =
archived_file_no + archived_offset. We can still maintain them
internally for simplicity, just don't write them to disk.

We have to do more work on a restart though to avoid incompletely
written files in case of a crash:

1. Read archived_lsn from the checkpoint header.
2. Scan innodb_log_arch_dir and find the log file with the maximum LSN
   in its name
3. If no files are found, set archived_file_no to archived_lsn,
   archived_offset to 0 and return (i.e. start a new file)
4. If LOG_FILE_ARCH_COMPLETED in the found file is TRUE (i.e. we are restarting from a
   clean shutdown) do the same as in 3.
5. Assert that archived_lsn lies within the incompletely written file we
   have found (i.e. file_start_lsn + group->file_size > archived_lsn)
6. set archived_file_no to file_start_lsn, archived_offset to
   (archived_lsn - file_start_lsn) and return

Another option would be to give up on the LSN-based file names idea, but
it wouldn't be a complete solution, because as you noted, the offset
should still be a 64-bit value now when log files can be > 4G.

Which means there are actually 2 options: either extend the on-disk
format, or do more work on restart.

Other minor things I noticed when looking at the code:

- too long line:
: IB_ARCHIVED_LOGS_PREFIX, IB_ARCHIVED_LOGS_PREFIX_LEN)) {

- spaces instead of tabs here:

: if (fil_space_contains_node(group->archive_space_id,
: archived_log_filename) ||

review: Needs Fixing
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

I understand the reasoning for keeping ondisk format unchanged, but I think proposed algorithm can be made simpler.

Lets suppose we store only file number, but not the offset (we use both current 4-byte file_no and offset for it). After restart, we can read archived file number and archived lsn from checkpoint. So no need to iterate files in directory!. From archived file header we can read start lsn for this file and get offset by using subtraction.

Does it look good?

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :

And, yes, if file doesn't exists, just make assume offset=0

Revision history for this message
Alexey Kopytov (akopytov) wrote :

Sergei,

Agree, a combination of a 8-byte archived_file_no and archived_lsn provides us all the information we need and allows to avoid innodb_log_arch_dir scan. Good find!

Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_check.inc'
--- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_check.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_check.inc 2013-03-31 06:25:28 +0000
@@ -0,0 +1,15 @@
1# Check that there are no gaps in archived files
2
3--source percona_log_archiving_stat.inc
4
5let $lsn = `SELECT (($archived_logs_count - 1) * $LOG_FILE_LSN_STEP + $first_log_file_lsn)`;
6
7if ($last_log_file_lsn != $lsn)
8{
9 echo Expected last file lsn is $lsn but got $last_log_file_lsn;
10 die Test failed;
11}
12
13echo Check OK;
14
15let $LAST_ARCHIVED_LSN = $last_log_file_lsn;
016
=== added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_cleanup.inc'
--- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_cleanup.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_cleanup.inc 2013-03-31 06:25:28 +0000
@@ -0,0 +1,15 @@
1#
2# Cleanup after log archiving testing
3#
4
5DROP TABLE t;
6
7--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
8--shutdown_server
9--source include/wait_until_disconnected.inc
10--enable_reconnect
11--exec echo "restart: --innodb-log-file-size=1M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
12--source include/wait_until_connected_again.inc
13
14--remove_files_wildcard $MYSQLD_ARCHIVEDIR ib_log_archive_*
15--rmdir $MYSQLD_ARCHIVEDIR
016
=== added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_count.inc'
--- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_count.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_count.inc 2013-03-31 06:25:28 +0000
@@ -0,0 +1,9 @@
1
2--source percona_log_archiving_stat.inc
3
4let $lsn = $n_files * $LOG_FILE_LSN_STEP;
5
6--echo $archived_logs_count
7
8let $LAST_ARCHIVED_LSN = $last_log_file_lsn;
9
010
=== added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_last_file.inc'
--- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_last_file.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_last_file.inc 2013-03-31 06:25:28 +0000
@@ -0,0 +1,24 @@
1
2perl;
3@files = glob($ENV{'MYSQLD_ARCHIVEDIR'}.'/ib_log_archive_*');
4my $filepath, $filename, $dirname;
5foreach my $file (@files) {
6 ($dirname, $filename) = $file =~ m|^(.*[/\\])([^/\\]+?)$|;
7 $filepath = $file;
8}
9
10my @array = stat($filepath);
11my $filemodifytime = $array[9];
12my @t = localtime $filemodifytime;
13my $modifytime = sprintf "%04u-%02u-%02u %02u:%02u:%02u",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0];
14my $lsn = $filename =~ m/ib_log_archive_0*([1-9][0-9]+)$/;
15open F, ">".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/percona_archived_logs.tmp' or die "Cannot open file percona_archived_logs.tmp for write";
16printf F ("let \$last_log_file = %s;\n", $filename);
17printf F ("let \$last_log_file_modify = %s;\n", $modifytime);
18printf F ("let \$last_log_file_lsn = %s;\n", $lsn);
19close F;
20EOF
21
22--source $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp
23# remove_file $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp;
24
025
=== added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_setup.inc'
--- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_setup.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_setup.inc 2013-03-31 06:25:28 +0000
@@ -0,0 +1,49 @@
1#
2# setup for log archive testing
3#
4
5
6call mtr.add_suppression("InnoDB: Resizing redo log");
7call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
8call mtr.add_suppression("InnoDB: New log files created");
9call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
10
11--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
12--shutdown_server
13--source include/wait_until_disconnected.inc
14# Do something while server is down
15--enable_reconnect
16--exec echo "restart: --innodb_log_archive=ON --innodb_log_arch_dir=logs_archive --innodb-log-file-size=1M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
17--source include/wait_until_connected_again.inc
18
19--disable_warnings
20drop table if exists t;
21--enable_warnings
22
23let $MYSQLD_DATADIR= `SELECT @@datadir`;
24let $MYSQLD_ARCHIVEDIR= `SELECT IF( locate('/', @@innodb_log_arch_dir) = 1, @@innodb_log_arch_dir, CONCAT(@@datadir, @@innodb_log_arch_dir))`;
25let MYSQLD_ARCHIVEDIR = $MYSQLD_ARCHIVEDIR;
26--mkdir $MYSQLD_ARCHIVEDIR
27
28let $LOG_FILE_HDR_SIZE = 2048;
29let $LOG_FILE_SIZE = `SELECT @@innodb_log_file_size`;
30let $LOG_FILE_LSN_STEP = `SELECT $LOG_FILE_SIZE - $LOG_FILE_HDR_SIZE`;
31
32create table t (a int not null) ENGINE=InnoDB;
33
34insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
35insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
36insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
37insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
38insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
39insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
40insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
41insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
42insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
43insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
44insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
45insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
46
47--source percona_log_archiving_stat.inc
48
49let $LAST_ARCHIVED_LSN = $last_log_file_lsn;
050
=== added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_stat.inc'
--- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_stat.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_stat.inc 2013-03-31 06:25:28 +0000
@@ -0,0 +1,72 @@
1#
2# Collect information about archived log files
3#
4
5perl;
6use Data::Dumper;
7sub fn {
8 my $filepath = shift;
9 my ($dirname, $filename) = $filepath =~ m|^(.*[/\\])([^/\\]+?)$|;
10
11 return $filename;
12}
13
14sub get_file_stat {
15 my $filepath = shift;
16 my $prefix = shift;
17 my $filename = fn($filepath);
18
19 my @array = stat($filepath);
20 my $filemodifytime = $array[9];
21 my @t = localtime $filemodifytime;
22 my $modifytime = sprintf "%04u-%02u-%02u %02u:%02u:%02u",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0];
23 my ($lsn) = $filename =~ m/ib_log_archive_[0]*([1-9][0-9]+)$/;
24
25 my $f = {
26 'path' => $filepath,
27 'name' => $filename,
28 't' => $filemodifytime,
29 'modifytime' => $modifytime,
30 'lsn' => $lsn
31 };
32
33 return $f;
34}
35
36sub print_file_stat {
37 my %stat = %{$_[0]};
38 my $prefix = $_[1];
39
40 open F, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/percona_archived_logs.tmp' or die "Cannot open file percona_archived_logs.tmp for write";
41 printf F ("let \$${prefix}_log_file = %s;\n", $stat{'name'});
42 printf F ("let \$${prefix}_log_file_modify = %s;\n", $stat{'modifytime'});
43 printf F ("let \$${prefix}_log_file_lsn = %s;\n", $stat{'lsn'});
44 close F;
45}
46
47@files = glob($ENV{'MYSQLD_ARCHIVEDIR'}.'/ib_log_archive_*');
48
49my @files_stat = ();
50
51foreach my $file (@files) {
52 push(@files_stat, get_file_stat($file));
53}
54
55$count = scalar(@files_stat);
56$mid_n = 1;
57$t = $files_stat[$mid_n]{'t'};
58while (($files_stat[$mid_n]{'t'} == $t) && ($mid_n < $count - 1)) {$mid_n++};
59print_file_stat(@files_stat[0], 'first');
60print_file_stat(@files_stat[-1], 'last');
61print_file_stat(@files_stat[$mid_n - 1], 'mid');
62
63open F, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/percona_archived_logs.tmp' or die "Cannot open file percona_archived_logs.tmp for write";
64printf F ("let \$archived_logs_count = %s;\n", $count);
65printf F ("let \$archived_logs_mid = %s;\n", $mid_n);
66close F;
67
68EOF
69
70--source $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp
71remove_file $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp;
72
073
=== added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_workload.inc'
--- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_workload.inc 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_workload.inc 2013-03-31 06:25:28 +0000
@@ -0,0 +1,5 @@
1#
2# Perform insert into table to produce some log records
3#
4
5insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
06
=== added file 'Percona-Server/mysql-test/suite/innodb/r/pecona_bug1155475.result'
--- Percona-Server/mysql-test/suite/innodb/r/pecona_bug1155475.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/pecona_bug1155475.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,23 @@
1call mtr.add_suppression("InnoDB: Resizing redo log");
2call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
3call mtr.add_suppression("InnoDB: New log files created");
4call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
5drop table if exists t;
6create table t (a int not null) ENGINE=InnoDB;
7insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
8insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
9insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
10insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
11insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
12insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
13insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
14insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
15insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
16insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
17insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
18insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
19insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
20Check OK
21PURGE ARCHIVED LOGS BEFORE NOW();
22insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
23DROP TABLE t;
024
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_innodb_log_archive_func.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_innodb_log_archive_func.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_innodb_log_archive_func.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,24 @@
1call mtr.add_suppression("InnoDB: Resizing redo log");
2call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
3call mtr.add_suppression("InnoDB: New log files created");
4call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
5drop table if exists t;
6create table t (a int not null) ENGINE=InnoDB;
7insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
8insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
9insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
10insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
11insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
12insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
13insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
14insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
15insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
16insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
17insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
18insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
19insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
20SET GLOBAL innodb_log_archive = OFF;
21Check OK
22insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
23SET GLOBAL innodb_log_archive = ON;
24DROP TABLE t;
025
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_expire_sec.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_expire_sec.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_expire_sec.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,27 @@
1call mtr.add_suppression("InnoDB: Resizing redo log");
2call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
3call mtr.add_suppression("InnoDB: New log files created");
4call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
5drop table if exists t;
6create table t (a int not null) ENGINE=InnoDB;
7insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
8insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
9insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
10insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
11insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
12insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
13insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
14insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
15insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
16insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
17insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
18insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
19SET @save_log_arch_expire_sec = @@innodb_log_arch_expire_sec;
20SET GLOBAL innodb_log_arch_expire_sec = 1;
21insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
22insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
23SELECT sleep(4);
24sleep(4)
250
26SET GLOBAL innodb_log_arch_expire_sec = @save_log_arch_expire_sec;
27DROP TABLE t;
028
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_func.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_func.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_func.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,21 @@
1call mtr.add_suppression("InnoDB: Resizing redo log");
2call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
3call mtr.add_suppression("InnoDB: New log files created");
4call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
5drop table if exists t;
6create table t (a int not null) ENGINE=InnoDB;
7insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
8insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
9insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
10insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
11insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
12insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
13insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
14insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
15insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
16insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
17insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
18insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
19insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
20Check OK
21DROP TABLE t;
022
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_before.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_before.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_before.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,37 @@
1call mtr.add_suppression("InnoDB: Resizing redo log");
2call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
3call mtr.add_suppression("InnoDB: New log files created");
4call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
5drop table if exists t;
6create table t (a int not null) ENGINE=InnoDB;
7insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
8insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
9insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
10insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
11insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
12insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
13insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
14insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
15insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
16insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
17insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
18insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
19SELECT sleep(1);
20sleep(1)
210
22insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
23SELECT sleep(1);
24sleep(1)
250
26insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
27SELECT sleep(1);
28sleep(1)
290
30insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
31Check OK
32PURGE ARCHIVED LOGS BEFORE 'val';
33PURGE ARCHIVED LOGS BEFORE NOW();
34PURGE ARCHIVED LOGS BEFORE DATE_ADD(NOW(), INTERVAL 7 DAY);
35PURGE ARCHIVED LOGS BEFORE 'q';
36ERROR HY000: Unknown error during log purge
37DROP TABLE t;
038
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_to.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_to.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_to.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,35 @@
1call mtr.add_suppression("InnoDB: Resizing redo log");
2call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
3call mtr.add_suppression("InnoDB: New log files created");
4call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
5drop table if exists t;
6create table t (a int not null) ENGINE=InnoDB;
7insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
8insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
9insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
10insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
11insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
12insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
13insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
14insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
15insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
16insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
17insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13);
18insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
19SELECT sleep(1);
20sleep(1)
210
22insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
23SELECT sleep(1);
24sleep(1)
250
26insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
27SELECT sleep(1);
28sleep(1)
290
30insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000;
31Check OK
32PURGE ARCHIVED LOGS TO 'val';
33PURGE ARCHIVED LOGS TO '#invalid_file';
34ERROR HY000: Unknown error during log purge
35DROP TABLE t;
036
=== added file 'Percona-Server/mysql-test/suite/innodb/t/pecona_bug1155475.test'
--- Percona-Server/mysql-test/suite/innodb/t/pecona_bug1155475.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/pecona_bug1155475.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,30 @@
1#
2# Test bug 1155475
3#
4
5--source include/have_innodb.inc
6--source include/not_embedded.inc
7
8--source ../include/percona_log_archiving_setup.inc
9
10--source ../include/percona_log_archiving_workload.inc
11--source ../include/percona_log_archiving_check.inc
12
13if ($archived_logs_count == 0)
14{
15 die "0 archived logs have been produced";
16}
17
18--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
19--shutdown_server
20--source include/wait_until_disconnected.inc
21--enable_reconnect
22--exec echo "restart: --innodb_log_archive=ON --innodb_log_arch_dir=logs_archive --innodb-log-file-size=1M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
23--source include/wait_until_connected_again.inc
24
25PURGE ARCHIVED LOGS BEFORE NOW();
26
27# server shouldn't crash
28--source ../include/percona_log_archiving_workload.inc
29
30--source ../include/percona_log_archiving_cleanup.inc
031
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_innodb_log_archive_func.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_innodb_log_archive_func.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_innodb_log_archive_func.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,31 @@
1#
2# Test innodb_log_archive turning ON/OFF at runtime
3#
4
5--source include/have_innodb.inc
6--source include/not_embedded.inc
7
8--source ../include/percona_log_archiving_setup.inc
9
10
11--source ../include/percona_log_archiving_workload.inc
12
13SET GLOBAL innodb_log_archive = OFF;
14
15--source ../include/percona_log_archiving_check.inc
16
17let $count = $archived_logs_count;
18
19--source ../include/percona_log_archiving_workload.inc
20
21SET GLOBAL innodb_log_archive = ON;
22
23--source ../include/percona_log_archiving_stat.inc
24
25if ($count != $archived_logs_count)
26{
27 die Test failed. Archived logs being written while innodb_log_archive being turned off.;
28}
29
30--source ../include/percona_log_archiving_cleanup.inc
31
032
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_expire_sec.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_expire_sec.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_expire_sec.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,29 @@
1#
2# Test innodb_log_archive_expire_sec
3#
4
5--source include/have_innodb.inc
6--source include/not_embedded.inc
7
8--source ../include/percona_log_archiving_setup.inc
9
10SET @save_log_arch_expire_sec = @@innodb_log_arch_expire_sec;
11SET GLOBAL innodb_log_arch_expire_sec = 1;
12
13--source ../include/percona_log_archiving_workload.inc
14
15--source ../include/percona_log_archiving_workload.inc
16
17SELECT sleep(4);
18
19--source ../include/percona_log_archiving_stat.inc
20
21if ($archived_logs_count > 1)
22{
23 die Test failed. Archived logs have nod been purged.;
24}
25
26SET GLOBAL innodb_log_arch_expire_sec = @save_log_arch_expire_sec;
27
28--source ../include/percona_log_archiving_cleanup.inc
29
030
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_func.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_func.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_func.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,19 @@
1#
2# Test that log archiving is working (produce some files at least)
3#
4
5--source include/have_innodb.inc
6--source include/not_embedded.inc
7
8--source ../include/percona_log_archiving_setup.inc
9
10--source ../include/percona_log_archiving_workload.inc
11--source ../include/percona_log_archiving_check.inc
12
13if ($archived_logs_count == 0)
14{
15 die "0 archived logs have been produced";
16}
17
18--source ../include/percona_log_archiving_cleanup.inc
19
020
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_before.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_before.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_before.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,43 @@
1#
2# Test PURGE ARCHIVED LOGS BEFORE
3#
4
5--source include/have_innodb.inc
6--source include/not_embedded.inc
7
8--source ../include/percona_log_archiving_setup.inc
9
10SELECT sleep(1);
11--source ../include/percona_log_archiving_workload.inc
12SELECT sleep(1);
13--source ../include/percona_log_archiving_workload.inc
14SELECT sleep(1);
15--source ../include/percona_log_archiving_workload.inc
16--source ../include/percona_log_archiving_check.inc
17
18if ($archived_logs_count == 0)
19{
20 die "0 archived logs have been produced";
21}
22
23--replace_result $mid_log_file_modify val
24--eval PURGE ARCHIVED LOGS BEFORE '$mid_log_file_modify'
25
26let $count = `SELECT $archived_logs_count - $archived_logs_mid`;
27
28--source ../include/percona_log_archiving_stat.inc
29
30if ($archived_logs_count != $count)
31{
32 die "PURGE ARCHIVED LOGS BEFORE failed";
33}
34
35# check that it works with NOW() and other functions
36PURGE ARCHIVED LOGS BEFORE NOW();
37PURGE ARCHIVED LOGS BEFORE DATE_ADD(NOW(), INTERVAL 7 DAY);
38
39# should fail
40--error 1379
41PURGE ARCHIVED LOGS BEFORE 'q';
42
43--source ../include/percona_log_archiving_cleanup.inc
044
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_to.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_to.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_to.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,39 @@
1#
2# Test PURGE ARCHIVED LOGS TO
3#
4
5--source include/have_innodb.inc
6--source include/not_embedded.inc
7
8--source ../include/percona_log_archiving_setup.inc
9
10SELECT sleep(1);
11--source ../include/percona_log_archiving_workload.inc
12SELECT sleep(1);
13--source ../include/percona_log_archiving_workload.inc
14SELECT sleep(1);
15--source ../include/percona_log_archiving_workload.inc
16--source ../include/percona_log_archiving_check.inc
17
18if ($archived_logs_count == 0)
19{
20 die "0 archived logs have been produced";
21}
22
23--replace_result $mid_log_file val
24--eval PURGE ARCHIVED LOGS TO '$mid_log_file'
25
26let $count = `SELECT $archived_logs_count - $archived_logs_mid + 1`;
27
28--source ../include/percona_log_archiving_stat.inc
29
30if ($archived_logs_count != $count)
31{
32 die "PURGE ARCHIVED LOGS TO failed";
33}
34
35#should fail
36--error 1379
37PURGE ARCHIVED LOGS TO '#invalid_file';
38
39--source ../include/percona_log_archiving_cleanup.inc
040
=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result'
--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,38 @@
1SELECT @@GLOBAL.innodb_log_arch_dir;
2@@GLOBAL.innodb_log_arch_dir
3./
4NULL Expected
5SET @@GLOBAL.innodb_log_arch_dir=1;
6ERROR HY000: Variable 'innodb_log_arch_dir' is a read only variable
7Expected error 'Read only variable'
8SELECT @@GLOBAL.innodb_log_arch_dir;
9@@GLOBAL.innodb_log_arch_dir
10./
11NULL Expected
12SELECT VARIABLE_VALUE
13FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
14WHERE VARIABLE_NAME='innodb_log_arch_dir';
15VARIABLE_VALUE
16./
17empty string Expected
18SELECT @@innodb_log_arch_dir;
19@@innodb_log_arch_dir
20./
21NULL Expected
22SELECT @@innodb_log_arch_dir;
23@@innodb_log_arch_dir
24./
25NULL Expected
26SELECT @@local.innodb_log_arch_dir;
27ERROR HY000: Variable 'innodb_log_arch_dir' is a GLOBAL variable
28Expected error 'Variable is a GLOBAL variable'
29SELECT @@SESSION.innodb_log_arch_dir;
30ERROR HY000: Variable 'innodb_log_arch_dir' is a GLOBAL variable
31Expected error 'Variable is a GLOBAL variable'
32SELECT @@GLOBAL.innodb_log_arch_dir;
33@@GLOBAL.innodb_log_arch_dir
34./
35NULL Expected
36SELECT innodb_log_arch_dir = @@SESSION.innodb_log_arch_dir;
37ERROR 42S22: Unknown column 'innodb_log_arch_dir' in 'field list'
38Expected error Unknown column 'innodb_log_arch_dir' in 'field list'
039
=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result'
--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,38 @@
1SELECT @@GLOBAL.innodb_log_arch_expire_sec INTO @save;
2SELECT @@GLOBAL.innodb_log_arch_expire_sec;
3@@GLOBAL.innodb_log_arch_expire_sec
40
50 Expected
6SET @@GLOBAL.innodb_log_arch_expire_sec=1;
7SELECT @@GLOBAL.innodb_log_arch_expire_sec;
8@@GLOBAL.innodb_log_arch_expire_sec
91
101 Expected
11SELECT VARIABLE_VALUE
12FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
13WHERE VARIABLE_NAME='innodb_log_arch_expire_sec';
14VARIABLE_VALUE
151
161 Expected
17SELECT @@innodb_log_arch_expire_sec;
18@@innodb_log_arch_expire_sec
191
201 Expected
21SELECT @@innodb_log_arch_expire_sec;
22@@innodb_log_arch_expire_sec
231
241 Expected
25SELECT @@local.innodb_log_arch_expire_sec;
26ERROR HY000: Variable 'innodb_log_arch_expire_sec' is a GLOBAL variable
27Expected error 'Variable is a GLOBAL variable'
28SELECT @@SESSION.innodb_log_arch_expire_sec;
29ERROR HY000: Variable 'innodb_log_arch_expire_sec' is a GLOBAL variable
30Expected error 'Variable is a GLOBAL variable'
31SELECT @@GLOBAL.innodb_log_arch_expire_sec;
32@@GLOBAL.innodb_log_arch_expire_sec
331
341 Expected
35SELECT innodb_log_arch_expire_sec = @@SESSION.innodb_log_arch_expire_sec;
36ERROR 42S22: Unknown column 'innodb_log_arch_expire_sec' in 'field list'
37Expected error Unknown column 'innodb_log_arch_expire_sec' in 'field list'
38SET @@GLOBAL.innodb_log_arch_expire_sec = @save;
039
=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result'
--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result 2013-03-31 06:25:28 +0000
@@ -0,0 +1,38 @@
1SELECT @@GLOBAL.innodb_log_archive;
2@@GLOBAL.innodb_log_archive
30
40 Expected
5SET @save_innodb_log_archive = @@GLOBAL.innodb_log_archive;
6SET @@GLOBAL.innodb_log_archive=1;
7SELECT @@GLOBAL.innodb_log_archive;
8@@GLOBAL.innodb_log_archive
91
101 Expected
11SELECT VARIABLE_VALUE
12FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
13WHERE VARIABLE_NAME='innodb_log_archive';
14VARIABLE_VALUE
15ON
16ON Expected
17SET @@GLOBAL.innodb_log_archive = @save_innodb_log_archive;
18SELECT @@innodb_log_archive;
19@@innodb_log_archive
200
210 Expected
22SELECT @@innodb_log_archive;
23@@innodb_log_archive
240
250 Expected
26SELECT @@local.innodb_log_archive;
27ERROR HY000: Variable 'innodb_log_archive' is a GLOBAL variable
28Expected error 'Variable is a GLOBAL variable'
29SELECT @@SESSION.innodb_log_archive;
30ERROR HY000: Variable 'innodb_log_archive' is a GLOBAL variable
31Expected error 'Variable is a GLOBAL variable'
32SELECT @@GLOBAL.innodb_log_archive;
33@@GLOBAL.innodb_log_archive
340
350 Expected
36SELECT innodb_log_archive = @@SESSION.innodb_log_archive;
37ERROR 42S22: Unknown column 'innodb_log_archive' in 'field list'
38Expected error Unknown column 'innodb_log_archive' in 'field list'
039
=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test'
--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,60 @@
1#######################################################
2# Basic test for innodb_log_arch_dir variable #
3#######################################################
4
5--source include/have_innodb.inc
6
7####################################################################
8# Displaying default value #
9####################################################################
10SELECT @@GLOBAL.innodb_log_arch_dir;
11--echo NULL Expected
12
13
14####################################################################
15# Check if Value can set #
16####################################################################
17
18--error ER_INCORRECT_GLOBAL_LOCAL_VAR
19SET @@GLOBAL.innodb_log_arch_dir=1;
20--echo Expected error 'Read only variable'
21
22SELECT @@GLOBAL.innodb_log_arch_dir;
23--echo NULL Expected
24
25SELECT VARIABLE_VALUE
26FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
27WHERE VARIABLE_NAME='innodb_log_arch_dir';
28--echo empty string Expected
29
30############################################
31# Check accessing variable without GLOBAL #
32############################################
33SELECT @@innodb_log_arch_dir;
34--echo NULL Expected
35
36
37
38##########################################################################
39# Check if innodb_log_arch_dir can be accessed without @@ sign #
40##########################################################################
41
42SELECT @@innodb_log_arch_dir;
43--echo NULL Expected
44
45--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
46SELECT @@local.innodb_log_arch_dir;
47--echo Expected error 'Variable is a GLOBAL variable'
48
49--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
50SELECT @@SESSION.innodb_log_arch_dir;
51--echo Expected error 'Variable is a GLOBAL variable'
52
53SELECT @@GLOBAL.innodb_log_arch_dir;
54--echo NULL Expected
55
56--Error ER_BAD_FIELD_ERROR
57SELECT innodb_log_arch_dir = @@SESSION.innodb_log_arch_dir;
58--echo Expected error Unknown column 'innodb_log_arch_dir' in 'field list'
59
60
061
=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test'
--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,60 @@
1###############################################################
2# Basic test for innodb_log_arch_expire_sec variable #
3###############################################################
4
5--source include/have_innodb.inc
6
7SELECT @@GLOBAL.innodb_log_arch_expire_sec INTO @save;
8
9####################################################################
10# Displaying default value #
11####################################################################
12SELECT @@GLOBAL.innodb_log_arch_expire_sec;
13--echo 0 Expected
14
15
16####################################################################
17# Check if Value can set #
18####################################################################
19
20SET @@GLOBAL.innodb_log_arch_expire_sec=1;
21
22SELECT @@GLOBAL.innodb_log_arch_expire_sec;
23--echo 1 Expected
24
25SELECT VARIABLE_VALUE
26FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
27WHERE VARIABLE_NAME='innodb_log_arch_expire_sec';
28--echo 1 Expected
29
30############################################
31# Check accessing variable without GLOBAL #
32############################################
33SELECT @@innodb_log_arch_expire_sec;
34--echo 1 Expected
35
36
37
38##################################################################################
39# Check if innodb_log_arch_expire_sec can be accessed without @@ sign #
40##################################################################################
41
42SELECT @@innodb_log_arch_expire_sec;
43--echo 1 Expected
44
45--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
46SELECT @@local.innodb_log_arch_expire_sec;
47--echo Expected error 'Variable is a GLOBAL variable'
48
49--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
50SELECT @@SESSION.innodb_log_arch_expire_sec;
51--echo Expected error 'Variable is a GLOBAL variable'
52
53SELECT @@GLOBAL.innodb_log_arch_expire_sec;
54--echo 1 Expected
55
56--Error ER_BAD_FIELD_ERROR
57SELECT innodb_log_arch_expire_sec = @@SESSION.innodb_log_arch_expire_sec;
58--echo Expected error Unknown column 'innodb_log_arch_expire_sec' in 'field list'
59
60SET @@GLOBAL.innodb_log_arch_expire_sec = @save;
061
=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test'
--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test 2013-03-31 06:25:28 +0000
@@ -0,0 +1,61 @@
1###################################################
2# Basic test for innodb_log_archive variable #
3###################################################
4
5--source include/have_innodb.inc
6
7####################################################################
8# Displaying default value #
9####################################################################
10SELECT @@GLOBAL.innodb_log_archive;
11--echo 0 Expected
12
13
14####################################################################
15# Check if Value can set #
16####################################################################
17
18SET @save_innodb_log_archive = @@GLOBAL.innodb_log_archive;
19SET @@GLOBAL.innodb_log_archive=1;
20
21SELECT @@GLOBAL.innodb_log_archive;
22--echo 1 Expected
23
24SELECT VARIABLE_VALUE
25FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
26WHERE VARIABLE_NAME='innodb_log_archive';
27--echo ON Expected
28
29SET @@GLOBAL.innodb_log_archive = @save_innodb_log_archive;
30
31############################################
32# Check accessing variable without GLOBAL #
33############################################
34SELECT @@innodb_log_archive;
35--echo 0 Expected
36
37
38
39##########################################################################
40# Check if innodb_log_archive can be accessed without @@ sign #
41##########################################################################
42
43SELECT @@innodb_log_archive;
44--echo 0 Expected
45
46--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
47SELECT @@local.innodb_log_archive;
48--echo Expected error 'Variable is a GLOBAL variable'
49
50--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
51SELECT @@SESSION.innodb_log_archive;
52--echo Expected error 'Variable is a GLOBAL variable'
53
54SELECT @@GLOBAL.innodb_log_archive;
55--echo 0 Expected
56
57--Error ER_BAD_FIELD_ERROR
58SELECT innodb_log_archive = @@SESSION.innodb_log_archive;
59--echo Expected error Unknown column 'innodb_log_archive' in 'field list'
60
61
062
=== modified file 'Percona-Server/sql/handler.cc'
--- Percona-Server/sql/handler.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/sql/handler.cc 2013-03-31 06:25:28 +0000
@@ -6867,6 +6867,48 @@
6867 return result;6867 return result;
6868}6868}
68696869
6870static my_bool purge_archive_logs_handlerton(THD *thd, plugin_ref plugin,
6871 void *arg)
6872{
6873 ulong before_timestamp= *(ulong*) arg;
6874 handlerton *hton= plugin_data(plugin, handlerton *);
6875
6876 if (hton->purge_archive_logs == NULL)
6877 return FALSE;
6878
6879 return hton->purge_archive_logs(hton, before_timestamp, NULL);
6880}
6881
6882bool ha_purge_archive_logs(THD *thd, handlerton *db_type, void* args)
6883{
6884 if (db_type == NULL)
6885 return plugin_foreach(thd, purge_archive_logs_handlerton,
6886 MYSQL_STORAGE_ENGINE_PLUGIN, args);
6887
6888 return false;
6889}
6890
6891static my_bool purge_archive_logs_to_handlerton(THD *thd, plugin_ref plugin,
6892 void *arg)
6893{
6894 const char* to_filename= (const char*) arg;
6895 handlerton *hton= plugin_data(plugin, handlerton *);
6896
6897 if (hton->purge_archive_logs == NULL)
6898 return FALSE;
6899
6900 return hton->purge_archive_logs(hton, 0, to_filename);
6901}
6902
6903bool ha_purge_archive_logs_to(THD *thd, handlerton *db_type, void* args)
6904{
6905 if (db_type == NULL)
6906 return plugin_foreach(thd, purge_archive_logs_to_handlerton,
6907 MYSQL_STORAGE_ENGINE_PLUGIN, args);
6908
6909 return false;
6910}
6911
6870/*6912/*
6871 Function to check if the conditions for row-based binlogging is6913 Function to check if the conditions for row-based binlogging is
6872 correct for the table.6914 correct for the table.
68736915
=== modified file 'Percona-Server/sql/handler.h'
--- Percona-Server/sql/handler.h 2013-03-05 12:46:43 +0000
+++ Percona-Server/sql/handler.h 2013-03-31 06:25:28 +0000
@@ -881,6 +881,9 @@
881 int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, 881 int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables,
882 class Item *cond, 882 class Item *cond,
883 enum enum_schema_tables);883 enum enum_schema_tables);
884 bool (*purge_archive_logs)(handlerton *hton, time_t before_date,
885 const char* to_filename);
886
884 uint32 flags; /* global handler flags */887 uint32 flags; /* global handler flags */
885 /*888 /*
886 Those handlerton functions below are properly initialized at handler889 Those handlerton functions below are properly initialized at handler
@@ -3375,6 +3378,11 @@
3375int ha_prepare(THD *thd);3378int ha_prepare(THD *thd);
3376int ha_recover(HASH *commit_list);3379int ha_recover(HASH *commit_list);
33773380
3381/* remove old archived transaction logs files */
3382bool ha_purge_archive_logs(THD *thd, handlerton *db_type, void* args);
3383bool ha_purge_archive_logs_to(THD *thd, handlerton *db_type, void* args);
3384
3385
3378/*3386/*
3379 transactions: interface to low-level handlerton functions. These are3387 transactions: interface to low-level handlerton functions. These are
3380 intended to be used by the transaction coordinators to3388 intended to be used by the transaction coordinators to
33813389
=== modified file 'Percona-Server/sql/lex.h'
--- Percona-Server/sql/lex.h 2013-03-05 12:46:43 +0000
+++ Percona-Server/sql/lex.h 2013-03-31 06:25:28 +0000
@@ -69,6 +69,7 @@
69 { "ANALYZE", SYM(ANALYZE_SYM)}, // this one is for ANALYZE TABLE etc69 { "ANALYZE", SYM(ANALYZE_SYM)}, // this one is for ANALYZE TABLE etc
70 { "AND", SYM(AND_SYM)},70 { "AND", SYM(AND_SYM)},
71 { "ANY", SYM(ANY_SYM)},71 { "ANY", SYM(ANY_SYM)},
72 { "ARCHIVED", SYM(ARCHIVED_SYM)},
72 { "AS", SYM(AS)},73 { "AS", SYM(AS)},
73 { "ASC", SYM(ASC)},74 { "ASC", SYM(ASC)},
74 { "ASCII", SYM(ASCII_SYM)},75 { "ASCII", SYM(ASCII_SYM)},
7576
=== modified file 'Percona-Server/sql/mysqld.cc'
--- Percona-Server/sql/mysqld.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/sql/mysqld.cc 2013-03-31 06:25:28 +0000
@@ -3418,6 +3418,8 @@
3418 {"prepare_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PREPARE]), SHOW_LONG_STATUS},3418 {"prepare_sql", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PREPARE]), SHOW_LONG_STATUS},
3419 {"purge", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE]), SHOW_LONG_STATUS},3419 {"purge", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE]), SHOW_LONG_STATUS},
3420 {"purge_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_BEFORE]), SHOW_LONG_STATUS},3420 {"purge_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_BEFORE]), SHOW_LONG_STATUS},
3421 {"purge_archived", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_ARCHIVE]), SHOW_LONG_STATUS},
3422 {"purge_archived_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_ARCHIVE_BEFORE]), SHOW_LONG_STATUS},
3421 {"release_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS},3423 {"release_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS},
3422 {"rename_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS},3424 {"rename_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS},
3423 {"rename_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_USER]), SHOW_LONG_STATUS},3425 {"rename_user", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_USER]), SHOW_LONG_STATUS},
34243426
=== modified file 'Percona-Server/sql/sql_cmd.h'
--- Percona-Server/sql/sql_cmd.h 2012-12-04 08:24:59 +0000
+++ Percona-Server/sql/sql_cmd.h 2013-03-31 06:25:28 +0000
@@ -89,6 +89,8 @@
89 SQLCOM_SHOW_RELAYLOG_EVENTS,89 SQLCOM_SHOW_RELAYLOG_EVENTS,
90 SQLCOM_GET_DIAGNOSTICS,90 SQLCOM_GET_DIAGNOSTICS,
91 SQLCOM_ALTER_USER,91 SQLCOM_ALTER_USER,
92 SQLCOM_PURGE_ARCHIVE,
93 SQLCOM_PURGE_ARCHIVE_BEFORE,
92 /*94 /*
93 When a command is added here, be sure it's also added in mysqld.cc95 When a command is added here, be sure it's also added in mysqld.cc
94 in "struct show_var_st status_vars[]= {" ...96 in "struct show_var_st status_vars[]= {" ...
9597
=== modified file 'Percona-Server/sql/sql_parse.cc'
--- Percona-Server/sql/sql_parse.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/sql/sql_parse.cc 2013-03-31 06:25:28 +0000
@@ -2655,6 +2655,49 @@
2655 res = purge_master_logs_before_date(thd, (ulong)it->val_int());2655 res = purge_master_logs_before_date(thd, (ulong)it->val_int());
2656 break;2656 break;
2657 }2657 }
2658 case SQLCOM_PURGE_ARCHIVE:
2659 {
2660 if (check_global_access(thd, SUPER_ACL))
2661 goto error;
2662 /* PURGE ARCHIVED LOGS TO 'file' */
2663 if (!ha_purge_archive_logs_to(NULL, NULL, lex->to_log)) {
2664 my_ok(thd);
2665 } else {
2666 my_error(ER_LOG_PURGE_UNKNOWN_ERR, MYF(0), "PURGE ARCHIVE LOGS TO");
2667 goto error;
2668 }
2669
2670 break;
2671 }
2672 case SQLCOM_PURGE_ARCHIVE_BEFORE:
2673 {
2674 Item *it;
2675
2676 if (check_global_access(thd, SUPER_ACL))
2677 goto error;
2678 /* PURGE ARCHIVE LOGS BEFORE 'data' */
2679 it= (Item *)lex->value_list.head();
2680 if ((!it->fixed && it->fix_fields(lex->thd, &it)) ||
2681 it->check_cols(1))
2682 {
2683 my_error(ER_WRONG_ARGUMENTS, MYF(0), "PURGE ARCHIVE LOGS BEFORE");
2684 goto error;
2685 }
2686 it= new Item_func_unix_timestamp(it);
2687 /*
2688 it is OK only emulate fix_fieds, because we need only
2689 value of constant
2690 */
2691 it->quick_fix_field();
2692 ulong before_timestamp = (ulong)it->val_int();
2693 if (!ha_purge_archive_logs(NULL, NULL, &before_timestamp )) {
2694 my_ok(thd);
2695 } else {
2696 my_error(ER_LOG_PURGE_UNKNOWN_ERR, MYF(0), "PURGE ARCHIVE LOGS BEFORE");
2697 goto error;
2698 }
2699 break;
2700 }
2658#endif2701#endif
2659 case SQLCOM_SHOW_WARNS:2702 case SQLCOM_SHOW_WARNS:
2660 {2703 {
26612704
=== modified file 'Percona-Server/sql/sql_yacc.yy'
--- Percona-Server/sql/sql_yacc.yy 2013-03-05 12:46:43 +0000
+++ Percona-Server/sql/sql_yacc.yy 2013-03-31 06:25:28 +0000
@@ -1064,6 +1064,7 @@
1064%token AND_AND_SYM /* OPERATOR */1064%token AND_AND_SYM /* OPERATOR */
1065%token AND_SYM /* SQL-2003-R */1065%token AND_SYM /* SQL-2003-R */
1066%token ANY_SYM /* SQL-2003-R */1066%token ANY_SYM /* SQL-2003-R */
1067%token ARCHIVED_SYM /* MYSQL */
1067%token AS /* SQL-2003-R */1068%token AS /* SQL-2003-R */
1068%token ASC /* SQL-2003-N */1069%token ASC /* SQL-2003-N */
1069%token ASCII_SYM /* MYSQL-FUNC */1070%token ASCII_SYM /* MYSQL-FUNC */
@@ -12942,7 +12943,8 @@
12942 ;12943 ;
1294312944
12944purge_options:12945purge_options:
12945 master_or_binary LOGS_SYM purge_option12946 ARCHIVED_SYM LOGS_SYM purge_archive_option
12947 | master_or_binary LOGS_SYM purge_option
12946 ;12948 ;
1294712949
12948purge_option:12950purge_option:
@@ -12959,6 +12961,21 @@
12959 }12961 }
12960 ;12962 ;
1296112963
12964purge_archive_option:
12965 TO_SYM TEXT_STRING_sys
12966 {
12967 Lex->to_log = $2.str;
12968 Lex->sql_command= SQLCOM_PURGE_ARCHIVE;
12969 }
12970 | BEFORE_SYM expr
12971 {
12972 LEX *lex= Lex;
12973 lex->value_list.empty();
12974 lex->value_list.push_front($2);
12975 lex->sql_command= SQLCOM_PURGE_ARCHIVE_BEFORE;
12976 }
12977 ;
12978
12962/* kill threads */12979/* kill threads */
1296312980
12964kill:12981kill:
@@ -14080,6 +14097,7 @@
14080 | AGGREGATE_SYM {}14097 | AGGREGATE_SYM {}
14081 | ALGORITHM_SYM {}14098 | ALGORITHM_SYM {}
14082 | ANALYSE_SYM {}14099 | ANALYSE_SYM {}
14100 | ARCHIVED_SYM {}
14083 | ANY_SYM {}14101 | ANY_SYM {}
14084 | AT_SYM {}14102 | AT_SYM {}
14085 | AUTO_INC {}14103 | AUTO_INC {}
1408614104
=== modified file 'Percona-Server/storage/innobase/fil/fil0fil.cc'
--- Percona-Server/storage/innobase/fil/fil0fil.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/fil/fil0fil.cc 2013-03-31 06:25:28 +0000
@@ -1211,6 +1211,39 @@
12111211
1212 mutex_exit(&fil_system->mutex);1212 mutex_exit(&fil_system->mutex);
1213}1213}
1214
1215/****************************************************************//**
1216Check is there node in file space with given name. */
1217UNIV_INTERN
1218ibool
1219fil_space_contains_node(
1220/*====================*/
1221 ulint id, /*!< in: space id */
1222 char* node_name) /*!< in: node name */
1223{
1224 fil_node_t* node;
1225 fil_space_t* space;
1226
1227 mutex_enter(&fil_system->mutex);
1228
1229 space = fil_space_get_by_id(id);
1230
1231 ut_a(space);
1232
1233 for (node = UT_LIST_GET_FIRST(space->chain); node != NULL;
1234 node = UT_LIST_GET_NEXT(chain, node)) {
1235
1236 if (ut_strcmp(node->name, node_name) == 0) {
1237 mutex_exit(&fil_system->mutex);
1238 return(TRUE);
1239 }
1240
1241 }
1242
1243 mutex_exit(&fil_system->mutex);
1244 return(FALSE);
1245}
1246
1214#endif /* UNIV_LOG_ARCHIVE */1247#endif /* UNIV_LOG_ARCHIVE */
12151248
1216/*******************************************************************//**1249/*******************************************************************//**
@@ -1942,12 +1975,6 @@
1942 contain sensible data */1975 contain sensible data */
1943 ulint* flags, /*!< out: tablespace flags */1976 ulint* flags, /*!< out: tablespace flags */
1944 ulint* space_id, /*!< out: tablespace ID */1977 ulint* space_id, /*!< out: tablespace ID */
1945#ifdef UNIV_LOG_ARCHIVE
1946 ulint* min_arch_log_no, /*!< out: min of archived
1947 log numbers in data files */
1948 ulint* max_arch_log_no, /*!< out: max of archived
1949 log numbers in data files */
1950#endif /* UNIV_LOG_ARCHIVE */
1951 lsn_t* min_flushed_lsn, /*!< out: min of flushed1978 lsn_t* min_flushed_lsn, /*!< out: min of flushed
1952 lsn values in data files */1979 lsn values in data files */
1953 lsn_t* max_flushed_lsn) /*!< out: max of flushed1980 lsn_t* max_flushed_lsn) /*!< out: max of flushed
@@ -1976,10 +2003,7 @@
1976 if (!one_read_already) {2003 if (!one_read_already) {
1977 *min_flushed_lsn = flushed_lsn;2004 *min_flushed_lsn = flushed_lsn;
1978 *max_flushed_lsn = flushed_lsn;2005 *max_flushed_lsn = flushed_lsn;
1979#ifdef UNIV_LOG_ARCHIVE2006
1980 *min_arch_log_no = arch_log_no;
1981 *max_arch_log_no = arch_log_no;
1982#endif /* UNIV_LOG_ARCHIVE */
1983 return;2007 return;
1984 }2008 }
19852009
@@ -1989,14 +2013,6 @@
1989 if (*max_flushed_lsn < flushed_lsn) {2013 if (*max_flushed_lsn < flushed_lsn) {
1990 *max_flushed_lsn = flushed_lsn;2014 *max_flushed_lsn = flushed_lsn;
1991 }2015 }
1992#ifdef UNIV_LOG_ARCHIVE
1993 if (*min_arch_log_no > arch_log_no) {
1994 *min_arch_log_no = arch_log_no;
1995 }
1996 if (*max_arch_log_no < arch_log_no) {
1997 *max_arch_log_no = arch_log_no;
1998 }
1999#endif /* UNIV_LOG_ARCHIVE */
2000}2016}
20012017
2002/*================ SINGLE-TABLE TABLESPACES ==========================*/2018/*================ SINGLE-TABLE TABLESPACES ==========================*/
@@ -3499,9 +3515,6 @@
3499 lsn_t lsn; /*!< Flushed LSN from header page */3515 lsn_t lsn; /*!< Flushed LSN from header page */
3500 ulint id; /*!< Space ID */3516 ulint id; /*!< Space ID */
3501 ulint flags; /*!< Tablespace flags */3517 ulint flags; /*!< Tablespace flags */
3502#ifdef UNIV_LOG_ARCHIVE
3503 ulint arch_log_no; /*!< latest archived log file number */
3504#endif /* UNIV_LOG_ARCHIVE */
3505};3518};
35063519
3507/********************************************************************//**3520/********************************************************************//**
@@ -3637,9 +3650,6 @@
3637 if (def.success) {3650 if (def.success) {
3638 fil_read_first_page(3651 fil_read_first_page(
3639 def.file, FALSE, &def.flags, &def.id,3652 def.file, FALSE, &def.flags, &def.id,
3640#ifdef UNIV_LOG_ARCHIVE
3641 &space_arch_log_no, &space_arch_log_no,
3642#endif /* UNIV_LOG_ARCHIVE */
3643 &def.lsn, &def.lsn);3653 &def.lsn, &def.lsn);
36443654
3645 /* Validate this single-table-tablespace with SYS_TABLES,3655 /* Validate this single-table-tablespace with SYS_TABLES,
@@ -3661,9 +3671,6 @@
3661 if (remote.success) {3671 if (remote.success) {
3662 fil_read_first_page(3672 fil_read_first_page(
3663 remote.file, FALSE, &remote.flags, &remote.id,3673 remote.file, FALSE, &remote.flags, &remote.id,
3664#ifdef UNIV_LOG_ARCHIVE
3665 &remote.arch_log_no, &remote.arch_log_no,
3666#endif /* UNIV_LOG_ARCHIVE */
3667 &remote.lsn, &remote.lsn);3674 &remote.lsn, &remote.lsn);
36683675
3669 /* Validate this single-table-tablespace with SYS_TABLES,3676 /* Validate this single-table-tablespace with SYS_TABLES,
@@ -3686,9 +3693,6 @@
3686 if (dict.success) {3693 if (dict.success) {
3687 fil_read_first_page(3694 fil_read_first_page(
3688 dict.file, FALSE, &dict.flags, &dict.id,3695 dict.file, FALSE, &dict.flags, &dict.id,
3689#ifdef UNIV_LOG_ARCHIVE
3690 &dict.arch_log_no, &dict.arch_log_no,
3691#endif /* UNIV_LOG_ARCHIVE */
3692 &dict.lsn, &dict.lsn);3696 &dict.lsn, &dict.lsn);
36933697
3694 /* Validate this single-table-tablespace with SYS_TABLES,3698 /* Validate this single-table-tablespace with SYS_TABLES,
@@ -3916,9 +3920,6 @@
3916{3920{
3917 fil_read_first_page(3921 fil_read_first_page(
3918 fsp->file, FALSE, &fsp->flags, &fsp->id,3922 fsp->file, FALSE, &fsp->flags, &fsp->id,
3919#ifdef UNIV_LOG_ARCHIVE
3920 &fsp->arch_log_no, &fsp->arch_log_no,
3921#endif /* UNIV_LOG_ARCHIVE */
3922 &fsp->lsn, &fsp->lsn);3923 &fsp->lsn, &fsp->lsn);
39233924
3924 if (fsp->id == ULINT_UNDEFINED || fsp->id == 0) {3925 if (fsp->id == ULINT_UNDEFINED || fsp->id == 0) {
39253926
=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-03-31 06:25:28 +0000
@@ -989,6 +989,32 @@
989 name to lower case */989 name to lower case */
990990
991/*************************************************************//**991/*************************************************************//**
992Removes old archived transaction log files.
993@return true on error */
994static bool innobase_purge_archive_logs(
995 handlerton *hton, /*!< in: InnoDB handlerton */
996 time_t before_date, /*!< in: all files modified
997 before timestamp should be removed */
998 const char* to_filename) /*!< in: this and earler files
999 should be removed */
1000{
1001 ulint err= DB_ERROR;
1002 if (before_date > 0) {
1003 err= purge_archived_logs(before_date, 0);
1004 } else if (to_filename) {
1005 if (is_prefix(to_filename, IB_ARCHIVED_LOGS_PREFIX)) {
1006 unsigned long long log_file_lsn = strtoll(to_filename
1007 + IB_ARCHIVED_LOGS_PREFIX_LEN,
1008 NULL, 10);
1009 if (log_file_lsn > 0 && log_file_lsn < ULLONG_MAX) {
1010 err= purge_archived_logs(0, log_file_lsn);
1011 }
1012 }
1013 }
1014 return (err != DB_SUCCESS);
1015}
1016
1017/*************************************************************//**
992Check for a valid value of innobase_commit_concurrency.1018Check for a valid value of innobase_commit_concurrency.
993@return 0 for valid innodb_commit_concurrency */1019@return 0 for valid innodb_commit_concurrency */
994static1020static
@@ -2760,6 +2786,7 @@
27602786
2761 innobase_hton->release_temporary_latches =2787 innobase_hton->release_temporary_latches =
2762 innobase_release_temporary_latches;2788 innobase_release_temporary_latches;
2789 innobase_hton->purge_archive_logs = innobase_purge_archive_logs;
27632790
2764 innobase_hton->data = &innodb_api_cb;2791 innobase_hton->data = &innodb_api_cb;
27652792
@@ -2862,12 +2889,9 @@
2862 }2889 }
28632890
2864#ifdef UNIV_LOG_ARCHIVE2891#ifdef UNIV_LOG_ARCHIVE
2865 /* Since innodb_log_arch_dir has no relevance under MySQL,2892 if (!innobase_log_arch_dir) {
2866 starting from 4.0.6 we always set it the same as2893 innobase_log_arch_dir = srv_log_group_home_dir;
2867 innodb_log_group_home_dir: */2894 }
2868
2869 innobase_log_arch_dir = innobase_log_group_home_dir;
2870
2871 srv_arch_dir = innobase_log_arch_dir;2895 srv_arch_dir = innobase_log_arch_dir;
2872#endif /* UNIG_LOG_ARCHIVE */2896#endif /* UNIG_LOG_ARCHIVE */
28732897
@@ -13684,6 +13708,45 @@
13684}13708}
1368513709
13686/****************************************************************//**13710/****************************************************************//**
13711Update the system variable innodb_log_arch_expire_sec using
13712the "saved" value. This function is registered as a callback with MySQL. */
13713static
13714void
13715innodb_log_archive_expire_update(
13716/*==============================*/
13717 THD* thd, /*!< in: thread handle */
13718 struct st_mysql_sys_var* var, /*!< in: pointer to
13719 system variable */
13720 void* var_ptr, /*!< out: unused */
13721 const void* save) /*!< in: immediate result
13722 from check function */
13723{
13724 srv_log_arch_expire_sec = *(ulint*) save;
13725}
13726
13727static
13728void
13729innodb_log_archive_update(
13730/*======================*/
13731 THD* thd,
13732 struct st_mysql_sys_var* var,
13733 void* var_ptr,
13734 const void* save)
13735{
13736 my_bool in_val = *static_cast<const my_bool*>(save);
13737
13738 if (in_val) {
13739 /* turn archiving on */
13740 srv_log_archive_on = innobase_log_archive = 1;
13741 log_archive_archivelog();
13742 } else {
13743 /* turn archivng off */
13744 srv_log_archive_on = innobase_log_archive = 0;
13745 log_archive_noarchivelog();
13746 }
13747}
13748
13749/****************************************************************//**
13687Update the system variable innodb_max_dirty_pages_pct using the "saved"13750Update the system variable innodb_max_dirty_pages_pct using the "saved"
13688value. This function is registered as a callback with MySQL. */13751value. This function is registered as a callback with MySQL. */
13689static13752static
@@ -15486,14 +15549,20 @@
15486 "Where full logs should be archived.", NULL, NULL, NULL);15549 "Where full logs should be archived.", NULL, NULL, NULL);
1548715550
15488static MYSQL_SYSVAR_BOOL(log_archive, innobase_log_archive,15551static MYSQL_SYSVAR_BOOL(log_archive, innobase_log_archive,
15489 PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,15552 PLUGIN_VAR_OPCMDARG,
15490 "Set to 1 if you want to have logs archived.", NULL, NULL, FALSE);15553 "Set to 1 if you want to have logs archived.",
15554 NULL, innodb_log_archive_update, FALSE);
15491#endif /* UNIV_LOG_ARCHIVE */15555#endif /* UNIV_LOG_ARCHIVE */
1549215556
15493static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir,15557static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir,
15494 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,15558 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
15495 "Path to InnoDB log files.", NULL, NULL, NULL);15559 "Path to InnoDB log files.", NULL, NULL, NULL);
1549615560
15561static MYSQL_SYSVAR_ULONG(log_arch_expire_sec,
15562 srv_log_arch_expire_sec, PLUGIN_VAR_OPCMDARG,
15563 "Expiration time for archived innodb transaction logs.",
15564 NULL, innodb_log_archive_expire_update, 0, 0, ~0L, 0);
15565
15497static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,15566static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
15498 PLUGIN_VAR_RQCMDARG,15567 PLUGIN_VAR_RQCMDARG,
15499 "Percentage of dirty pages allowed in bufferpool.",15568 "Percentage of dirty pages allowed in bufferpool.",
@@ -16140,6 +16209,7 @@
16140#ifdef UNIV_LOG_ARCHIVE16209#ifdef UNIV_LOG_ARCHIVE
16141 MYSQL_SYSVAR(log_arch_dir),16210 MYSQL_SYSVAR(log_arch_dir),
16142 MYSQL_SYSVAR(log_archive),16211 MYSQL_SYSVAR(log_archive),
16212 MYSQL_SYSVAR(log_arch_expire_sec),
16143#endif /* UNIV_LOG_ARCHIVE */16213#endif /* UNIV_LOG_ARCHIVE */
16144 MYSQL_SYSVAR(page_size),16214 MYSQL_SYSVAR(page_size),
16145 MYSQL_SYSVAR(log_buffer_size),16215 MYSQL_SYSVAR(log_buffer_size),
1614616216
=== modified file 'Percona-Server/storage/innobase/include/fil0fil.h'
--- Percona-Server/storage/innobase/include/fil0fil.h 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/include/fil0fil.h 2013-03-31 06:25:28 +0000
@@ -229,6 +229,14 @@
229 ulint trunc_len); /*!< in: truncate by this much; it is an error229 ulint trunc_len); /*!< in: truncate by this much; it is an error
230 if this does not equal to the combined size of230 if this does not equal to the combined size of
231 some initial files in the space */231 some initial files in the space */
232/****************************************************************//**
233Check is there node in file space with given name. */
234UNIV_INTERN
235ibool
236fil_space_contains_node(
237/*====================*/
238 ulint id, /*!< in: space id */
239 char* node_name); /*!< in: node name */
232#endif /* UNIV_LOG_ARCHIVE */240#endif /* UNIV_LOG_ARCHIVE */
233/*******************************************************************//**241/*******************************************************************//**
234Creates a space memory object and puts it to the 'fil system' hash table.242Creates a space memory object and puts it to the 'fil system' hash table.
@@ -371,12 +379,6 @@
371 contain sensible data */379 contain sensible data */
372 ulint* flags, /*!< out: tablespace flags */380 ulint* flags, /*!< out: tablespace flags */
373 ulint* space_id, /*!< out: tablespace ID */381 ulint* space_id, /*!< out: tablespace ID */
374#ifdef UNIV_LOG_ARCHIVE
375 ulint* min_arch_log_no, /*!< out: min of archived
376 log numbers in data files */
377 ulint* max_arch_log_no, /*!< out: max of archived
378 log numbers in data files */
379#endif /* UNIV_LOG_ARCHIVE */
380 lsn_t* min_flushed_lsn, /*!< out: min of flushed382 lsn_t* min_flushed_lsn, /*!< out: min of flushed
381 lsn values in data files */383 lsn values in data files */
382 lsn_t* max_flushed_lsn); /*!< out: max of flushed384 lsn_t* max_flushed_lsn); /*!< out: max of flushed
383385
=== modified file 'Percona-Server/storage/innobase/include/log0log.h'
--- Percona-Server/storage/innobase/include/log0log.h 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/include/log0log.h 2013-03-31 06:25:28 +0000
@@ -70,6 +70,10 @@
70/** Maximum number of log groups in log_group_t::checkpoint_buf */70/** Maximum number of log groups in log_group_t::checkpoint_buf */
71#define LOG_MAX_N_GROUPS 3271#define LOG_MAX_N_GROUPS 32
7272
73#define IB_ARCHIVED_LOGS_PREFIX "ib_log_archive_"
74#define IB_ARCHIVED_LOGS_PREFIX_LEN (sizeof(IB_ARCHIVED_LOGS_PREFIX) - 1)
75#define IB_ARCHIVED_LOGS_SERIAL_LEN 20
76
73/*******************************************************************//**77/*******************************************************************//**
74Calculates where in log files we find a specified lsn.78Calculates where in log files we find a specified lsn.
75@return log file number */79@return log file number */
@@ -283,8 +287,7 @@
283/*==============================*/287/*==============================*/
284 const byte* buf, /*!< in: buffer containing checkpoint info */288 const byte* buf, /*!< in: buffer containing checkpoint info */
285 ulint n, /*!< in: nth slot */289 ulint n, /*!< in: nth slot */
286 ulint* file_no,/*!< out: archived file number */290 lsn_t* file_no);/*!< out: archived file number */
287 ulint* offset);/*!< out: archived file offset */
288/******************************************************//**291/******************************************************//**
289Writes checkpoint info to groups. */292Writes checkpoint info to groups. */
290UNIV_INTERN293UNIV_INTERN
@@ -340,8 +343,18 @@
340log_archived_file_name_gen(343log_archived_file_name_gen(
341/*=======================*/344/*=======================*/
342 char* buf, /*!< in: buffer where to write */345 char* buf, /*!< in: buffer where to write */
346 ulint buf_len,/*!< in: buffer length */
343 ulint id, /*!< in: group id */347 ulint id, /*!< in: group id */
344 ulint file_no);/*!< in: file number */348 lsn_t file_no);/*!< in: file number */
349
350UNIV_INTERN
351void
352log_archived_get_offset(
353/*====================*/
354 log_group_t* group, /*!< in: log group */
355 lsn_t file_no, /*!< in: archive log file number */
356 lsn_t archived_lsn, /*!< in: last archived LSN */
357 lsn_t* offset); /*!< out: offset within archived file */
345#else /* !UNIV_HOTBACKUP */358#else /* !UNIV_HOTBACKUP */
346/******************************************************//**359/******************************************************//**
347Writes info to a buffer of a log group when log files are created in360Writes info to a buffer of a log group when log files are created in
@@ -736,19 +749,19 @@
736 ulint archive_space_id;/*!< file space which749 ulint archive_space_id;/*!< file space which
737 implements the log group750 implements the log group
738 archive */751 archive */
739 ulint archived_file_no;/*!< file number corresponding to752 lsn_t archived_file_no;/*!< file number corresponding to
740 log_sys->archived_lsn */753 log_sys->archived_lsn */
741 ulint archived_offset;/*!< file offset corresponding to754 lsn_t archived_offset;/*!< file offset corresponding to
742 log_sys->archived_lsn, 0 if we have755 log_sys->archived_lsn, 0 if we have
743 not yet written to the archive file756 not yet written to the archive file
744 number archived_file_no */757 number archived_file_no */
745 ulint next_archived_file_no;/*!< during an archive write,758 lsn_t next_archived_file_no;/*!< during an archive write,
746 until the write is completed, we759 until the write is completed, we
747 store the next value for760 store the next value for
748 archived_file_no here: the write761 archived_file_no here: the write
749 completion function then sets the new762 completion function then sets the new
750 value to ..._file_no */763 value to ..._file_no */
751 ulint next_archived_offset; /*!< like the preceding field */764 lsn_t next_archived_offset; /*!< like the preceding field */
752#endif /* UNIV_LOG_ARCHIVE */765#endif /* UNIV_LOG_ARCHIVE */
753 /*-----------------------------*/766 /*-----------------------------*/
754 lsn_t scanned_lsn; /*!< used only in recovery: recovery scan767 lsn_t scanned_lsn; /*!< used only in recovery: recovery scan
755768
=== modified file 'Percona-Server/storage/innobase/include/log0recv.h'
--- Percona-Server/storage/innobase/include/log0recv.h 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/include/log0recv.h 2013-03-31 06:25:28 +0000
@@ -297,14 +297,14 @@
297Recovers from archived log files, and also from log files, if they exist.297Recovers from archived log files, and also from log files, if they exist.
298@return error code or DB_SUCCESS */298@return error code or DB_SUCCESS */
299UNIV_INTERN299UNIV_INTERN
300ulint300dberr_t
301recv_recovery_from_archive_start(301recv_recovery_from_archive_start(
302/*=============================*/302/*=============================*/
303 lsn_t min_flushed_lsn,/*!< in: min flushed lsn field from the303 lsn_t min_flushed_lsn,/*!< in: min flushed lsn field from the
304 data files */304 data files */
305 lsn_t limit_lsn, /*!< in: recover up to this lsn if305 lsn_t limit_lsn, /*!< in: recover up to this lsn if
306 possible */306 possible */
307 ulint first_log_no); /*!< in: number of the first archived307 lsn_t first_log_no); /*!< in: number of the first archived
308 log file to use in the recovery; the308 log file to use in the recovery; the
309 file will be searched from309 file will be searched from
310 INNOBASE_LOG_ARCH_DIR specified in310 INNOBASE_LOG_ARCH_DIR specified in
311311
=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
--- Percona-Server/storage/innobase/include/srv0srv.h 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/include/srv0srv.h 2013-03-31 06:25:28 +0000
@@ -348,6 +348,8 @@
348extern ulong srv_doublewrite_batch_size;348extern ulong srv_doublewrite_batch_size;
349extern ulong srv_checksum_algorithm;349extern ulong srv_checksum_algorithm;
350350
351extern ulong srv_log_arch_expire_sec;
352
351extern ulong srv_max_buf_pool_modified_pct;353extern ulong srv_max_buf_pool_modified_pct;
352extern ulong srv_max_purge_lag;354extern ulong srv_max_purge_lag;
353extern ulong srv_max_purge_lag_delay;355extern ulong srv_max_purge_lag_delay;
@@ -651,6 +653,18 @@
651void653void
652srv_export_innodb_status(void);654srv_export_innodb_status(void);
653/*==========================*/655/*==========================*/
656/*************************************************************//**
657Removes old archived transaction log files.
658Both parameters couldn't be provided at the same time.
659@return DB_SUCCESS on success, otherwise DB_ERROR */
660UNIV_INTERN
661dberr_t
662purge_archived_logs(
663 time_t before_date, /*!< in: all files modified
664 before timestamp should be removed */
665 lsn_t before_lsn); /*!< in: files with this lsn in name
666 and earler should be removed */
667/*==========================*/
654/*******************************************************************//**668/*******************************************************************//**
655Get current server activity count. We don't hold srv_sys::mutex while669Get current server activity count. We don't hold srv_sys::mutex while
656reading this value as it is only used in heuristics.670reading this value as it is only used in heuristics.
657671
=== modified file 'Percona-Server/storage/innobase/include/univ.i'
--- Percona-Server/storage/innobase/include/univ.i 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/include/univ.i 2013-03-31 06:25:28 +0000
@@ -46,6 +46,9 @@
46#define INNODB_VERSION_MINOR 246#define INNODB_VERSION_MINOR 2
47#define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH47#define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH
4848
49/* Enable UNIV_LOG_ARCHIVE in XtraDB */
50#define UNIV_LOG_ARCHIVE 1
51
49/* The following is the InnoDB version as shown in52/* The following is the InnoDB version as shown in
50SELECT plugin_version FROM information_schema.plugins;53SELECT plugin_version FROM information_schema.plugins;
51calculated in make_version_string() in sql/sql_show.cc like this:54calculated in make_version_string() in sql/sql_show.cc like this:
5255
=== modified file 'Percona-Server/storage/innobase/log/log0log.cc'
--- Percona-Server/storage/innobase/log/log0log.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/log/log0log.cc 2013-03-31 06:25:28 +0000
@@ -817,15 +817,11 @@
817 rw_lock_create(archive_lock_key, &log_sys->archive_lock,817 rw_lock_create(archive_lock_key, &log_sys->archive_lock,
818 SYNC_NO_ORDER_CHECK);818 SYNC_NO_ORDER_CHECK);
819819
820 log_sys->archive_buf = NULL;820 log_sys->archive_buf = static_cast<byte*>(
821821 ut_align(mem_zalloc(LOG_ARCHIVE_BUF_SIZE
822 /* ut_align(822 + OS_FILE_LOG_BLOCK_SIZE),
823 ut_malloc(LOG_ARCHIVE_BUF_SIZE823 OS_FILE_LOG_BLOCK_SIZE));
824 + OS_FILE_LOG_BLOCK_SIZE),824 log_sys->archive_buf_size = LOG_ARCHIVE_BUF_SIZE;
825 OS_FILE_LOG_BLOCK_SIZE); */
826 log_sys->archive_buf_size = 0;
827
828 /* memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE); */
829825
830 log_sys->archiving_on = os_event_create();826 log_sys->archiving_on = os_event_create();
831#endif /* UNIV_LOG_ARCHIVE */827#endif /* UNIV_LOG_ARCHIVE */
@@ -896,10 +892,10 @@
896 mem_zalloc(sizeof(byte**) * n_files));892 mem_zalloc(sizeof(byte**) * n_files));
897893
898#ifdef UNIV_LOG_ARCHIVE894#ifdef UNIV_LOG_ARCHIVE
899 group->archive_file_header_bufs_ptr = static_cast<byte*>(895 group->archive_file_header_bufs_ptr = static_cast<byte**>(
900 mem_zalloc( sizeof(byte*) * n_files));896 mem_zalloc( sizeof(byte*) * n_files));
901897
902 group->archive_file_header_bufs = static_cast<byte*>(898 group->archive_file_header_bufs = static_cast<byte**>(
903 mem_zalloc(sizeof(byte*) * n_files));899 mem_zalloc(sizeof(byte*) * n_files));
904#endif /* UNIV_LOG_ARCHIVE */900#endif /* UNIV_LOG_ARCHIVE */
905901
@@ -924,7 +920,7 @@
924#ifdef UNIV_LOG_ARCHIVE920#ifdef UNIV_LOG_ARCHIVE
925 group->archive_space_id = archive_space_id;921 group->archive_space_id = archive_space_id;
926922
927 group->archived_file_no = 0;923 group->archived_file_no = LOG_START_LSN;
928 group->archived_offset = 0;924 group->archived_offset = 0;
929#endif /* UNIV_LOG_ARCHIVE */925#endif /* UNIV_LOG_ARCHIVE */
930926
@@ -1708,15 +1704,13 @@
1708/*==============================*/1704/*==============================*/
1709 byte* buf, /*!< in: buffer for checkpoint info */1705 byte* buf, /*!< in: buffer for checkpoint info */
1710 ulint n, /*!< in: nth slot */1706 ulint n, /*!< in: nth slot */
1711 ulint file_no,/*!< in: archived file number */1707 lsn_t file_no)/*!< in: archived file number */
1712 ulint offset) /*!< in: archived file offset */
1713{1708{
1714 ut_ad(n < LOG_MAX_N_GROUPS);1709 ut_ad(n < LOG_MAX_N_GROUPS);
17151710
1716 mach_write_to_4(buf + LOG_CHECKPOINT_GROUP_ARRAY1711 mach_write_to_8(buf + LOG_CHECKPOINT_GROUP_ARRAY +
1717 + 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO, file_no);1712 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO,
1718 mach_write_to_4(buf + LOG_CHECKPOINT_GROUP_ARRAY1713 file_no);
1719 + 8 * n + LOG_CHECKPOINT_ARCHIVED_OFFSET, offset);
1720}1714}
17211715
1722/*******************************************************************//**1716/*******************************************************************//**
@@ -1727,15 +1721,12 @@
1727/*==============================*/1721/*==============================*/
1728 const byte* buf, /*!< in: buffer containing checkpoint info */1722 const byte* buf, /*!< in: buffer containing checkpoint info */
1729 ulint n, /*!< in: nth slot */1723 ulint n, /*!< in: nth slot */
1730 ulint* file_no,/*!< out: archived file number */1724 lsn_t* file_no)/*!< out: archived file number */
1731 ulint* offset) /*!< out: archived file offset */
1732{1725{
1733 ut_ad(n < LOG_MAX_N_GROUPS);1726 ut_ad(n < LOG_MAX_N_GROUPS);
17341727
1735 *file_no = mach_read_from_4(buf + LOG_CHECKPOINT_GROUP_ARRAY1728 *file_no = mach_read_from_8(buf + LOG_CHECKPOINT_GROUP_ARRAY +
1736 + 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO);1729 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO);
1737 *offset = mach_read_from_4(buf + LOG_CHECKPOINT_GROUP_ARRAY
1738 + 8 * n + LOG_CHECKPOINT_ARCHIVED_OFFSET);
1739}1730}
17401731
1741/******************************************************//**1732/******************************************************//**
@@ -1795,7 +1786,7 @@
1795#endif /* UNIV_LOG_ARCHIVE */1786#endif /* UNIV_LOG_ARCHIVE */
17961787
1797 for (i = 0; i < LOG_MAX_N_GROUPS; i++) {1788 for (i = 0; i < LOG_MAX_N_GROUPS; i++) {
1798 log_checkpoint_set_nth_group_info(buf, i, 0, 0);1789 log_checkpoint_set_nth_group_info(buf, i, 0);
1799 }1790 }
18001791
1801 group2 = UT_LIST_GET_FIRST(log_sys->log_groups);1792 group2 = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -1803,10 +1794,9 @@
1803 while (group2) {1794 while (group2) {
1804 log_checkpoint_set_nth_group_info(buf, group2->id,1795 log_checkpoint_set_nth_group_info(buf, group2->id,
1805#ifdef UNIV_LOG_ARCHIVE1796#ifdef UNIV_LOG_ARCHIVE
1806 group2->archived_file_no,1797 group2->archived_file_no
1807 group2->archived_offset
1808#else /* UNIV_LOG_ARCHIVE */1798#else /* UNIV_LOG_ARCHIVE */
1809 0, 01799 0
1810#endif /* UNIV_LOG_ARCHIVE */1800#endif /* UNIV_LOG_ARCHIVE */
1811 );1801 );
18121802
@@ -2225,7 +2215,7 @@
2225 fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, 0,2215 fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, 0,
2226 (ulint) (source_offset / UNIV_PAGE_SIZE),2216 (ulint) (source_offset / UNIV_PAGE_SIZE),
2227 (ulint) (source_offset % UNIV_PAGE_SIZE),2217 (ulint) (source_offset % UNIV_PAGE_SIZE),
2228 len, buf, NULL);2218 len, buf, (type == LOG_ARCHIVE) ? &log_archive_io : NULL);
22292219
2230 start_lsn += len;2220 start_lsn += len;
2231 buf += len;2221 buf += len;
@@ -2244,12 +2234,68 @@
2244log_archived_file_name_gen(2234log_archived_file_name_gen(
2245/*=======================*/2235/*=======================*/
2246 char* buf, /*!< in: buffer where to write */2236 char* buf, /*!< in: buffer where to write */
2237 ulint buf_len,/*!< in: buffer length */
2247 ulint id __attribute__((unused)),2238 ulint id __attribute__((unused)),
2248 /*!< in: group id;2239 /*!< in: group id;
2249 currently we only archive the first group */2240 currently we only archive the first group */
2250 ulint file_no)/*!< in: file number */2241 lsn_t file_no)/*!< in: file number */
2251{2242{
2252 sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, (ulong) file_no);2243 ulint dirnamelen;
2244
2245 dirnamelen = strlen(srv_arch_dir);
2246
2247 ut_a(buf_len > dirnamelen +
2248 IB_ARCHIVED_LOGS_SERIAL_LEN +
2249 IB_ARCHIVED_LOGS_PREFIX_LEN + 2);
2250
2251 strcpy(buf, srv_arch_dir);
2252
2253 if (buf[dirnamelen-1] != SRV_PATH_SEPARATOR) {
2254 buf[dirnamelen++] = SRV_PATH_SEPARATOR;
2255 }
2256 sprintf(buf + dirnamelen, IB_ARCHIVED_LOGS_PREFIX
2257 "%0" IB_TO_STR(IB_ARCHIVED_LOGS_SERIAL_LEN) "llu",
2258 file_no);
2259}
2260
2261/******************************************************//**
2262Get offset within archived log file to continue to write
2263with. */
2264UNIV_INTERN
2265void
2266log_archived_get_offset(
2267/*=====================*/
2268 log_group_t* group, /*!< in: log group */
2269 lsn_t file_no, /*!< in: archive log file number */
2270 lsn_t archived_lsn, /*!< in: last archived LSN */
2271 lsn_t* offset) /*!< out: offset within archived file */
2272{
2273 char file_name[OS_FILE_MAX_PATH];
2274 ibool exists;
2275 os_file_type_t type;
2276
2277 log_archived_file_name_gen(file_name,
2278 sizeof(file_name), group->id, file_no);
2279
2280 ut_a(os_file_status(file_name, &exists, &type));
2281
2282 if (!exists) {
2283 *offset = 0;
2284 return;
2285 }
2286
2287 *offset = archived_lsn - file_no + LOG_FILE_HDR_SIZE;
2288
2289 if (archived_lsn != IB_ULONGLONG_MAX) {
2290 *offset = archived_lsn - file_no + LOG_FILE_HDR_SIZE;
2291 } else {
2292 /* Archiving was OFF prior startup */
2293 *offset = 0;
2294 }
2295
2296 ut_a(group->file_size >= *offset + LOG_FILE_HDR_SIZE);
2297
2298 return;
2253}2299}
22542300
2255/******************************************************//**2301/******************************************************//**
@@ -2261,7 +2307,7 @@
2261 log_group_t* group, /*!< in: log group */2307 log_group_t* group, /*!< in: log group */
2262 ulint nth_file, /*!< in: header to the nth file in the2308 ulint nth_file, /*!< in: header to the nth file in the
2263 archive log file space */2309 archive log file space */
2264 ulint file_no, /*!< in: archived file number */2310 lsn_t file_no, /*!< in: archived file number */
2265 ib_uint64_t start_lsn) /*!< in: log file data starts at this2311 ib_uint64_t start_lsn) /*!< in: log file data starts at this
2266 lsn */2312 lsn */
2267{2313{
@@ -2287,6 +2333,7 @@
2287 MONITOR_INC(MONITOR_LOG_IO);2333 MONITOR_INC(MONITOR_LOG_IO);
22882334
2289 fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id,2335 fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id,
2336 0,
2290 dest_offset / UNIV_PAGE_SIZE,2337 dest_offset / UNIV_PAGE_SIZE,
2291 dest_offset % UNIV_PAGE_SIZE,2338 dest_offset % UNIV_PAGE_SIZE,
2292 2 * OS_FILE_LOG_BLOCK_SIZE,2339 2 * OS_FILE_LOG_BLOCK_SIZE,
@@ -2322,6 +2369,7 @@
2322 MONITOR_INC(MONITOR_LOG_IO);2369 MONITOR_INC(MONITOR_LOG_IO);
23232370
2324 fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id,2371 fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id,
2372 0,
2325 dest_offset / UNIV_PAGE_SIZE,2373 dest_offset / UNIV_PAGE_SIZE,
2326 dest_offset % UNIV_PAGE_SIZE,2374 dest_offset % UNIV_PAGE_SIZE,
2327 OS_FILE_LOG_BLOCK_SIZE,2375 OS_FILE_LOG_BLOCK_SIZE,
@@ -2340,7 +2388,7 @@
2340 os_file_t file_handle;2388 os_file_t file_handle;
2341 lsn_t start_lsn;2389 lsn_t start_lsn;
2342 lsn_t end_lsn;2390 lsn_t end_lsn;
2343 char name[1024];2391 char name[OS_FILE_MAX_PATH];
2344 byte* buf;2392 byte* buf;
2345 ulint len;2393 ulint len;
2346 ibool ret;2394 ibool ret;
@@ -2372,12 +2420,19 @@
23722420
2373 if (next_offset % group->file_size == 0) {2421 if (next_offset % group->file_size == 0) {
2374 open_mode = OS_FILE_CREATE;2422 open_mode = OS_FILE_CREATE;
2423 if (n_files == 0) {
2424 /* Adjust archived_file_no to match start_lsn
2425 which is written in file header as well */
2426 group->archived_file_no = start_lsn;
2427 }
2375 } else {2428 } else {
2376 open_mode = OS_FILE_OPEN;2429 open_mode = OS_FILE_OPEN;
2377 }2430 }
23782431
2379 log_archived_file_name_gen(name, group->id,2432 log_archived_file_name_gen(name, sizeof(name), group->id,
2380 group->archived_file_no + n_files);2433 group->archived_file_no +
2434 n_files * (group->file_size -
2435 LOG_FILE_HDR_SIZE));
23812436
2382 file_handle = os_file_create(innodb_file_log_key,2437 file_handle = os_file_create(innodb_file_log_key,
2383 name, open_mode,2438 name, open_mode,
@@ -2414,13 +2469,14 @@
24142469
2415 /* Add the archive file as a node to the space */2470 /* Add the archive file as a node to the space */
24162471
2417 fil_node_create(name, group->file_size / UNIV_PAGE_SIZE,2472 ut_a(fil_node_create(name, group->file_size / UNIV_PAGE_SIZE,
2418 group->archive_space_id, FALSE);2473 group->archive_space_id, FALSE));
24192474
2420 if (next_offset % group->file_size == 0) {2475 if (next_offset % group->file_size == 0) {
2421 log_group_archive_file_header_write(2476 log_group_archive_file_header_write(
2422 group, n_files,2477 group, n_files,
2423 group->archived_file_no + n_files,2478 group->archived_file_no +
2479 n_files * (group->file_size - LOG_FILE_HDR_SIZE),
2424 start_lsn);2480 start_lsn);
24252481
2426 next_offset += LOG_FILE_HDR_SIZE;2482 next_offset += LOG_FILE_HDR_SIZE;
@@ -2451,6 +2507,7 @@
2451 MONITOR_INC(MONITOR_LOG_IO);2507 MONITOR_INC(MONITOR_LOG_IO);
24522508
2453 fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->archive_space_id,2509 fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->archive_space_id,
2510 0,
2454 (ulint) (next_offset / UNIV_PAGE_SIZE),2511 (ulint) (next_offset / UNIV_PAGE_SIZE),
2455 (ulint) (next_offset % UNIV_PAGE_SIZE),2512 (ulint) (next_offset % UNIV_PAGE_SIZE),
2456 ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf,2513 ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf,
@@ -2469,7 +2526,8 @@
2469 goto loop;2526 goto loop;
2470 }2527 }
24712528
2472 group->next_archived_file_no = group->archived_file_no + n_files;2529 group->next_archived_file_no = group->archived_file_no +
2530 n_files * (group->file_size - LOG_FILE_HDR_SIZE);
2473 group->next_archived_offset = next_offset % group->file_size;2531 group->next_archived_offset = next_offset % group->file_size;
24742532
2475 ut_a(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);2533 ut_a(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -2501,7 +2559,7 @@
2501/*===================================*/2559/*===================================*/
2502{2560{
2503 log_group_t* group;2561 log_group_t* group;
2504 ulint end_offset;2562 lsn_t end_offset;
2505 ulint trunc_files;2563 ulint trunc_files;
2506 ulint n_files;2564 ulint n_files;
2507 ib_uint64_t start_lsn;2565 ib_uint64_t start_lsn;
@@ -2822,18 +2880,8 @@
2822 trunc_len);2880 trunc_len);
2823 if (increment_file_count) {2881 if (increment_file_count) {
2824 group->archived_offset = 0;2882 group->archived_offset = 0;
2825 group->archived_file_no += 2;
2826 }2883 }
28272884
2828#ifdef UNIV_DEBUG
2829 if (log_debug_writes) {
2830 fprintf(stderr,
2831 "Incrementing arch file no to %lu"
2832 " in log group %lu\n",
2833 (ulong) group->archived_file_no + 2,
2834 (ulong) group->id);
2835 }
2836#endif /* UNIV_DEBUG */
2837 }2885 }
2838}2886}
28392887
@@ -3087,7 +3135,6 @@
3087/*=======================================*/3135/*=======================================*/
3088{3136{
3089 lsn_t lsn;3137 lsn_t lsn;
3090 ulint arch_log_no;
3091 ulint count = 0;3138 ulint count = 0;
3092 ulint total_trx;3139 ulint total_trx;
3093 ulint pending_io;3140 ulint pending_io;
@@ -3304,15 +3351,7 @@
3304 goto loop;3351 goto loop;
3305 }3352 }
33063353
3307 arch_log_no = 0;
3308
3309#ifdef UNIV_LOG_ARCHIVE3354#ifdef UNIV_LOG_ARCHIVE
3310 UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no;
3311
3312 if (0 == UT_LIST_GET_FIRST(log_sys->log_groups)->archived_offset) {
3313
3314 arch_log_no--;
3315 }
33163355
3317 log_archive_close_groups(TRUE);3356 log_archive_close_groups(TRUE);
3318#endif /* UNIV_LOG_ARCHIVE */3357#endif /* UNIV_LOG_ARCHIVE */
@@ -3371,7 +3410,7 @@
3371 srv_shutdown_lsn = lsn;3410 srv_shutdown_lsn = lsn;
33723411
3373 if (!srv_read_only_mode) {3412 if (!srv_read_only_mode) {
3374 fil_write_flushed_lsn_to_data_files(lsn, arch_log_no);3413 fil_write_flushed_lsn_to_data_files(lsn, 0);
33753414
3376 fil_flush_file_spaces(FIL_TABLESPACE);3415 fil_flush_file_spaces(FIL_TABLESPACE);
3377 }3416 }
@@ -3594,7 +3633,7 @@
35943633
3595#ifdef UNIV_LOG_ARCHIVE3634#ifdef UNIV_LOG_ARCHIVE
3596 rw_lock_free(&log_sys->archive_lock);3635 rw_lock_free(&log_sys->archive_lock);
3597 os_event_create();3636 os_event_free(log_sys->archiving_on);
3598#endif /* UNIV_LOG_ARCHIVE */3637#endif /* UNIV_LOG_ARCHIVE */
35993638
3600#ifdef UNIV_LOG_DEBUG3639#ifdef UNIV_LOG_DEBUG
36013640
=== modified file 'Percona-Server/storage/innobase/log/log0recv.cc'
--- Percona-Server/storage/innobase/log/log0recv.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/log/log0recv.cc 2013-03-31 06:25:28 +0000
@@ -3115,8 +3115,10 @@
31153115
3116 while (group) {3116 while (group) {
3117 log_checkpoint_get_nth_group_info(buf, group->id,3117 log_checkpoint_get_nth_group_info(buf, group->id,
3118 &(group->archived_file_no),3118 &(group->archived_file_no));
3119 &(group->archived_offset));3119
3120 log_archived_get_offset(group, group->archived_file_no,
3121 archived_lsn, &(group->archived_offset));
31203122
3121 group = UT_LIST_GET_NEXT(log_groups, group);3123 group = UT_LIST_GET_NEXT(log_groups, group);
3122 }3124 }
@@ -3690,7 +3692,7 @@
3690 os_offset_t read_offset;3692 os_offset_t read_offset;
3691 os_offset_t file_size;3693 os_offset_t file_size;
3692 int input_char;3694 int input_char;
3693 char name[10000];3695 char name[OS_FILE_MAX_PATH];
36943696
3695 ut_a(0);3697 ut_a(0);
36963698
@@ -3699,7 +3701,8 @@
36993701
3700 /* Add the file to the archive file space; open the file */3702 /* Add the file to the archive file space; open the file */
37013703
3702 log_archived_file_name_gen(name, group->id, group->archived_file_no);3704 log_archived_file_name_gen(name, sizeof(name),
3705 group->id, group->archived_file_no);
37033706
3704 file_handle = os_file_create(innodb_file_log_key,3707 file_handle = os_file_create(innodb_file_log_key,
3705 name, OS_FILE_OPEN,3708 name, OS_FILE_OPEN,
@@ -3748,20 +3751,19 @@
37483751
3749 /* Add the archive file as a node to the space */3752 /* Add the archive file as a node to the space */
37503753
3751 fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE,3754 ut_a(fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE,
3752 group->archive_space_id, FALSE);3755 group->archive_space_id, FALSE));
3753#if RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE3756 ut_a(RECV_SCAN_SIZE >= LOG_FILE_HDR_SIZE);
3754# error "RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE"
3755#endif
37563757
3757 /* Read the archive file header */3758 /* Read the archive file header */
3758 fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->archive_space_id, 0, 0,3759 fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->archive_space_id, 0,
3760 0, 0,
3759 LOG_FILE_HDR_SIZE, buf, NULL);3761 LOG_FILE_HDR_SIZE, buf, NULL);
37603762
3761 /* Check if the archive file header is consistent */3763 /* Check if the archive file header is consistent */
37623764
3763 if (mach_read_from_4(buf + LOG_GROUP_ID) != group->id3765 if (mach_read_from_4(buf + LOG_GROUP_ID) != group->id
3764 || mach_read_from_4(buf + LOG_FILE_NO)3766 || mach_read_from_8(buf + LOG_FILE_START_LSN)
3765 != group->archived_file_no) {3767 != group->archived_file_no) {
3766 fprintf(stderr,3768 fprintf(stderr,
3767 "InnoDB: Archive file header inconsistent %s\n", name);3769 "InnoDB: Archive file header inconsistent %s\n", name);
@@ -3828,7 +3830,7 @@
3828#endif /* UNIV_DEBUG */3830#endif /* UNIV_DEBUG */
38293831
3830 fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE,3832 fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE,
3831 group->archive_space_id, read_offset / UNIV_PAGE_SIZE,3833 group->archive_space_id, 0, read_offset / UNIV_PAGE_SIZE,
3832 read_offset % UNIV_PAGE_SIZE, len, buf, NULL);3834 read_offset % UNIV_PAGE_SIZE, len, buf, NULL);
38333835
3834 ret = recv_scan_log_recs(3836 ret = recv_scan_log_recs(
@@ -3863,14 +3865,14 @@
3863Recovers from archived log files, and also from log files, if they exist.3865Recovers from archived log files, and also from log files, if they exist.
3864@return error code or DB_SUCCESS */3866@return error code or DB_SUCCESS */
3865UNIV_INTERN3867UNIV_INTERN
3866ulint3868dberr_t
3867recv_recovery_from_archive_start(3869recv_recovery_from_archive_start(
3868/*=============================*/3870/*=============================*/
3869 ib_uint64_t min_flushed_lsn,/*!< in: min flushed lsn field from the3871 ib_uint64_t min_flushed_lsn,/*!< in: min flushed lsn field from the
3870 data files */3872 data files */
3871 ib_uint64_t limit_lsn, /*!< in: recover up to this lsn if3873 ib_uint64_t limit_lsn, /*!< in: recover up to this lsn if
3872 possible */3874 possible */
3873 ulint first_log_no) /*!< in: number of the first archived3875 lsn_t first_log_no) /*!< in: number of the first archived
3874 log file to use in the recovery; the3876 log file to use in the recovery; the
3875 file will be searched from3877 file will be searched from
3876 INNOBASE_LOG_ARCH_DIR specified in3878 INNOBASE_LOG_ARCH_DIR specified in
@@ -3880,7 +3882,7 @@
3880 ulint group_id;3882 ulint group_id;
3881 ulint trunc_len;3883 ulint trunc_len;
3882 ibool ret;3884 ibool ret;
3883 ulint err;3885 dberr_t err;
38843886
3885 ut_a(0);3887 ut_a(0);
38863888
@@ -3939,7 +3941,7 @@
3939 trunc_len);3941 trunc_len);
3940 }3942 }
39413943
3942 group->archived_file_no++;3944 group->archived_file_no += group->file_size - LOG_FILE_HDR_SIZE;
3943 }3945 }
39443946
3945 if (recv_sys->recovered_lsn < limit_lsn) {3947 if (recv_sys->recovered_lsn < limit_lsn) {
39463948
=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.cc'
--- Percona-Server/storage/innobase/srv/srv0srv.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/srv/srv0srv.cc 2013-03-31 06:25:28 +0000
@@ -67,6 +67,7 @@
67#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */67#include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */
68#include "srv0mon.h"68#include "srv0mon.h"
69#include "ut0crc32.h"69#include "ut0crc32.h"
70#include "os0file.h"
7071
71#include "mysql/plugin.h"72#include "mysql/plugin.h"
72#include "mysql/service_thd_wait.h"73#include "mysql/service_thd_wait.h"
@@ -111,6 +112,7 @@
111112
112#ifdef UNIV_LOG_ARCHIVE113#ifdef UNIV_LOG_ARCHIVE
113UNIV_INTERN char* srv_arch_dir = NULL;114UNIV_INTERN char* srv_arch_dir = NULL;
115UNIV_INTERN ulong srv_log_arch_expire_sec = 0;
114#endif /* UNIV_LOG_ARCHIVE */116#endif /* UNIV_LOG_ARCHIVE */
115117
116/** Set if InnoDB must operate in read-only mode. We don't do any118/** Set if InnoDB must operate in read-only mode. We don't do any
@@ -1852,6 +1854,134 @@
1852 return(thread_active);1854 return(thread_active);
1853}1855}
18541856
1857/*************************************************************//**
1858Removes old archived transaction log files.
1859Both parameters couldn't be provided at the same time */
1860dberr_t
1861purge_archived_logs(
1862 time_t before_date, /*!< in: all files modified
1863 before timestamp should be removed */
1864 lsn_t before_no) /*!< in: files with this number in name
1865 and earler should be removed */
1866{
1867 log_group_t* group = UT_LIST_GET_FIRST(log_sys->log_groups);
1868
1869 os_file_dir_t dir;
1870 os_file_stat_t fileinfo;
1871 char archived_log_filename[OS_FILE_MAX_PATH];
1872 char namegen[OS_FILE_MAX_PATH];
1873 ulint dirnamelen;
1874
1875 if (srv_arch_dir) {
1876 dir = os_file_opendir(srv_arch_dir, FALSE);
1877 if (!dir) {
1878 fprintf(stderr,
1879 "InnoDB: Note: opening archived log directory "
1880 "%s failed. "
1881 "Purge archived logs are not available\n",
1882 srv_arch_dir);
1883 /* failed to open directory */
1884 return(DB_ERROR);
1885 }
1886 } else {
1887 /* log archive directory is not specified */
1888 return(DB_ERROR);
1889 }
1890
1891 dirnamelen = strlen(srv_arch_dir);
1892
1893 memcpy(archived_log_filename, srv_arch_dir, dirnamelen);
1894 if (dirnamelen &&
1895 archived_log_filename[dirnamelen - 1] != SRV_PATH_SEPARATOR) {
1896 archived_log_filename[dirnamelen++] = SRV_PATH_SEPARATOR;
1897 }
1898
1899 memset(&fileinfo, 0, sizeof(fileinfo));
1900 while(!os_file_readdir_next_file(srv_arch_dir, dir,
1901 &fileinfo) ) {
1902 if (strncmp(fileinfo.name,
1903 IB_ARCHIVED_LOGS_PREFIX, IB_ARCHIVED_LOGS_PREFIX_LEN)) {
1904 continue;
1905 }
1906 if (dirnamelen + strlen(fileinfo.name) + 2 > OS_FILE_MAX_PATH)
1907 continue;
1908
1909 snprintf(archived_log_filename + dirnamelen, OS_FILE_MAX_PATH,
1910 "%s", fileinfo.name);
1911
1912 if (before_no) {
1913 ib_uint64_t log_file_no = strtoull(fileinfo.name +
1914 IB_ARCHIVED_LOGS_PREFIX_LEN,
1915 NULL, 10);
1916 if (log_file_no == 0 || before_no <= log_file_no) {
1917 continue;
1918 }
1919 } else {
1920 fileinfo.mtime = 0;
1921 if (os_file_get_status(archived_log_filename,
1922 &fileinfo, false) != DB_SUCCESS ||
1923 fileinfo.mtime == 0) {
1924 continue;
1925 }
1926
1927 if (before_date == 0 || fileinfo.mtime > before_date) {
1928 continue;
1929 }
1930 }
1931
1932 /* We are going to delete archived file. Acquire log_sys->mutex
1933 to make sure that we are the only who try to delete file. This
1934 also prevents log system from using this file. Do not delete
1935 file if it is currently in progress of writting or have
1936 pending IO. This is enforced by checking:
1937 1. fil_space_contains_node.
1938 2. group->archived_offset % group->file_size != 0, i.e.
1939 there is archive in progress and we are going to delete it.
1940 This covers 3 cases:
1941 a. Usual case when we have one archive in progress,
1942 both 1 and 2 are TRUE
1943 b. When we have more then 1 archive in fil_space,
1944 this can happen when flushed LSN range crosses file
1945 boundary
1946 c. When we have empty fil_space, but existing file will be
1947 opened once archiving operation is requested. This usually
1948 happens on startup.
1949 */
1950
1951 mutex_enter(&log_sys->mutex);
1952
1953 log_archived_file_name_gen(namegen, sizeof(namegen),
1954 group->id, group->archived_file_no);
1955
1956 if (fil_space_contains_node(group->archive_space_id,
1957 archived_log_filename) ||
1958 (group->archived_offset % group->file_size != 0 &&
1959 strcmp(namegen, archived_log_filename) == 0)) {
1960
1961 mutex_exit(&log_sys->mutex);
1962 continue;
1963 }
1964
1965 if (os_file_delete_if_exists(archived_log_filename) == FALSE) {
1966 fprintf(stderr,
1967 "InnoDB: Note: can't delete archived log file "
1968 "%s.\n", archived_log_filename);
1969
1970 mutex_exit(&log_sys->mutex);
1971 os_file_closedir(dir);
1972
1973 return(DB_ERROR);
1974 }
1975
1976 mutex_exit(&log_sys->mutex);
1977 }
1978
1979 os_file_closedir(dir);
1980
1981 return(DB_SUCCESS);
1982}
1983
1984
1855/*******************************************************************//**1985/*******************************************************************//**
1856Tells the InnoDB server that there has been activity in the database1986Tells the InnoDB server that there has been activity in the database
1857and wakes up the master thread if it is suspended (not sleeping). Used1987and wakes up the master thread if it is suspended (not sleeping). Used
@@ -2205,6 +2335,16 @@
2205 log_checkpoint(TRUE, FALSE);2335 log_checkpoint(TRUE, FALSE);
2206 MONITOR_INC_TIME_IN_MICRO_SECS(MONITOR_SRV_CHECKPOINT_MICROSECOND,2336 MONITOR_INC_TIME_IN_MICRO_SECS(MONITOR_SRV_CHECKPOINT_MICROSECOND,
2207 counter_time);2337 counter_time);
2338
2339 if (srv_shutdown_state > 0) {
2340 return;
2341 }
2342
2343 if (srv_log_arch_expire_sec) {
2344 srv_main_thread_op_info = "purging archived logs";
2345 purge_archived_logs(ut_time() - srv_log_arch_expire_sec,
2346 0);
2347 }
2208}2348}
22092349
2210/*********************************************************************//**2350/*********************************************************************//**
22112351
=== modified file 'Percona-Server/storage/innobase/srv/srv0start.cc'
--- Percona-Server/storage/innobase/srv/srv0start.cc 2013-03-05 12:46:43 +0000
+++ Percona-Server/storage/innobase/srv/srv0start.cc 2013-03-31 06:25:28 +0000
@@ -640,6 +640,11 @@
640 }640 }
641 }641 }
642642
643#ifdef UNIV_LOG_ARCHIVE
644 /* Create the file space object for archived logs. */
645 fil_space_create("arch_log_space", SRV_LOG_SPACE_FIRST_ID + 1,
646 0, FIL_LOG);
647#endif
643 log_group_init(0, srv_n_log_files,648 log_group_init(0, srv_n_log_files,
644 srv_log_file_size * UNIV_PAGE_SIZE,649 srv_log_file_size * UNIV_PAGE_SIZE,
645 SRV_LOG_SPACE_FIRST_ID,650 SRV_LOG_SPACE_FIRST_ID,
@@ -650,7 +655,12 @@
650 /* Create a log checkpoint. */655 /* Create a log checkpoint. */
651 mutex_enter(&log_sys->mutex);656 mutex_enter(&log_sys->mutex);
652 ut_d(recv_no_log_write = FALSE);657 ut_d(recv_no_log_write = FALSE);
653 recv_reset_logs(lsn);658 recv_reset_logs(
659#ifdef UNIV_LOG_ARCHIVE
660 UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no,
661 TRUE,
662#endif
663 lsn);
654 mutex_exit(&log_sys->mutex);664 mutex_exit(&log_sys->mutex);
655665
656 return(DB_SUCCESS);666 return(DB_SUCCESS);
@@ -738,9 +748,9 @@
738 ibool* create_new_db, /*!< out: TRUE if new database should be748 ibool* create_new_db, /*!< out: TRUE if new database should be
739 created */749 created */
740#ifdef UNIV_LOG_ARCHIVE750#ifdef UNIV_LOG_ARCHIVE
741 ulint* min_arch_log_no,/*!< out: min of archived log751 lsn_t* min_arch_log_no,/*!< out: min of archived log
742 numbers in data files */752 numbers in data files */
743 ulint* max_arch_log_no,/*!< out: max of archived log753 lsn_t* max_arch_log_no,/*!< out: max of archived log
744 numbers in data files */754 numbers in data files */
745#endif /* UNIV_LOG_ARCHIVE */755#endif /* UNIV_LOG_ARCHIVE */
746 lsn_t* min_flushed_lsn,/*!< out: min of flushed lsn756 lsn_t* min_flushed_lsn,/*!< out: min of flushed lsn
@@ -963,9 +973,6 @@
963skip_size_check:973skip_size_check:
964 fil_read_first_page(974 fil_read_first_page(
965 files[i], one_opened, &flags, &space,975 files[i], one_opened, &flags, &space,
966#ifdef UNIV_LOG_ARCHIVE
967 min_arch_log_no, max_arch_log_no,
968#endif /* UNIV_LOG_ARCHIVE */
969 min_flushed_lsn, max_flushed_lsn);976 min_flushed_lsn, max_flushed_lsn);
970977
971 /* The first file of the system tablespace must978 /* The first file of the system tablespace must
@@ -1443,8 +1450,8 @@
1443 lsn_t min_flushed_lsn;1450 lsn_t min_flushed_lsn;
1444 lsn_t max_flushed_lsn;1451 lsn_t max_flushed_lsn;
1445#ifdef UNIV_LOG_ARCHIVE1452#ifdef UNIV_LOG_ARCHIVE
1446 ulint min_arch_log_no;1453 lsn_t min_arch_log_no;
1447 ulint max_arch_log_no;1454 lsn_t max_arch_log_no;
1448#endif /* UNIV_LOG_ARCHIVE */1455#endif /* UNIV_LOG_ARCHIVE */
1449 ulint sum_of_new_sizes;1456 ulint sum_of_new_sizes;
1450 ulint sum_of_data_file_sizes;1457 ulint sum_of_data_file_sizes;
@@ -1883,17 +1890,6 @@
1883 os_thread_create(io_handler_thread, n + i, thread_ids + i);1890 os_thread_create(io_handler_thread, n + i, thread_ids + i);
1884 }1891 }
18851892
1886#ifdef UNIV_LOG_ARCHIVE
1887 if (0 != ut_strcmp(srv_log_group_home_dir, srv_arch_dir)) {
1888 ut_print_timestamp(stderr);
1889 fprintf(stderr, " InnoDB: Error: you must set the log group home dir in my.cnf\n");
1890 ut_print_timestamp(stderr);
1891 fprintf(stderr, " InnoDB: the same as log arch dir.\n");
1892
1893 return(DB_ERROR);
1894 }
1895#endif /* UNIV_LOG_ARCHIVE */
1896
1897 if (srv_n_log_files * srv_log_file_size * UNIV_PAGE_SIZE1893 if (srv_n_log_files * srv_log_file_size * UNIV_PAGE_SIZE
1898 >= 512ULL * 1024ULL * 1024ULL * 1024ULL) {1894 >= 512ULL * 1024ULL * 1024ULL * 1024ULL) {
1899 /* log_block_convert_lsn_to_no() limits the returned block1895 /* log_block_convert_lsn_to_no() limits the returned block
@@ -1982,7 +1978,6 @@
19821978
1983#ifdef UNIV_LOG_ARCHIVE1979#ifdef UNIV_LOG_ARCHIVE
1984 srv_normalize_path_for_win(srv_arch_dir);1980 srv_normalize_path_for_win(srv_arch_dir);
1985 srv_arch_dir = srv_add_path_separator_if_needed(srv_arch_dir);
1986#endif /* UNIV_LOG_ARCHIVE */1981#endif /* UNIV_LOG_ARCHIVE */
19871982
1988 dirnamelen = strlen(srv_log_group_home_dir);1983 dirnamelen = strlen(srv_log_group_home_dir);
@@ -2462,6 +2457,8 @@
2462 if (!srv_log_archive_on) {2457 if (!srv_log_archive_on) {
2463 ut_a(DB_SUCCESS == log_archive_noarchivelog());2458 ut_a(DB_SUCCESS == log_archive_noarchivelog());
2464 } else {2459 } else {
2460 bool start_archive;
2461
2465 mutex_enter(&(log_sys->mutex));2462 mutex_enter(&(log_sys->mutex));
24662463
2467 start_archive = FALSE;2464 start_archive = FALSE;

Subscribers

People subscribed via source and target branches