Merge lp:~sergei.glushchenko/percona-server/ps56-univ-log-archive into lp:percona-server/5.6
- ps56-univ-log-archive
- Merge into 5.6
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 |
Related bugs: | |
Related blueprints: |
Log Archiving for XtraDB
(High)
|
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.
Commit message
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_
* innodb_
as not applicable
* testcase has been added (modified from original, as purge
commands do not delete current archive in progress)
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal | # |
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:/
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_
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.
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:/
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_
> 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.
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?
Sergei Glushchenko (sergei.glushchenko) wrote : Posted in a previous version of this proposal | # |
http://
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_
* 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_
* innodb_
as it is not applicable
* testcases were implemented
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal | # |
Sergey, it seems percona_
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_
2. I would use "#define IB_ARCHIVED_
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_
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)?
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.
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal | # |
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_
xtrabackup: innodb_
xtrabackup: innodb_
xtrabackup: innodb_
xtrabackup: innodb_
130313 0:06:46 InnoDB: Assertion failure in thread 140183767389952 in file fil0fil.c line 5519
InnoDB: Failing assertion: byte_offset % OS_FILE_
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://
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://
InnoDB: about forcing recovery.
I use the following test script to repeat it:
#!/bin/bash
BASE_DIR=
DATA_DIR=
ARCHIVED_
BACKUP_
DST_DIR=/tmp/1/dst
XTRABACKUP_DIR=.
XTRABACKUP=
USER=some_user
EXTRA_OPTIONS=
SERVER_
LD_LIBRARY_
INSTALL_
MYSQLD=
MYSQL=$
mkdir -p $DATA_DIR $ARCHIVED_LOGS_DIR $BACKUP_DIR $DST_DIR
rm -rf $DATA_DIR/* $ARCHIVED_
$INSTALL_DB --no-defaults --basedir=$BASE_DIR --datadir=$DATA_DIR --user=$USER $EXTRA_OPTIONS
PID1=$!
sleep 2
echo '------
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?
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.
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://
We obviously cannot afford similar changes for every new statement
type, so we should do something about it. What about adding
performanc
mysql-
- the changes related to digest values is another "gift" from
performance schema. Not sure what to do about it. Probably just
"-
- please use OS_FILE_MAX_PATH instead of hard-coded (and
inconsistent) constants in log_group_archive() and
log_
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.
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
Failure of XtraDB based xtrabackup binaries is a result of change which comes from innodb_
Alexey Kopytov (akopytov) wrote : | # |
The part of innodb_
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_
Other comments:
- archived_file_no / next_archived_
ordinal file numbers. Which means their type should be lsn_t, not
ulint. The same for 'file_no' argument f
log_
- the assertion and sprintf() in log_archived_
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_
longer than 80 chars:
: sprintf(buf + dirnamelen, IB_ARCHIVED_
- the following line in log_group_archive() is still longer than 80
chars:
: n_files * (group->file_size - LOG_FILE_HDR_SIZE),
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_
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.
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
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_
next_
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://
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_
and LOG_CHECKPOINT_
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_
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_
- spaces instead of tabs here:
: if (fil_space_
: archived_
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?
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
And, yes, if file doesn't exists, just make assume offset=0
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!
Sergei Glushchenko (sergei.glushchenko) wrote : | # |
The proposal above has been implemented.
http://
Alexey Kopytov (akopytov) : | # |
Preview Diff
1 | === added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_check.inc' | |||
2 | --- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_check.inc 1970-01-01 00:00:00 +0000 | |||
3 | +++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_check.inc 2013-03-31 06:25:28 +0000 | |||
4 | @@ -0,0 +1,15 @@ | |||
5 | 1 | # Check that there are no gaps in archived files | ||
6 | 2 | |||
7 | 3 | --source percona_log_archiving_stat.inc | ||
8 | 4 | |||
9 | 5 | let $lsn = `SELECT (($archived_logs_count - 1) * $LOG_FILE_LSN_STEP + $first_log_file_lsn)`; | ||
10 | 6 | |||
11 | 7 | if ($last_log_file_lsn != $lsn) | ||
12 | 8 | { | ||
13 | 9 | echo Expected last file lsn is $lsn but got $last_log_file_lsn; | ||
14 | 10 | die Test failed; | ||
15 | 11 | } | ||
16 | 12 | |||
17 | 13 | echo Check OK; | ||
18 | 14 | |||
19 | 15 | let $LAST_ARCHIVED_LSN = $last_log_file_lsn; | ||
20 | 0 | 16 | ||
21 | === added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_cleanup.inc' | |||
22 | --- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_cleanup.inc 1970-01-01 00:00:00 +0000 | |||
23 | +++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_cleanup.inc 2013-03-31 06:25:28 +0000 | |||
24 | @@ -0,0 +1,15 @@ | |||
25 | 1 | # | ||
26 | 2 | # Cleanup after log archiving testing | ||
27 | 3 | # | ||
28 | 4 | |||
29 | 5 | DROP TABLE t; | ||
30 | 6 | |||
31 | 7 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
32 | 8 | --shutdown_server | ||
33 | 9 | --source include/wait_until_disconnected.inc | ||
34 | 10 | --enable_reconnect | ||
35 | 11 | --exec echo "restart: --innodb-log-file-size=1M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
36 | 12 | --source include/wait_until_connected_again.inc | ||
37 | 13 | |||
38 | 14 | --remove_files_wildcard $MYSQLD_ARCHIVEDIR ib_log_archive_* | ||
39 | 15 | --rmdir $MYSQLD_ARCHIVEDIR | ||
40 | 0 | 16 | ||
41 | === added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_count.inc' | |||
42 | --- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_count.inc 1970-01-01 00:00:00 +0000 | |||
43 | +++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_count.inc 2013-03-31 06:25:28 +0000 | |||
44 | @@ -0,0 +1,9 @@ | |||
45 | 1 | |||
46 | 2 | --source percona_log_archiving_stat.inc | ||
47 | 3 | |||
48 | 4 | let $lsn = $n_files * $LOG_FILE_LSN_STEP; | ||
49 | 5 | |||
50 | 6 | --echo $archived_logs_count | ||
51 | 7 | |||
52 | 8 | let $LAST_ARCHIVED_LSN = $last_log_file_lsn; | ||
53 | 9 | |||
54 | 0 | 10 | ||
55 | === added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_last_file.inc' | |||
56 | --- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_last_file.inc 1970-01-01 00:00:00 +0000 | |||
57 | +++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_last_file.inc 2013-03-31 06:25:28 +0000 | |||
58 | @@ -0,0 +1,24 @@ | |||
59 | 1 | |||
60 | 2 | perl; | ||
61 | 3 | @files = glob($ENV{'MYSQLD_ARCHIVEDIR'}.'/ib_log_archive_*'); | ||
62 | 4 | my $filepath, $filename, $dirname; | ||
63 | 5 | foreach my $file (@files) { | ||
64 | 6 | ($dirname, $filename) = $file =~ m|^(.*[/\\])([^/\\]+?)$|; | ||
65 | 7 | $filepath = $file; | ||
66 | 8 | } | ||
67 | 9 | |||
68 | 10 | my @array = stat($filepath); | ||
69 | 11 | my $filemodifytime = $array[9]; | ||
70 | 12 | my @t = localtime $filemodifytime; | ||
71 | 13 | my $modifytime = sprintf "%04u-%02u-%02u %02u:%02u:%02u",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0]; | ||
72 | 14 | my $lsn = $filename =~ m/ib_log_archive_0*([1-9][0-9]+)$/; | ||
73 | 15 | open F, ">".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/percona_archived_logs.tmp' or die "Cannot open file percona_archived_logs.tmp for write"; | ||
74 | 16 | printf F ("let \$last_log_file = %s;\n", $filename); | ||
75 | 17 | printf F ("let \$last_log_file_modify = %s;\n", $modifytime); | ||
76 | 18 | printf F ("let \$last_log_file_lsn = %s;\n", $lsn); | ||
77 | 19 | close F; | ||
78 | 20 | EOF | ||
79 | 21 | |||
80 | 22 | --source $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp | ||
81 | 23 | # remove_file $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp; | ||
82 | 24 | |||
83 | 0 | 25 | ||
84 | === added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_setup.inc' | |||
85 | --- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_setup.inc 1970-01-01 00:00:00 +0000 | |||
86 | +++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_setup.inc 2013-03-31 06:25:28 +0000 | |||
87 | @@ -0,0 +1,49 @@ | |||
88 | 1 | # | ||
89 | 2 | # setup for log archive testing | ||
90 | 3 | # | ||
91 | 4 | |||
92 | 5 | |||
93 | 6 | call mtr.add_suppression("InnoDB: Resizing redo log"); | ||
94 | 7 | call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); | ||
95 | 8 | call mtr.add_suppression("InnoDB: New log files created"); | ||
96 | 9 | call 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"); | ||
97 | 10 | |||
98 | 11 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
99 | 12 | --shutdown_server | ||
100 | 13 | --source include/wait_until_disconnected.inc | ||
101 | 14 | # Do something while server is down | ||
102 | 15 | --enable_reconnect | ||
103 | 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 | ||
104 | 17 | --source include/wait_until_connected_again.inc | ||
105 | 18 | |||
106 | 19 | --disable_warnings | ||
107 | 20 | drop table if exists t; | ||
108 | 21 | --enable_warnings | ||
109 | 22 | |||
110 | 23 | let $MYSQLD_DATADIR= `SELECT @@datadir`; | ||
111 | 24 | let $MYSQLD_ARCHIVEDIR= `SELECT IF( locate('/', @@innodb_log_arch_dir) = 1, @@innodb_log_arch_dir, CONCAT(@@datadir, @@innodb_log_arch_dir))`; | ||
112 | 25 | let MYSQLD_ARCHIVEDIR = $MYSQLD_ARCHIVEDIR; | ||
113 | 26 | --mkdir $MYSQLD_ARCHIVEDIR | ||
114 | 27 | |||
115 | 28 | let $LOG_FILE_HDR_SIZE = 2048; | ||
116 | 29 | let $LOG_FILE_SIZE = `SELECT @@innodb_log_file_size`; | ||
117 | 30 | let $LOG_FILE_LSN_STEP = `SELECT $LOG_FILE_SIZE - $LOG_FILE_HDR_SIZE`; | ||
118 | 31 | |||
119 | 32 | create table t (a int not null) ENGINE=InnoDB; | ||
120 | 33 | |||
121 | 34 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
122 | 35 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
123 | 36 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
124 | 37 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
125 | 38 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
126 | 39 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
127 | 40 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
128 | 41 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
129 | 42 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
130 | 43 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
131 | 44 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
132 | 45 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
133 | 46 | |||
134 | 47 | --source percona_log_archiving_stat.inc | ||
135 | 48 | |||
136 | 49 | let $LAST_ARCHIVED_LSN = $last_log_file_lsn; | ||
137 | 0 | 50 | ||
138 | === added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_stat.inc' | |||
139 | --- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_stat.inc 1970-01-01 00:00:00 +0000 | |||
140 | +++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_stat.inc 2013-03-31 06:25:28 +0000 | |||
141 | @@ -0,0 +1,72 @@ | |||
142 | 1 | # | ||
143 | 2 | # Collect information about archived log files | ||
144 | 3 | # | ||
145 | 4 | |||
146 | 5 | perl; | ||
147 | 6 | use Data::Dumper; | ||
148 | 7 | sub fn { | ||
149 | 8 | my $filepath = shift; | ||
150 | 9 | my ($dirname, $filename) = $filepath =~ m|^(.*[/\\])([^/\\]+?)$|; | ||
151 | 10 | |||
152 | 11 | return $filename; | ||
153 | 12 | } | ||
154 | 13 | |||
155 | 14 | sub get_file_stat { | ||
156 | 15 | my $filepath = shift; | ||
157 | 16 | my $prefix = shift; | ||
158 | 17 | my $filename = fn($filepath); | ||
159 | 18 | |||
160 | 19 | my @array = stat($filepath); | ||
161 | 20 | my $filemodifytime = $array[9]; | ||
162 | 21 | my @t = localtime $filemodifytime; | ||
163 | 22 | my $modifytime = sprintf "%04u-%02u-%02u %02u:%02u:%02u",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0]; | ||
164 | 23 | my ($lsn) = $filename =~ m/ib_log_archive_[0]*([1-9][0-9]+)$/; | ||
165 | 24 | |||
166 | 25 | my $f = { | ||
167 | 26 | 'path' => $filepath, | ||
168 | 27 | 'name' => $filename, | ||
169 | 28 | 't' => $filemodifytime, | ||
170 | 29 | 'modifytime' => $modifytime, | ||
171 | 30 | 'lsn' => $lsn | ||
172 | 31 | }; | ||
173 | 32 | |||
174 | 33 | return $f; | ||
175 | 34 | } | ||
176 | 35 | |||
177 | 36 | sub print_file_stat { | ||
178 | 37 | my %stat = %{$_[0]}; | ||
179 | 38 | my $prefix = $_[1]; | ||
180 | 39 | |||
181 | 40 | open F, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/percona_archived_logs.tmp' or die "Cannot open file percona_archived_logs.tmp for write"; | ||
182 | 41 | printf F ("let \$${prefix}_log_file = %s;\n", $stat{'name'}); | ||
183 | 42 | printf F ("let \$${prefix}_log_file_modify = %s;\n", $stat{'modifytime'}); | ||
184 | 43 | printf F ("let \$${prefix}_log_file_lsn = %s;\n", $stat{'lsn'}); | ||
185 | 44 | close F; | ||
186 | 45 | } | ||
187 | 46 | |||
188 | 47 | @files = glob($ENV{'MYSQLD_ARCHIVEDIR'}.'/ib_log_archive_*'); | ||
189 | 48 | |||
190 | 49 | my @files_stat = (); | ||
191 | 50 | |||
192 | 51 | foreach my $file (@files) { | ||
193 | 52 | push(@files_stat, get_file_stat($file)); | ||
194 | 53 | } | ||
195 | 54 | |||
196 | 55 | $count = scalar(@files_stat); | ||
197 | 56 | $mid_n = 1; | ||
198 | 57 | $t = $files_stat[$mid_n]{'t'}; | ||
199 | 58 | while (($files_stat[$mid_n]{'t'} == $t) && ($mid_n < $count - 1)) {$mid_n++}; | ||
200 | 59 | print_file_stat(@files_stat[0], 'first'); | ||
201 | 60 | print_file_stat(@files_stat[-1], 'last'); | ||
202 | 61 | print_file_stat(@files_stat[$mid_n - 1], 'mid'); | ||
203 | 62 | |||
204 | 63 | open F, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/percona_archived_logs.tmp' or die "Cannot open file percona_archived_logs.tmp for write"; | ||
205 | 64 | printf F ("let \$archived_logs_count = %s;\n", $count); | ||
206 | 65 | printf F ("let \$archived_logs_mid = %s;\n", $mid_n); | ||
207 | 66 | close F; | ||
208 | 67 | |||
209 | 68 | EOF | ||
210 | 69 | |||
211 | 70 | --source $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp | ||
212 | 71 | remove_file $MYSQLTEST_VARDIR/tmp/percona_archived_logs.tmp; | ||
213 | 72 | |||
214 | 0 | 73 | ||
215 | === added file 'Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_workload.inc' | |||
216 | --- Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_workload.inc 1970-01-01 00:00:00 +0000 | |||
217 | +++ Percona-Server/mysql-test/suite/innodb/include/percona_log_archiving_workload.inc 2013-03-31 06:25:28 +0000 | |||
218 | @@ -0,0 +1,5 @@ | |||
219 | 1 | # | ||
220 | 2 | # Perform insert into table to produce some log records | ||
221 | 3 | # | ||
222 | 4 | |||
223 | 5 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
224 | 0 | 6 | ||
225 | === added file 'Percona-Server/mysql-test/suite/innodb/r/pecona_bug1155475.result' | |||
226 | --- Percona-Server/mysql-test/suite/innodb/r/pecona_bug1155475.result 1970-01-01 00:00:00 +0000 | |||
227 | +++ Percona-Server/mysql-test/suite/innodb/r/pecona_bug1155475.result 2013-03-31 06:25:28 +0000 | |||
228 | @@ -0,0 +1,23 @@ | |||
229 | 1 | call mtr.add_suppression("InnoDB: Resizing redo log"); | ||
230 | 2 | call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); | ||
231 | 3 | call mtr.add_suppression("InnoDB: New log files created"); | ||
232 | 4 | call 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"); | ||
233 | 5 | drop table if exists t; | ||
234 | 6 | create table t (a int not null) ENGINE=InnoDB; | ||
235 | 7 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
236 | 8 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
237 | 9 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
238 | 10 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
239 | 11 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
240 | 12 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
241 | 13 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
242 | 14 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
243 | 15 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
244 | 16 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
245 | 17 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
246 | 18 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
247 | 19 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
248 | 20 | Check OK | ||
249 | 21 | PURGE ARCHIVED LOGS BEFORE NOW(); | ||
250 | 22 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
251 | 23 | DROP TABLE t; | ||
252 | 0 | 24 | ||
253 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_innodb_log_archive_func.result' | |||
254 | --- Percona-Server/mysql-test/suite/innodb/r/percona_innodb_log_archive_func.result 1970-01-01 00:00:00 +0000 | |||
255 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_innodb_log_archive_func.result 2013-03-31 06:25:28 +0000 | |||
256 | @@ -0,0 +1,24 @@ | |||
257 | 1 | call mtr.add_suppression("InnoDB: Resizing redo log"); | ||
258 | 2 | call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); | ||
259 | 3 | call mtr.add_suppression("InnoDB: New log files created"); | ||
260 | 4 | call 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"); | ||
261 | 5 | drop table if exists t; | ||
262 | 6 | create table t (a int not null) ENGINE=InnoDB; | ||
263 | 7 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
264 | 8 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
265 | 9 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
266 | 10 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
267 | 11 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
268 | 12 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
269 | 13 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
270 | 14 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
271 | 15 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
272 | 16 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
273 | 17 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
274 | 18 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
275 | 19 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
276 | 20 | SET GLOBAL innodb_log_archive = OFF; | ||
277 | 21 | Check OK | ||
278 | 22 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
279 | 23 | SET GLOBAL innodb_log_archive = ON; | ||
280 | 24 | DROP TABLE t; | ||
281 | 0 | 25 | ||
282 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_expire_sec.result' | |||
283 | --- Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_expire_sec.result 1970-01-01 00:00:00 +0000 | |||
284 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_expire_sec.result 2013-03-31 06:25:28 +0000 | |||
285 | @@ -0,0 +1,27 @@ | |||
286 | 1 | call mtr.add_suppression("InnoDB: Resizing redo log"); | ||
287 | 2 | call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); | ||
288 | 3 | call mtr.add_suppression("InnoDB: New log files created"); | ||
289 | 4 | call 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"); | ||
290 | 5 | drop table if exists t; | ||
291 | 6 | create table t (a int not null) ENGINE=InnoDB; | ||
292 | 7 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
293 | 8 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
294 | 9 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
295 | 10 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
296 | 11 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
297 | 12 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
298 | 13 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
299 | 14 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
300 | 15 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
301 | 16 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
302 | 17 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
303 | 18 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
304 | 19 | SET @save_log_arch_expire_sec = @@innodb_log_arch_expire_sec; | ||
305 | 20 | SET GLOBAL innodb_log_arch_expire_sec = 1; | ||
306 | 21 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
307 | 22 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
308 | 23 | SELECT sleep(4); | ||
309 | 24 | sleep(4) | ||
310 | 25 | 0 | ||
311 | 26 | SET GLOBAL innodb_log_arch_expire_sec = @save_log_arch_expire_sec; | ||
312 | 27 | DROP TABLE t; | ||
313 | 0 | 28 | ||
314 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_func.result' | |||
315 | --- Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_func.result 1970-01-01 00:00:00 +0000 | |||
316 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_log_arch_func.result 2013-03-31 06:25:28 +0000 | |||
317 | @@ -0,0 +1,21 @@ | |||
318 | 1 | call mtr.add_suppression("InnoDB: Resizing redo log"); | ||
319 | 2 | call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); | ||
320 | 3 | call mtr.add_suppression("InnoDB: New log files created"); | ||
321 | 4 | call 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"); | ||
322 | 5 | drop table if exists t; | ||
323 | 6 | create table t (a int not null) ENGINE=InnoDB; | ||
324 | 7 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
325 | 8 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
326 | 9 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
327 | 10 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
328 | 11 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
329 | 12 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
330 | 13 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
331 | 14 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
332 | 15 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
333 | 16 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
334 | 17 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
335 | 18 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
336 | 19 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
337 | 20 | Check OK | ||
338 | 21 | DROP TABLE t; | ||
339 | 0 | 22 | ||
340 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_before.result' | |||
341 | --- Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_before.result 1970-01-01 00:00:00 +0000 | |||
342 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_before.result 2013-03-31 06:25:28 +0000 | |||
343 | @@ -0,0 +1,37 @@ | |||
344 | 1 | call mtr.add_suppression("InnoDB: Resizing redo log"); | ||
345 | 2 | call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); | ||
346 | 3 | call mtr.add_suppression("InnoDB: New log files created"); | ||
347 | 4 | call 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"); | ||
348 | 5 | drop table if exists t; | ||
349 | 6 | create table t (a int not null) ENGINE=InnoDB; | ||
350 | 7 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
351 | 8 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
352 | 9 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
353 | 10 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
354 | 11 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
355 | 12 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
356 | 13 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
357 | 14 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
358 | 15 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
359 | 16 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
360 | 17 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
361 | 18 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
362 | 19 | SELECT sleep(1); | ||
363 | 20 | sleep(1) | ||
364 | 21 | 0 | ||
365 | 22 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
366 | 23 | SELECT sleep(1); | ||
367 | 24 | sleep(1) | ||
368 | 25 | 0 | ||
369 | 26 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
370 | 27 | SELECT sleep(1); | ||
371 | 28 | sleep(1) | ||
372 | 29 | 0 | ||
373 | 30 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
374 | 31 | Check OK | ||
375 | 32 | PURGE ARCHIVED LOGS BEFORE 'val'; | ||
376 | 33 | PURGE ARCHIVED LOGS BEFORE NOW(); | ||
377 | 34 | PURGE ARCHIVED LOGS BEFORE DATE_ADD(NOW(), INTERVAL 7 DAY); | ||
378 | 35 | PURGE ARCHIVED LOGS BEFORE 'q'; | ||
379 | 36 | ERROR HY000: Unknown error during log purge | ||
380 | 37 | DROP TABLE t; | ||
381 | 0 | 38 | ||
382 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_to.result' | |||
383 | --- Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_to.result 1970-01-01 00:00:00 +0000 | |||
384 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_purge_archived_logs_to.result 2013-03-31 06:25:28 +0000 | |||
385 | @@ -0,0 +1,35 @@ | |||
386 | 1 | call mtr.add_suppression("InnoDB: Resizing redo log"); | ||
387 | 2 | call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); | ||
388 | 3 | call mtr.add_suppression("InnoDB: New log files created"); | ||
389 | 4 | call 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"); | ||
390 | 5 | drop table if exists t; | ||
391 | 6 | create table t (a int not null) ENGINE=InnoDB; | ||
392 | 7 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
393 | 8 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
394 | 9 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
395 | 10 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
396 | 11 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
397 | 12 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
398 | 13 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
399 | 14 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
400 | 15 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
401 | 16 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
402 | 17 | insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13); | ||
403 | 18 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
404 | 19 | SELECT sleep(1); | ||
405 | 20 | sleep(1) | ||
406 | 21 | 0 | ||
407 | 22 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
408 | 23 | SELECT sleep(1); | ||
409 | 24 | sleep(1) | ||
410 | 25 | 0 | ||
411 | 26 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
412 | 27 | SELECT sleep(1); | ||
413 | 28 | sleep(1) | ||
414 | 29 | 0 | ||
415 | 30 | insert into t (a) select t1.a from t t1, t t2, t t3 LIMIT 40000; | ||
416 | 31 | Check OK | ||
417 | 32 | PURGE ARCHIVED LOGS TO 'val'; | ||
418 | 33 | PURGE ARCHIVED LOGS TO '#invalid_file'; | ||
419 | 34 | ERROR HY000: Unknown error during log purge | ||
420 | 35 | DROP TABLE t; | ||
421 | 0 | 36 | ||
422 | === added file 'Percona-Server/mysql-test/suite/innodb/t/pecona_bug1155475.test' | |||
423 | --- Percona-Server/mysql-test/suite/innodb/t/pecona_bug1155475.test 1970-01-01 00:00:00 +0000 | |||
424 | +++ Percona-Server/mysql-test/suite/innodb/t/pecona_bug1155475.test 2013-03-31 06:25:28 +0000 | |||
425 | @@ -0,0 +1,30 @@ | |||
426 | 1 | # | ||
427 | 2 | # Test bug 1155475 | ||
428 | 3 | # | ||
429 | 4 | |||
430 | 5 | --source include/have_innodb.inc | ||
431 | 6 | --source include/not_embedded.inc | ||
432 | 7 | |||
433 | 8 | --source ../include/percona_log_archiving_setup.inc | ||
434 | 9 | |||
435 | 10 | --source ../include/percona_log_archiving_workload.inc | ||
436 | 11 | --source ../include/percona_log_archiving_check.inc | ||
437 | 12 | |||
438 | 13 | if ($archived_logs_count == 0) | ||
439 | 14 | { | ||
440 | 15 | die "0 archived logs have been produced"; | ||
441 | 16 | } | ||
442 | 17 | |||
443 | 18 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
444 | 19 | --shutdown_server | ||
445 | 20 | --source include/wait_until_disconnected.inc | ||
446 | 21 | --enable_reconnect | ||
447 | 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 | ||
448 | 23 | --source include/wait_until_connected_again.inc | ||
449 | 24 | |||
450 | 25 | PURGE ARCHIVED LOGS BEFORE NOW(); | ||
451 | 26 | |||
452 | 27 | # server shouldn't crash | ||
453 | 28 | --source ../include/percona_log_archiving_workload.inc | ||
454 | 29 | |||
455 | 30 | --source ../include/percona_log_archiving_cleanup.inc | ||
456 | 0 | 31 | ||
457 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_innodb_log_archive_func.test' | |||
458 | --- Percona-Server/mysql-test/suite/innodb/t/percona_innodb_log_archive_func.test 1970-01-01 00:00:00 +0000 | |||
459 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_innodb_log_archive_func.test 2013-03-31 06:25:28 +0000 | |||
460 | @@ -0,0 +1,31 @@ | |||
461 | 1 | # | ||
462 | 2 | # Test innodb_log_archive turning ON/OFF at runtime | ||
463 | 3 | # | ||
464 | 4 | |||
465 | 5 | --source include/have_innodb.inc | ||
466 | 6 | --source include/not_embedded.inc | ||
467 | 7 | |||
468 | 8 | --source ../include/percona_log_archiving_setup.inc | ||
469 | 9 | |||
470 | 10 | |||
471 | 11 | --source ../include/percona_log_archiving_workload.inc | ||
472 | 12 | |||
473 | 13 | SET GLOBAL innodb_log_archive = OFF; | ||
474 | 14 | |||
475 | 15 | --source ../include/percona_log_archiving_check.inc | ||
476 | 16 | |||
477 | 17 | let $count = $archived_logs_count; | ||
478 | 18 | |||
479 | 19 | --source ../include/percona_log_archiving_workload.inc | ||
480 | 20 | |||
481 | 21 | SET GLOBAL innodb_log_archive = ON; | ||
482 | 22 | |||
483 | 23 | --source ../include/percona_log_archiving_stat.inc | ||
484 | 24 | |||
485 | 25 | if ($count != $archived_logs_count) | ||
486 | 26 | { | ||
487 | 27 | die Test failed. Archived logs being written while innodb_log_archive being turned off.; | ||
488 | 28 | } | ||
489 | 29 | |||
490 | 30 | --source ../include/percona_log_archiving_cleanup.inc | ||
491 | 31 | |||
492 | 0 | 32 | ||
493 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_expire_sec.test' | |||
494 | --- Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_expire_sec.test 1970-01-01 00:00:00 +0000 | |||
495 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_expire_sec.test 2013-03-31 06:25:28 +0000 | |||
496 | @@ -0,0 +1,29 @@ | |||
497 | 1 | # | ||
498 | 2 | # Test innodb_log_archive_expire_sec | ||
499 | 3 | # | ||
500 | 4 | |||
501 | 5 | --source include/have_innodb.inc | ||
502 | 6 | --source include/not_embedded.inc | ||
503 | 7 | |||
504 | 8 | --source ../include/percona_log_archiving_setup.inc | ||
505 | 9 | |||
506 | 10 | SET @save_log_arch_expire_sec = @@innodb_log_arch_expire_sec; | ||
507 | 11 | SET GLOBAL innodb_log_arch_expire_sec = 1; | ||
508 | 12 | |||
509 | 13 | --source ../include/percona_log_archiving_workload.inc | ||
510 | 14 | |||
511 | 15 | --source ../include/percona_log_archiving_workload.inc | ||
512 | 16 | |||
513 | 17 | SELECT sleep(4); | ||
514 | 18 | |||
515 | 19 | --source ../include/percona_log_archiving_stat.inc | ||
516 | 20 | |||
517 | 21 | if ($archived_logs_count > 1) | ||
518 | 22 | { | ||
519 | 23 | die Test failed. Archived logs have nod been purged.; | ||
520 | 24 | } | ||
521 | 25 | |||
522 | 26 | SET GLOBAL innodb_log_arch_expire_sec = @save_log_arch_expire_sec; | ||
523 | 27 | |||
524 | 28 | --source ../include/percona_log_archiving_cleanup.inc | ||
525 | 29 | |||
526 | 0 | 30 | ||
527 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_func.test' | |||
528 | --- Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_func.test 1970-01-01 00:00:00 +0000 | |||
529 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_log_arch_func.test 2013-03-31 06:25:28 +0000 | |||
530 | @@ -0,0 +1,19 @@ | |||
531 | 1 | # | ||
532 | 2 | # Test that log archiving is working (produce some files at least) | ||
533 | 3 | # | ||
534 | 4 | |||
535 | 5 | --source include/have_innodb.inc | ||
536 | 6 | --source include/not_embedded.inc | ||
537 | 7 | |||
538 | 8 | --source ../include/percona_log_archiving_setup.inc | ||
539 | 9 | |||
540 | 10 | --source ../include/percona_log_archiving_workload.inc | ||
541 | 11 | --source ../include/percona_log_archiving_check.inc | ||
542 | 12 | |||
543 | 13 | if ($archived_logs_count == 0) | ||
544 | 14 | { | ||
545 | 15 | die "0 archived logs have been produced"; | ||
546 | 16 | } | ||
547 | 17 | |||
548 | 18 | --source ../include/percona_log_archiving_cleanup.inc | ||
549 | 19 | |||
550 | 0 | 20 | ||
551 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_before.test' | |||
552 | --- Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_before.test 1970-01-01 00:00:00 +0000 | |||
553 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_before.test 2013-03-31 06:25:28 +0000 | |||
554 | @@ -0,0 +1,43 @@ | |||
555 | 1 | # | ||
556 | 2 | # Test PURGE ARCHIVED LOGS BEFORE | ||
557 | 3 | # | ||
558 | 4 | |||
559 | 5 | --source include/have_innodb.inc | ||
560 | 6 | --source include/not_embedded.inc | ||
561 | 7 | |||
562 | 8 | --source ../include/percona_log_archiving_setup.inc | ||
563 | 9 | |||
564 | 10 | SELECT sleep(1); | ||
565 | 11 | --source ../include/percona_log_archiving_workload.inc | ||
566 | 12 | SELECT sleep(1); | ||
567 | 13 | --source ../include/percona_log_archiving_workload.inc | ||
568 | 14 | SELECT sleep(1); | ||
569 | 15 | --source ../include/percona_log_archiving_workload.inc | ||
570 | 16 | --source ../include/percona_log_archiving_check.inc | ||
571 | 17 | |||
572 | 18 | if ($archived_logs_count == 0) | ||
573 | 19 | { | ||
574 | 20 | die "0 archived logs have been produced"; | ||
575 | 21 | } | ||
576 | 22 | |||
577 | 23 | --replace_result $mid_log_file_modify val | ||
578 | 24 | --eval PURGE ARCHIVED LOGS BEFORE '$mid_log_file_modify' | ||
579 | 25 | |||
580 | 26 | let $count = `SELECT $archived_logs_count - $archived_logs_mid`; | ||
581 | 27 | |||
582 | 28 | --source ../include/percona_log_archiving_stat.inc | ||
583 | 29 | |||
584 | 30 | if ($archived_logs_count != $count) | ||
585 | 31 | { | ||
586 | 32 | die "PURGE ARCHIVED LOGS BEFORE failed"; | ||
587 | 33 | } | ||
588 | 34 | |||
589 | 35 | # check that it works with NOW() and other functions | ||
590 | 36 | PURGE ARCHIVED LOGS BEFORE NOW(); | ||
591 | 37 | PURGE ARCHIVED LOGS BEFORE DATE_ADD(NOW(), INTERVAL 7 DAY); | ||
592 | 38 | |||
593 | 39 | # should fail | ||
594 | 40 | --error 1379 | ||
595 | 41 | PURGE ARCHIVED LOGS BEFORE 'q'; | ||
596 | 42 | |||
597 | 43 | --source ../include/percona_log_archiving_cleanup.inc | ||
598 | 0 | 44 | ||
599 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_to.test' | |||
600 | --- Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_to.test 1970-01-01 00:00:00 +0000 | |||
601 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_purge_archived_logs_to.test 2013-03-31 06:25:28 +0000 | |||
602 | @@ -0,0 +1,39 @@ | |||
603 | 1 | # | ||
604 | 2 | # Test PURGE ARCHIVED LOGS TO | ||
605 | 3 | # | ||
606 | 4 | |||
607 | 5 | --source include/have_innodb.inc | ||
608 | 6 | --source include/not_embedded.inc | ||
609 | 7 | |||
610 | 8 | --source ../include/percona_log_archiving_setup.inc | ||
611 | 9 | |||
612 | 10 | SELECT sleep(1); | ||
613 | 11 | --source ../include/percona_log_archiving_workload.inc | ||
614 | 12 | SELECT sleep(1); | ||
615 | 13 | --source ../include/percona_log_archiving_workload.inc | ||
616 | 14 | SELECT sleep(1); | ||
617 | 15 | --source ../include/percona_log_archiving_workload.inc | ||
618 | 16 | --source ../include/percona_log_archiving_check.inc | ||
619 | 17 | |||
620 | 18 | if ($archived_logs_count == 0) | ||
621 | 19 | { | ||
622 | 20 | die "0 archived logs have been produced"; | ||
623 | 21 | } | ||
624 | 22 | |||
625 | 23 | --replace_result $mid_log_file val | ||
626 | 24 | --eval PURGE ARCHIVED LOGS TO '$mid_log_file' | ||
627 | 25 | |||
628 | 26 | let $count = `SELECT $archived_logs_count - $archived_logs_mid + 1`; | ||
629 | 27 | |||
630 | 28 | --source ../include/percona_log_archiving_stat.inc | ||
631 | 29 | |||
632 | 30 | if ($archived_logs_count != $count) | ||
633 | 31 | { | ||
634 | 32 | die "PURGE ARCHIVED LOGS TO failed"; | ||
635 | 33 | } | ||
636 | 34 | |||
637 | 35 | #should fail | ||
638 | 36 | --error 1379 | ||
639 | 37 | PURGE ARCHIVED LOGS TO '#invalid_file'; | ||
640 | 38 | |||
641 | 39 | --source ../include/percona_log_archiving_cleanup.inc | ||
642 | 0 | 40 | ||
643 | === added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result' | |||
644 | --- Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result 1970-01-01 00:00:00 +0000 | |||
645 | +++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_dir_basic.result 2013-03-31 06:25:28 +0000 | |||
646 | @@ -0,0 +1,38 @@ | |||
647 | 1 | SELECT @@GLOBAL.innodb_log_arch_dir; | ||
648 | 2 | @@GLOBAL.innodb_log_arch_dir | ||
649 | 3 | ./ | ||
650 | 4 | NULL Expected | ||
651 | 5 | SET @@GLOBAL.innodb_log_arch_dir=1; | ||
652 | 6 | ERROR HY000: Variable 'innodb_log_arch_dir' is a read only variable | ||
653 | 7 | Expected error 'Read only variable' | ||
654 | 8 | SELECT @@GLOBAL.innodb_log_arch_dir; | ||
655 | 9 | @@GLOBAL.innodb_log_arch_dir | ||
656 | 10 | ./ | ||
657 | 11 | NULL Expected | ||
658 | 12 | SELECT VARIABLE_VALUE | ||
659 | 13 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
660 | 14 | WHERE VARIABLE_NAME='innodb_log_arch_dir'; | ||
661 | 15 | VARIABLE_VALUE | ||
662 | 16 | ./ | ||
663 | 17 | empty string Expected | ||
664 | 18 | SELECT @@innodb_log_arch_dir; | ||
665 | 19 | @@innodb_log_arch_dir | ||
666 | 20 | ./ | ||
667 | 21 | NULL Expected | ||
668 | 22 | SELECT @@innodb_log_arch_dir; | ||
669 | 23 | @@innodb_log_arch_dir | ||
670 | 24 | ./ | ||
671 | 25 | NULL Expected | ||
672 | 26 | SELECT @@local.innodb_log_arch_dir; | ||
673 | 27 | ERROR HY000: Variable 'innodb_log_arch_dir' is a GLOBAL variable | ||
674 | 28 | Expected error 'Variable is a GLOBAL variable' | ||
675 | 29 | SELECT @@SESSION.innodb_log_arch_dir; | ||
676 | 30 | ERROR HY000: Variable 'innodb_log_arch_dir' is a GLOBAL variable | ||
677 | 31 | Expected error 'Variable is a GLOBAL variable' | ||
678 | 32 | SELECT @@GLOBAL.innodb_log_arch_dir; | ||
679 | 33 | @@GLOBAL.innodb_log_arch_dir | ||
680 | 34 | ./ | ||
681 | 35 | NULL Expected | ||
682 | 36 | SELECT innodb_log_arch_dir = @@SESSION.innodb_log_arch_dir; | ||
683 | 37 | ERROR 42S22: Unknown column 'innodb_log_arch_dir' in 'field list' | ||
684 | 38 | Expected error Unknown column 'innodb_log_arch_dir' in 'field list' | ||
685 | 0 | 39 | ||
686 | === added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result' | |||
687 | --- Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result 1970-01-01 00:00:00 +0000 | |||
688 | +++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_arch_expire_sec_basic.result 2013-03-31 06:25:28 +0000 | |||
689 | @@ -0,0 +1,38 @@ | |||
690 | 1 | SELECT @@GLOBAL.innodb_log_arch_expire_sec INTO @save; | ||
691 | 2 | SELECT @@GLOBAL.innodb_log_arch_expire_sec; | ||
692 | 3 | @@GLOBAL.innodb_log_arch_expire_sec | ||
693 | 4 | 0 | ||
694 | 5 | 0 Expected | ||
695 | 6 | SET @@GLOBAL.innodb_log_arch_expire_sec=1; | ||
696 | 7 | SELECT @@GLOBAL.innodb_log_arch_expire_sec; | ||
697 | 8 | @@GLOBAL.innodb_log_arch_expire_sec | ||
698 | 9 | 1 | ||
699 | 10 | 1 Expected | ||
700 | 11 | SELECT VARIABLE_VALUE | ||
701 | 12 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
702 | 13 | WHERE VARIABLE_NAME='innodb_log_arch_expire_sec'; | ||
703 | 14 | VARIABLE_VALUE | ||
704 | 15 | 1 | ||
705 | 16 | 1 Expected | ||
706 | 17 | SELECT @@innodb_log_arch_expire_sec; | ||
707 | 18 | @@innodb_log_arch_expire_sec | ||
708 | 19 | 1 | ||
709 | 20 | 1 Expected | ||
710 | 21 | SELECT @@innodb_log_arch_expire_sec; | ||
711 | 22 | @@innodb_log_arch_expire_sec | ||
712 | 23 | 1 | ||
713 | 24 | 1 Expected | ||
714 | 25 | SELECT @@local.innodb_log_arch_expire_sec; | ||
715 | 26 | ERROR HY000: Variable 'innodb_log_arch_expire_sec' is a GLOBAL variable | ||
716 | 27 | Expected error 'Variable is a GLOBAL variable' | ||
717 | 28 | SELECT @@SESSION.innodb_log_arch_expire_sec; | ||
718 | 29 | ERROR HY000: Variable 'innodb_log_arch_expire_sec' is a GLOBAL variable | ||
719 | 30 | Expected error 'Variable is a GLOBAL variable' | ||
720 | 31 | SELECT @@GLOBAL.innodb_log_arch_expire_sec; | ||
721 | 32 | @@GLOBAL.innodb_log_arch_expire_sec | ||
722 | 33 | 1 | ||
723 | 34 | 1 Expected | ||
724 | 35 | SELECT innodb_log_arch_expire_sec = @@SESSION.innodb_log_arch_expire_sec; | ||
725 | 36 | ERROR 42S22: Unknown column 'innodb_log_arch_expire_sec' in 'field list' | ||
726 | 37 | Expected error Unknown column 'innodb_log_arch_expire_sec' in 'field list' | ||
727 | 38 | SET @@GLOBAL.innodb_log_arch_expire_sec = @save; | ||
728 | 0 | 39 | ||
729 | === added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result' | |||
730 | --- Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result 1970-01-01 00:00:00 +0000 | |||
731 | +++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_log_archive_basic.result 2013-03-31 06:25:28 +0000 | |||
732 | @@ -0,0 +1,38 @@ | |||
733 | 1 | SELECT @@GLOBAL.innodb_log_archive; | ||
734 | 2 | @@GLOBAL.innodb_log_archive | ||
735 | 3 | 0 | ||
736 | 4 | 0 Expected | ||
737 | 5 | SET @save_innodb_log_archive = @@GLOBAL.innodb_log_archive; | ||
738 | 6 | SET @@GLOBAL.innodb_log_archive=1; | ||
739 | 7 | SELECT @@GLOBAL.innodb_log_archive; | ||
740 | 8 | @@GLOBAL.innodb_log_archive | ||
741 | 9 | 1 | ||
742 | 10 | 1 Expected | ||
743 | 11 | SELECT VARIABLE_VALUE | ||
744 | 12 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
745 | 13 | WHERE VARIABLE_NAME='innodb_log_archive'; | ||
746 | 14 | VARIABLE_VALUE | ||
747 | 15 | ON | ||
748 | 16 | ON Expected | ||
749 | 17 | SET @@GLOBAL.innodb_log_archive = @save_innodb_log_archive; | ||
750 | 18 | SELECT @@innodb_log_archive; | ||
751 | 19 | @@innodb_log_archive | ||
752 | 20 | 0 | ||
753 | 21 | 0 Expected | ||
754 | 22 | SELECT @@innodb_log_archive; | ||
755 | 23 | @@innodb_log_archive | ||
756 | 24 | 0 | ||
757 | 25 | 0 Expected | ||
758 | 26 | SELECT @@local.innodb_log_archive; | ||
759 | 27 | ERROR HY000: Variable 'innodb_log_archive' is a GLOBAL variable | ||
760 | 28 | Expected error 'Variable is a GLOBAL variable' | ||
761 | 29 | SELECT @@SESSION.innodb_log_archive; | ||
762 | 30 | ERROR HY000: Variable 'innodb_log_archive' is a GLOBAL variable | ||
763 | 31 | Expected error 'Variable is a GLOBAL variable' | ||
764 | 32 | SELECT @@GLOBAL.innodb_log_archive; | ||
765 | 33 | @@GLOBAL.innodb_log_archive | ||
766 | 34 | 0 | ||
767 | 35 | 0 Expected | ||
768 | 36 | SELECT innodb_log_archive = @@SESSION.innodb_log_archive; | ||
769 | 37 | ERROR 42S22: Unknown column 'innodb_log_archive' in 'field list' | ||
770 | 38 | Expected error Unknown column 'innodb_log_archive' in 'field list' | ||
771 | 0 | 39 | ||
772 | === added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test' | |||
773 | --- Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test 1970-01-01 00:00:00 +0000 | |||
774 | +++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_dir_basic.test 2013-03-31 06:25:28 +0000 | |||
775 | @@ -0,0 +1,60 @@ | |||
776 | 1 | ####################################################### | ||
777 | 2 | # Basic test for innodb_log_arch_dir variable # | ||
778 | 3 | ####################################################### | ||
779 | 4 | |||
780 | 5 | --source include/have_innodb.inc | ||
781 | 6 | |||
782 | 7 | #################################################################### | ||
783 | 8 | # Displaying default value # | ||
784 | 9 | #################################################################### | ||
785 | 10 | SELECT @@GLOBAL.innodb_log_arch_dir; | ||
786 | 11 | --echo NULL Expected | ||
787 | 12 | |||
788 | 13 | |||
789 | 14 | #################################################################### | ||
790 | 15 | # Check if Value can set # | ||
791 | 16 | #################################################################### | ||
792 | 17 | |||
793 | 18 | --error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
794 | 19 | SET @@GLOBAL.innodb_log_arch_dir=1; | ||
795 | 20 | --echo Expected error 'Read only variable' | ||
796 | 21 | |||
797 | 22 | SELECT @@GLOBAL.innodb_log_arch_dir; | ||
798 | 23 | --echo NULL Expected | ||
799 | 24 | |||
800 | 25 | SELECT VARIABLE_VALUE | ||
801 | 26 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
802 | 27 | WHERE VARIABLE_NAME='innodb_log_arch_dir'; | ||
803 | 28 | --echo empty string Expected | ||
804 | 29 | |||
805 | 30 | ############################################ | ||
806 | 31 | # Check accessing variable without GLOBAL # | ||
807 | 32 | ############################################ | ||
808 | 33 | SELECT @@innodb_log_arch_dir; | ||
809 | 34 | --echo NULL Expected | ||
810 | 35 | |||
811 | 36 | |||
812 | 37 | |||
813 | 38 | ########################################################################## | ||
814 | 39 | # Check if innodb_log_arch_dir can be accessed without @@ sign # | ||
815 | 40 | ########################################################################## | ||
816 | 41 | |||
817 | 42 | SELECT @@innodb_log_arch_dir; | ||
818 | 43 | --echo NULL Expected | ||
819 | 44 | |||
820 | 45 | --Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
821 | 46 | SELECT @@local.innodb_log_arch_dir; | ||
822 | 47 | --echo Expected error 'Variable is a GLOBAL variable' | ||
823 | 48 | |||
824 | 49 | --Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
825 | 50 | SELECT @@SESSION.innodb_log_arch_dir; | ||
826 | 51 | --echo Expected error 'Variable is a GLOBAL variable' | ||
827 | 52 | |||
828 | 53 | SELECT @@GLOBAL.innodb_log_arch_dir; | ||
829 | 54 | --echo NULL Expected | ||
830 | 55 | |||
831 | 56 | --Error ER_BAD_FIELD_ERROR | ||
832 | 57 | SELECT innodb_log_arch_dir = @@SESSION.innodb_log_arch_dir; | ||
833 | 58 | --echo Expected error Unknown column 'innodb_log_arch_dir' in 'field list' | ||
834 | 59 | |||
835 | 60 | |||
836 | 0 | 61 | ||
837 | === added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test' | |||
838 | --- Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test 1970-01-01 00:00:00 +0000 | |||
839 | +++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_arch_expire_sec_basic.test 2013-03-31 06:25:28 +0000 | |||
840 | @@ -0,0 +1,60 @@ | |||
841 | 1 | ############################################################### | ||
842 | 2 | # Basic test for innodb_log_arch_expire_sec variable # | ||
843 | 3 | ############################################################### | ||
844 | 4 | |||
845 | 5 | --source include/have_innodb.inc | ||
846 | 6 | |||
847 | 7 | SELECT @@GLOBAL.innodb_log_arch_expire_sec INTO @save; | ||
848 | 8 | |||
849 | 9 | #################################################################### | ||
850 | 10 | # Displaying default value # | ||
851 | 11 | #################################################################### | ||
852 | 12 | SELECT @@GLOBAL.innodb_log_arch_expire_sec; | ||
853 | 13 | --echo 0 Expected | ||
854 | 14 | |||
855 | 15 | |||
856 | 16 | #################################################################### | ||
857 | 17 | # Check if Value can set # | ||
858 | 18 | #################################################################### | ||
859 | 19 | |||
860 | 20 | SET @@GLOBAL.innodb_log_arch_expire_sec=1; | ||
861 | 21 | |||
862 | 22 | SELECT @@GLOBAL.innodb_log_arch_expire_sec; | ||
863 | 23 | --echo 1 Expected | ||
864 | 24 | |||
865 | 25 | SELECT VARIABLE_VALUE | ||
866 | 26 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
867 | 27 | WHERE VARIABLE_NAME='innodb_log_arch_expire_sec'; | ||
868 | 28 | --echo 1 Expected | ||
869 | 29 | |||
870 | 30 | ############################################ | ||
871 | 31 | # Check accessing variable without GLOBAL # | ||
872 | 32 | ############################################ | ||
873 | 33 | SELECT @@innodb_log_arch_expire_sec; | ||
874 | 34 | --echo 1 Expected | ||
875 | 35 | |||
876 | 36 | |||
877 | 37 | |||
878 | 38 | ################################################################################## | ||
879 | 39 | # Check if innodb_log_arch_expire_sec can be accessed without @@ sign # | ||
880 | 40 | ################################################################################## | ||
881 | 41 | |||
882 | 42 | SELECT @@innodb_log_arch_expire_sec; | ||
883 | 43 | --echo 1 Expected | ||
884 | 44 | |||
885 | 45 | --Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
886 | 46 | SELECT @@local.innodb_log_arch_expire_sec; | ||
887 | 47 | --echo Expected error 'Variable is a GLOBAL variable' | ||
888 | 48 | |||
889 | 49 | --Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
890 | 50 | SELECT @@SESSION.innodb_log_arch_expire_sec; | ||
891 | 51 | --echo Expected error 'Variable is a GLOBAL variable' | ||
892 | 52 | |||
893 | 53 | SELECT @@GLOBAL.innodb_log_arch_expire_sec; | ||
894 | 54 | --echo 1 Expected | ||
895 | 55 | |||
896 | 56 | --Error ER_BAD_FIELD_ERROR | ||
897 | 57 | SELECT innodb_log_arch_expire_sec = @@SESSION.innodb_log_arch_expire_sec; | ||
898 | 58 | --echo Expected error Unknown column 'innodb_log_arch_expire_sec' in 'field list' | ||
899 | 59 | |||
900 | 60 | SET @@GLOBAL.innodb_log_arch_expire_sec = @save; | ||
901 | 0 | 61 | ||
902 | === added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test' | |||
903 | --- Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test 1970-01-01 00:00:00 +0000 | |||
904 | +++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_log_archive_basic.test 2013-03-31 06:25:28 +0000 | |||
905 | @@ -0,0 +1,61 @@ | |||
906 | 1 | ################################################### | ||
907 | 2 | # Basic test for innodb_log_archive variable # | ||
908 | 3 | ################################################### | ||
909 | 4 | |||
910 | 5 | --source include/have_innodb.inc | ||
911 | 6 | |||
912 | 7 | #################################################################### | ||
913 | 8 | # Displaying default value # | ||
914 | 9 | #################################################################### | ||
915 | 10 | SELECT @@GLOBAL.innodb_log_archive; | ||
916 | 11 | --echo 0 Expected | ||
917 | 12 | |||
918 | 13 | |||
919 | 14 | #################################################################### | ||
920 | 15 | # Check if Value can set # | ||
921 | 16 | #################################################################### | ||
922 | 17 | |||
923 | 18 | SET @save_innodb_log_archive = @@GLOBAL.innodb_log_archive; | ||
924 | 19 | SET @@GLOBAL.innodb_log_archive=1; | ||
925 | 20 | |||
926 | 21 | SELECT @@GLOBAL.innodb_log_archive; | ||
927 | 22 | --echo 1 Expected | ||
928 | 23 | |||
929 | 24 | SELECT VARIABLE_VALUE | ||
930 | 25 | FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
931 | 26 | WHERE VARIABLE_NAME='innodb_log_archive'; | ||
932 | 27 | --echo ON Expected | ||
933 | 28 | |||
934 | 29 | SET @@GLOBAL.innodb_log_archive = @save_innodb_log_archive; | ||
935 | 30 | |||
936 | 31 | ############################################ | ||
937 | 32 | # Check accessing variable without GLOBAL # | ||
938 | 33 | ############################################ | ||
939 | 34 | SELECT @@innodb_log_archive; | ||
940 | 35 | --echo 0 Expected | ||
941 | 36 | |||
942 | 37 | |||
943 | 38 | |||
944 | 39 | ########################################################################## | ||
945 | 40 | # Check if innodb_log_archive can be accessed without @@ sign # | ||
946 | 41 | ########################################################################## | ||
947 | 42 | |||
948 | 43 | SELECT @@innodb_log_archive; | ||
949 | 44 | --echo 0 Expected | ||
950 | 45 | |||
951 | 46 | --Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
952 | 47 | SELECT @@local.innodb_log_archive; | ||
953 | 48 | --echo Expected error 'Variable is a GLOBAL variable' | ||
954 | 49 | |||
955 | 50 | --Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
956 | 51 | SELECT @@SESSION.innodb_log_archive; | ||
957 | 52 | --echo Expected error 'Variable is a GLOBAL variable' | ||
958 | 53 | |||
959 | 54 | SELECT @@GLOBAL.innodb_log_archive; | ||
960 | 55 | --echo 0 Expected | ||
961 | 56 | |||
962 | 57 | --Error ER_BAD_FIELD_ERROR | ||
963 | 58 | SELECT innodb_log_archive = @@SESSION.innodb_log_archive; | ||
964 | 59 | --echo Expected error Unknown column 'innodb_log_archive' in 'field list' | ||
965 | 60 | |||
966 | 61 | |||
967 | 0 | 62 | ||
968 | === modified file 'Percona-Server/sql/handler.cc' | |||
969 | --- Percona-Server/sql/handler.cc 2013-03-05 12:46:43 +0000 | |||
970 | +++ Percona-Server/sql/handler.cc 2013-03-31 06:25:28 +0000 | |||
971 | @@ -6867,6 +6867,48 @@ | |||
972 | 6867 | return result; | 6867 | return result; |
973 | 6868 | } | 6868 | } |
974 | 6869 | 6869 | ||
975 | 6870 | static my_bool purge_archive_logs_handlerton(THD *thd, plugin_ref plugin, | ||
976 | 6871 | void *arg) | ||
977 | 6872 | { | ||
978 | 6873 | ulong before_timestamp= *(ulong*) arg; | ||
979 | 6874 | handlerton *hton= plugin_data(plugin, handlerton *); | ||
980 | 6875 | |||
981 | 6876 | if (hton->purge_archive_logs == NULL) | ||
982 | 6877 | return FALSE; | ||
983 | 6878 | |||
984 | 6879 | return hton->purge_archive_logs(hton, before_timestamp, NULL); | ||
985 | 6880 | } | ||
986 | 6881 | |||
987 | 6882 | bool ha_purge_archive_logs(THD *thd, handlerton *db_type, void* args) | ||
988 | 6883 | { | ||
989 | 6884 | if (db_type == NULL) | ||
990 | 6885 | return plugin_foreach(thd, purge_archive_logs_handlerton, | ||
991 | 6886 | MYSQL_STORAGE_ENGINE_PLUGIN, args); | ||
992 | 6887 | |||
993 | 6888 | return false; | ||
994 | 6889 | } | ||
995 | 6890 | |||
996 | 6891 | static my_bool purge_archive_logs_to_handlerton(THD *thd, plugin_ref plugin, | ||
997 | 6892 | void *arg) | ||
998 | 6893 | { | ||
999 | 6894 | const char* to_filename= (const char*) arg; | ||
1000 | 6895 | handlerton *hton= plugin_data(plugin, handlerton *); | ||
1001 | 6896 | |||
1002 | 6897 | if (hton->purge_archive_logs == NULL) | ||
1003 | 6898 | return FALSE; | ||
1004 | 6899 | |||
1005 | 6900 | return hton->purge_archive_logs(hton, 0, to_filename); | ||
1006 | 6901 | } | ||
1007 | 6902 | |||
1008 | 6903 | bool ha_purge_archive_logs_to(THD *thd, handlerton *db_type, void* args) | ||
1009 | 6904 | { | ||
1010 | 6905 | if (db_type == NULL) | ||
1011 | 6906 | return plugin_foreach(thd, purge_archive_logs_to_handlerton, | ||
1012 | 6907 | MYSQL_STORAGE_ENGINE_PLUGIN, args); | ||
1013 | 6908 | |||
1014 | 6909 | return false; | ||
1015 | 6910 | } | ||
1016 | 6911 | |||
1017 | 6870 | /* | 6912 | /* |
1018 | 6871 | Function to check if the conditions for row-based binlogging is | 6913 | Function to check if the conditions for row-based binlogging is |
1019 | 6872 | correct for the table. | 6914 | correct for the table. |
1020 | 6873 | 6915 | ||
1021 | === modified file 'Percona-Server/sql/handler.h' | |||
1022 | --- Percona-Server/sql/handler.h 2013-03-05 12:46:43 +0000 | |||
1023 | +++ Percona-Server/sql/handler.h 2013-03-31 06:25:28 +0000 | |||
1024 | @@ -881,6 +881,9 @@ | |||
1025 | 881 | int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, | 881 | int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, |
1026 | 882 | class Item *cond, | 882 | class Item *cond, |
1027 | 883 | enum enum_schema_tables); | 883 | enum enum_schema_tables); |
1028 | 884 | bool (*purge_archive_logs)(handlerton *hton, time_t before_date, | ||
1029 | 885 | const char* to_filename); | ||
1030 | 886 | |||
1031 | 884 | uint32 flags; /* global handler flags */ | 887 | uint32 flags; /* global handler flags */ |
1032 | 885 | /* | 888 | /* |
1033 | 886 | Those handlerton functions below are properly initialized at handler | 889 | Those handlerton functions below are properly initialized at handler |
1034 | @@ -3375,6 +3378,11 @@ | |||
1035 | 3375 | int ha_prepare(THD *thd); | 3378 | int ha_prepare(THD *thd); |
1036 | 3376 | int ha_recover(HASH *commit_list); | 3379 | int ha_recover(HASH *commit_list); |
1037 | 3377 | 3380 | ||
1038 | 3381 | /* remove old archived transaction logs files */ | ||
1039 | 3382 | bool ha_purge_archive_logs(THD *thd, handlerton *db_type, void* args); | ||
1040 | 3383 | bool ha_purge_archive_logs_to(THD *thd, handlerton *db_type, void* args); | ||
1041 | 3384 | |||
1042 | 3385 | |||
1043 | 3378 | /* | 3386 | /* |
1044 | 3379 | transactions: interface to low-level handlerton functions. These are | 3387 | transactions: interface to low-level handlerton functions. These are |
1045 | 3380 | intended to be used by the transaction coordinators to | 3388 | intended to be used by the transaction coordinators to |
1046 | 3381 | 3389 | ||
1047 | === modified file 'Percona-Server/sql/lex.h' | |||
1048 | --- Percona-Server/sql/lex.h 2013-03-05 12:46:43 +0000 | |||
1049 | +++ Percona-Server/sql/lex.h 2013-03-31 06:25:28 +0000 | |||
1050 | @@ -69,6 +69,7 @@ | |||
1051 | 69 | { "ANALYZE", SYM(ANALYZE_SYM)}, // this one is for ANALYZE TABLE etc | 69 | { "ANALYZE", SYM(ANALYZE_SYM)}, // this one is for ANALYZE TABLE etc |
1052 | 70 | { "AND", SYM(AND_SYM)}, | 70 | { "AND", SYM(AND_SYM)}, |
1053 | 71 | { "ANY", SYM(ANY_SYM)}, | 71 | { "ANY", SYM(ANY_SYM)}, |
1054 | 72 | { "ARCHIVED", SYM(ARCHIVED_SYM)}, | ||
1055 | 72 | { "AS", SYM(AS)}, | 73 | { "AS", SYM(AS)}, |
1056 | 73 | { "ASC", SYM(ASC)}, | 74 | { "ASC", SYM(ASC)}, |
1057 | 74 | { "ASCII", SYM(ASCII_SYM)}, | 75 | { "ASCII", SYM(ASCII_SYM)}, |
1058 | 75 | 76 | ||
1059 | === modified file 'Percona-Server/sql/mysqld.cc' | |||
1060 | --- Percona-Server/sql/mysqld.cc 2013-03-05 12:46:43 +0000 | |||
1061 | +++ Percona-Server/sql/mysqld.cc 2013-03-31 06:25:28 +0000 | |||
1062 | @@ -3418,6 +3418,8 @@ | |||
1063 | 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}, |
1064 | 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}, |
1065 | 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}, |
1066 | 3421 | {"purge_archived", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_ARCHIVE]), SHOW_LONG_STATUS}, | ||
1067 | 3422 | {"purge_archived_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_ARCHIVE_BEFORE]), SHOW_LONG_STATUS}, | ||
1068 | 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}, |
1069 | 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}, |
1070 | 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}, |
1071 | 3424 | 3426 | ||
1072 | === modified file 'Percona-Server/sql/sql_cmd.h' | |||
1073 | --- Percona-Server/sql/sql_cmd.h 2012-12-04 08:24:59 +0000 | |||
1074 | +++ Percona-Server/sql/sql_cmd.h 2013-03-31 06:25:28 +0000 | |||
1075 | @@ -89,6 +89,8 @@ | |||
1076 | 89 | SQLCOM_SHOW_RELAYLOG_EVENTS, | 89 | SQLCOM_SHOW_RELAYLOG_EVENTS, |
1077 | 90 | SQLCOM_GET_DIAGNOSTICS, | 90 | SQLCOM_GET_DIAGNOSTICS, |
1078 | 91 | SQLCOM_ALTER_USER, | 91 | SQLCOM_ALTER_USER, |
1079 | 92 | SQLCOM_PURGE_ARCHIVE, | ||
1080 | 93 | SQLCOM_PURGE_ARCHIVE_BEFORE, | ||
1081 | 92 | /* | 94 | /* |
1082 | 93 | When a command is added here, be sure it's also added in mysqld.cc | 95 | When a command is added here, be sure it's also added in mysqld.cc |
1083 | 94 | in "struct show_var_st status_vars[]= {" ... | 96 | in "struct show_var_st status_vars[]= {" ... |
1084 | 95 | 97 | ||
1085 | === modified file 'Percona-Server/sql/sql_parse.cc' | |||
1086 | --- Percona-Server/sql/sql_parse.cc 2013-03-05 12:46:43 +0000 | |||
1087 | +++ Percona-Server/sql/sql_parse.cc 2013-03-31 06:25:28 +0000 | |||
1088 | @@ -2655,6 +2655,49 @@ | |||
1089 | 2655 | res = purge_master_logs_before_date(thd, (ulong)it->val_int()); | 2655 | res = purge_master_logs_before_date(thd, (ulong)it->val_int()); |
1090 | 2656 | break; | 2656 | break; |
1091 | 2657 | } | 2657 | } |
1092 | 2658 | case SQLCOM_PURGE_ARCHIVE: | ||
1093 | 2659 | { | ||
1094 | 2660 | if (check_global_access(thd, SUPER_ACL)) | ||
1095 | 2661 | goto error; | ||
1096 | 2662 | /* PURGE ARCHIVED LOGS TO 'file' */ | ||
1097 | 2663 | if (!ha_purge_archive_logs_to(NULL, NULL, lex->to_log)) { | ||
1098 | 2664 | my_ok(thd); | ||
1099 | 2665 | } else { | ||
1100 | 2666 | my_error(ER_LOG_PURGE_UNKNOWN_ERR, MYF(0), "PURGE ARCHIVE LOGS TO"); | ||
1101 | 2667 | goto error; | ||
1102 | 2668 | } | ||
1103 | 2669 | |||
1104 | 2670 | break; | ||
1105 | 2671 | } | ||
1106 | 2672 | case SQLCOM_PURGE_ARCHIVE_BEFORE: | ||
1107 | 2673 | { | ||
1108 | 2674 | Item *it; | ||
1109 | 2675 | |||
1110 | 2676 | if (check_global_access(thd, SUPER_ACL)) | ||
1111 | 2677 | goto error; | ||
1112 | 2678 | /* PURGE ARCHIVE LOGS BEFORE 'data' */ | ||
1113 | 2679 | it= (Item *)lex->value_list.head(); | ||
1114 | 2680 | if ((!it->fixed && it->fix_fields(lex->thd, &it)) || | ||
1115 | 2681 | it->check_cols(1)) | ||
1116 | 2682 | { | ||
1117 | 2683 | my_error(ER_WRONG_ARGUMENTS, MYF(0), "PURGE ARCHIVE LOGS BEFORE"); | ||
1118 | 2684 | goto error; | ||
1119 | 2685 | } | ||
1120 | 2686 | it= new Item_func_unix_timestamp(it); | ||
1121 | 2687 | /* | ||
1122 | 2688 | it is OK only emulate fix_fieds, because we need only | ||
1123 | 2689 | value of constant | ||
1124 | 2690 | */ | ||
1125 | 2691 | it->quick_fix_field(); | ||
1126 | 2692 | ulong before_timestamp = (ulong)it->val_int(); | ||
1127 | 2693 | if (!ha_purge_archive_logs(NULL, NULL, &before_timestamp )) { | ||
1128 | 2694 | my_ok(thd); | ||
1129 | 2695 | } else { | ||
1130 | 2696 | my_error(ER_LOG_PURGE_UNKNOWN_ERR, MYF(0), "PURGE ARCHIVE LOGS BEFORE"); | ||
1131 | 2697 | goto error; | ||
1132 | 2698 | } | ||
1133 | 2699 | break; | ||
1134 | 2700 | } | ||
1135 | 2658 | #endif | 2701 | #endif |
1136 | 2659 | case SQLCOM_SHOW_WARNS: | 2702 | case SQLCOM_SHOW_WARNS: |
1137 | 2660 | { | 2703 | { |
1138 | 2661 | 2704 | ||
1139 | === modified file 'Percona-Server/sql/sql_yacc.yy' | |||
1140 | --- Percona-Server/sql/sql_yacc.yy 2013-03-05 12:46:43 +0000 | |||
1141 | +++ Percona-Server/sql/sql_yacc.yy 2013-03-31 06:25:28 +0000 | |||
1142 | @@ -1064,6 +1064,7 @@ | |||
1143 | 1064 | %token AND_AND_SYM /* OPERATOR */ | 1064 | %token AND_AND_SYM /* OPERATOR */ |
1144 | 1065 | %token AND_SYM /* SQL-2003-R */ | 1065 | %token AND_SYM /* SQL-2003-R */ |
1145 | 1066 | %token ANY_SYM /* SQL-2003-R */ | 1066 | %token ANY_SYM /* SQL-2003-R */ |
1146 | 1067 | %token ARCHIVED_SYM /* MYSQL */ | ||
1147 | 1067 | %token AS /* SQL-2003-R */ | 1068 | %token AS /* SQL-2003-R */ |
1148 | 1068 | %token ASC /* SQL-2003-N */ | 1069 | %token ASC /* SQL-2003-N */ |
1149 | 1069 | %token ASCII_SYM /* MYSQL-FUNC */ | 1070 | %token ASCII_SYM /* MYSQL-FUNC */ |
1150 | @@ -12942,7 +12943,8 @@ | |||
1151 | 12942 | ; | 12943 | ; |
1152 | 12943 | 12944 | ||
1153 | 12944 | purge_options: | 12945 | purge_options: |
1155 | 12945 | master_or_binary LOGS_SYM purge_option | 12946 | ARCHIVED_SYM LOGS_SYM purge_archive_option |
1156 | 12947 | | master_or_binary LOGS_SYM purge_option | ||
1157 | 12946 | ; | 12948 | ; |
1158 | 12947 | 12949 | ||
1159 | 12948 | purge_option: | 12950 | purge_option: |
1160 | @@ -12959,6 +12961,21 @@ | |||
1161 | 12959 | } | 12961 | } |
1162 | 12960 | ; | 12962 | ; |
1163 | 12961 | 12963 | ||
1164 | 12964 | purge_archive_option: | ||
1165 | 12965 | TO_SYM TEXT_STRING_sys | ||
1166 | 12966 | { | ||
1167 | 12967 | Lex->to_log = $2.str; | ||
1168 | 12968 | Lex->sql_command= SQLCOM_PURGE_ARCHIVE; | ||
1169 | 12969 | } | ||
1170 | 12970 | | BEFORE_SYM expr | ||
1171 | 12971 | { | ||
1172 | 12972 | LEX *lex= Lex; | ||
1173 | 12973 | lex->value_list.empty(); | ||
1174 | 12974 | lex->value_list.push_front($2); | ||
1175 | 12975 | lex->sql_command= SQLCOM_PURGE_ARCHIVE_BEFORE; | ||
1176 | 12976 | } | ||
1177 | 12977 | ; | ||
1178 | 12978 | |||
1179 | 12962 | /* kill threads */ | 12979 | /* kill threads */ |
1180 | 12963 | 12980 | ||
1181 | 12964 | kill: | 12981 | kill: |
1182 | @@ -14080,6 +14097,7 @@ | |||
1183 | 14080 | | AGGREGATE_SYM {} | 14097 | | AGGREGATE_SYM {} |
1184 | 14081 | | ALGORITHM_SYM {} | 14098 | | ALGORITHM_SYM {} |
1185 | 14082 | | ANALYSE_SYM {} | 14099 | | ANALYSE_SYM {} |
1186 | 14100 | | ARCHIVED_SYM {} | ||
1187 | 14083 | | ANY_SYM {} | 14101 | | ANY_SYM {} |
1188 | 14084 | | AT_SYM {} | 14102 | | AT_SYM {} |
1189 | 14085 | | AUTO_INC {} | 14103 | | AUTO_INC {} |
1190 | 14086 | 14104 | ||
1191 | === modified file 'Percona-Server/storage/innobase/fil/fil0fil.cc' | |||
1192 | --- Percona-Server/storage/innobase/fil/fil0fil.cc 2013-03-05 12:46:43 +0000 | |||
1193 | +++ Percona-Server/storage/innobase/fil/fil0fil.cc 2013-03-31 06:25:28 +0000 | |||
1194 | @@ -1211,6 +1211,39 @@ | |||
1195 | 1211 | 1211 | ||
1196 | 1212 | mutex_exit(&fil_system->mutex); | 1212 | mutex_exit(&fil_system->mutex); |
1197 | 1213 | } | 1213 | } |
1198 | 1214 | |||
1199 | 1215 | /****************************************************************//** | ||
1200 | 1216 | Check is there node in file space with given name. */ | ||
1201 | 1217 | UNIV_INTERN | ||
1202 | 1218 | ibool | ||
1203 | 1219 | fil_space_contains_node( | ||
1204 | 1220 | /*====================*/ | ||
1205 | 1221 | ulint id, /*!< in: space id */ | ||
1206 | 1222 | char* node_name) /*!< in: node name */ | ||
1207 | 1223 | { | ||
1208 | 1224 | fil_node_t* node; | ||
1209 | 1225 | fil_space_t* space; | ||
1210 | 1226 | |||
1211 | 1227 | mutex_enter(&fil_system->mutex); | ||
1212 | 1228 | |||
1213 | 1229 | space = fil_space_get_by_id(id); | ||
1214 | 1230 | |||
1215 | 1231 | ut_a(space); | ||
1216 | 1232 | |||
1217 | 1233 | for (node = UT_LIST_GET_FIRST(space->chain); node != NULL; | ||
1218 | 1234 | node = UT_LIST_GET_NEXT(chain, node)) { | ||
1219 | 1235 | |||
1220 | 1236 | if (ut_strcmp(node->name, node_name) == 0) { | ||
1221 | 1237 | mutex_exit(&fil_system->mutex); | ||
1222 | 1238 | return(TRUE); | ||
1223 | 1239 | } | ||
1224 | 1240 | |||
1225 | 1241 | } | ||
1226 | 1242 | |||
1227 | 1243 | mutex_exit(&fil_system->mutex); | ||
1228 | 1244 | return(FALSE); | ||
1229 | 1245 | } | ||
1230 | 1246 | |||
1231 | 1214 | #endif /* UNIV_LOG_ARCHIVE */ | 1247 | #endif /* UNIV_LOG_ARCHIVE */ |
1232 | 1215 | 1248 | ||
1233 | 1216 | /*******************************************************************//** | 1249 | /*******************************************************************//** |
1234 | @@ -1942,12 +1975,6 @@ | |||
1235 | 1942 | contain sensible data */ | 1975 | contain sensible data */ |
1236 | 1943 | ulint* flags, /*!< out: tablespace flags */ | 1976 | ulint* flags, /*!< out: tablespace flags */ |
1237 | 1944 | ulint* space_id, /*!< out: tablespace ID */ | 1977 | ulint* space_id, /*!< out: tablespace ID */ |
1238 | 1945 | #ifdef UNIV_LOG_ARCHIVE | ||
1239 | 1946 | ulint* min_arch_log_no, /*!< out: min of archived | ||
1240 | 1947 | log numbers in data files */ | ||
1241 | 1948 | ulint* max_arch_log_no, /*!< out: max of archived | ||
1242 | 1949 | log numbers in data files */ | ||
1243 | 1950 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1244 | 1951 | lsn_t* min_flushed_lsn, /*!< out: min of flushed | 1978 | lsn_t* min_flushed_lsn, /*!< out: min of flushed |
1245 | 1952 | lsn values in data files */ | 1979 | lsn values in data files */ |
1246 | 1953 | lsn_t* max_flushed_lsn) /*!< out: max of flushed | 1980 | lsn_t* max_flushed_lsn) /*!< out: max of flushed |
1247 | @@ -1976,10 +2003,7 @@ | |||
1248 | 1976 | if (!one_read_already) { | 2003 | if (!one_read_already) { |
1249 | 1977 | *min_flushed_lsn = flushed_lsn; | 2004 | *min_flushed_lsn = flushed_lsn; |
1250 | 1978 | *max_flushed_lsn = flushed_lsn; | 2005 | *max_flushed_lsn = flushed_lsn; |
1255 | 1979 | #ifdef UNIV_LOG_ARCHIVE | 2006 | |
1252 | 1980 | *min_arch_log_no = arch_log_no; | ||
1253 | 1981 | *max_arch_log_no = arch_log_no; | ||
1254 | 1982 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1256 | 1983 | return; | 2007 | return; |
1257 | 1984 | } | 2008 | } |
1258 | 1985 | 2009 | ||
1259 | @@ -1989,14 +2013,6 @@ | |||
1260 | 1989 | if (*max_flushed_lsn < flushed_lsn) { | 2013 | if (*max_flushed_lsn < flushed_lsn) { |
1261 | 1990 | *max_flushed_lsn = flushed_lsn; | 2014 | *max_flushed_lsn = flushed_lsn; |
1262 | 1991 | } | 2015 | } |
1263 | 1992 | #ifdef UNIV_LOG_ARCHIVE | ||
1264 | 1993 | if (*min_arch_log_no > arch_log_no) { | ||
1265 | 1994 | *min_arch_log_no = arch_log_no; | ||
1266 | 1995 | } | ||
1267 | 1996 | if (*max_arch_log_no < arch_log_no) { | ||
1268 | 1997 | *max_arch_log_no = arch_log_no; | ||
1269 | 1998 | } | ||
1270 | 1999 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1271 | 2000 | } | 2016 | } |
1272 | 2001 | 2017 | ||
1273 | 2002 | /*================ SINGLE-TABLE TABLESPACES ==========================*/ | 2018 | /*================ SINGLE-TABLE TABLESPACES ==========================*/ |
1274 | @@ -3499,9 +3515,6 @@ | |||
1275 | 3499 | lsn_t lsn; /*!< Flushed LSN from header page */ | 3515 | lsn_t lsn; /*!< Flushed LSN from header page */ |
1276 | 3500 | ulint id; /*!< Space ID */ | 3516 | ulint id; /*!< Space ID */ |
1277 | 3501 | ulint flags; /*!< Tablespace flags */ | 3517 | ulint flags; /*!< Tablespace flags */ |
1278 | 3502 | #ifdef UNIV_LOG_ARCHIVE | ||
1279 | 3503 | ulint arch_log_no; /*!< latest archived log file number */ | ||
1280 | 3504 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1281 | 3505 | }; | 3518 | }; |
1282 | 3506 | 3519 | ||
1283 | 3507 | /********************************************************************//** | 3520 | /********************************************************************//** |
1284 | @@ -3637,9 +3650,6 @@ | |||
1285 | 3637 | if (def.success) { | 3650 | if (def.success) { |
1286 | 3638 | fil_read_first_page( | 3651 | fil_read_first_page( |
1287 | 3639 | def.file, FALSE, &def.flags, &def.id, | 3652 | def.file, FALSE, &def.flags, &def.id, |
1288 | 3640 | #ifdef UNIV_LOG_ARCHIVE | ||
1289 | 3641 | &space_arch_log_no, &space_arch_log_no, | ||
1290 | 3642 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1291 | 3643 | &def.lsn, &def.lsn); | 3653 | &def.lsn, &def.lsn); |
1292 | 3644 | 3654 | ||
1293 | 3645 | /* Validate this single-table-tablespace with SYS_TABLES, | 3655 | /* Validate this single-table-tablespace with SYS_TABLES, |
1294 | @@ -3661,9 +3671,6 @@ | |||
1295 | 3661 | if (remote.success) { | 3671 | if (remote.success) { |
1296 | 3662 | fil_read_first_page( | 3672 | fil_read_first_page( |
1297 | 3663 | remote.file, FALSE, &remote.flags, &remote.id, | 3673 | remote.file, FALSE, &remote.flags, &remote.id, |
1298 | 3664 | #ifdef UNIV_LOG_ARCHIVE | ||
1299 | 3665 | &remote.arch_log_no, &remote.arch_log_no, | ||
1300 | 3666 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1301 | 3667 | &remote.lsn, &remote.lsn); | 3674 | &remote.lsn, &remote.lsn); |
1302 | 3668 | 3675 | ||
1303 | 3669 | /* Validate this single-table-tablespace with SYS_TABLES, | 3676 | /* Validate this single-table-tablespace with SYS_TABLES, |
1304 | @@ -3686,9 +3693,6 @@ | |||
1305 | 3686 | if (dict.success) { | 3693 | if (dict.success) { |
1306 | 3687 | fil_read_first_page( | 3694 | fil_read_first_page( |
1307 | 3688 | dict.file, FALSE, &dict.flags, &dict.id, | 3695 | dict.file, FALSE, &dict.flags, &dict.id, |
1308 | 3689 | #ifdef UNIV_LOG_ARCHIVE | ||
1309 | 3690 | &dict.arch_log_no, &dict.arch_log_no, | ||
1310 | 3691 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1311 | 3692 | &dict.lsn, &dict.lsn); | 3696 | &dict.lsn, &dict.lsn); |
1312 | 3693 | 3697 | ||
1313 | 3694 | /* Validate this single-table-tablespace with SYS_TABLES, | 3698 | /* Validate this single-table-tablespace with SYS_TABLES, |
1314 | @@ -3916,9 +3920,6 @@ | |||
1315 | 3916 | { | 3920 | { |
1316 | 3917 | fil_read_first_page( | 3921 | fil_read_first_page( |
1317 | 3918 | fsp->file, FALSE, &fsp->flags, &fsp->id, | 3922 | fsp->file, FALSE, &fsp->flags, &fsp->id, |
1318 | 3919 | #ifdef UNIV_LOG_ARCHIVE | ||
1319 | 3920 | &fsp->arch_log_no, &fsp->arch_log_no, | ||
1320 | 3921 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1321 | 3922 | &fsp->lsn, &fsp->lsn); | 3923 | &fsp->lsn, &fsp->lsn); |
1322 | 3923 | 3924 | ||
1323 | 3924 | if (fsp->id == ULINT_UNDEFINED || fsp->id == 0) { | 3925 | if (fsp->id == ULINT_UNDEFINED || fsp->id == 0) { |
1324 | 3925 | 3926 | ||
1325 | === modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc' | |||
1326 | --- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-03-05 12:46:43 +0000 | |||
1327 | +++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-03-31 06:25:28 +0000 | |||
1328 | @@ -989,6 +989,32 @@ | |||
1329 | 989 | name to lower case */ | 989 | name to lower case */ |
1330 | 990 | 990 | ||
1331 | 991 | /*************************************************************//** | 991 | /*************************************************************//** |
1332 | 992 | Removes old archived transaction log files. | ||
1333 | 993 | @return true on error */ | ||
1334 | 994 | static bool innobase_purge_archive_logs( | ||
1335 | 995 | handlerton *hton, /*!< in: InnoDB handlerton */ | ||
1336 | 996 | time_t before_date, /*!< in: all files modified | ||
1337 | 997 | before timestamp should be removed */ | ||
1338 | 998 | const char* to_filename) /*!< in: this and earler files | ||
1339 | 999 | should be removed */ | ||
1340 | 1000 | { | ||
1341 | 1001 | ulint err= DB_ERROR; | ||
1342 | 1002 | if (before_date > 0) { | ||
1343 | 1003 | err= purge_archived_logs(before_date, 0); | ||
1344 | 1004 | } else if (to_filename) { | ||
1345 | 1005 | if (is_prefix(to_filename, IB_ARCHIVED_LOGS_PREFIX)) { | ||
1346 | 1006 | unsigned long long log_file_lsn = strtoll(to_filename | ||
1347 | 1007 | + IB_ARCHIVED_LOGS_PREFIX_LEN, | ||
1348 | 1008 | NULL, 10); | ||
1349 | 1009 | if (log_file_lsn > 0 && log_file_lsn < ULLONG_MAX) { | ||
1350 | 1010 | err= purge_archived_logs(0, log_file_lsn); | ||
1351 | 1011 | } | ||
1352 | 1012 | } | ||
1353 | 1013 | } | ||
1354 | 1014 | return (err != DB_SUCCESS); | ||
1355 | 1015 | } | ||
1356 | 1016 | |||
1357 | 1017 | /*************************************************************//** | ||
1358 | 992 | Check for a valid value of innobase_commit_concurrency. | 1018 | Check for a valid value of innobase_commit_concurrency. |
1359 | 993 | @return 0 for valid innodb_commit_concurrency */ | 1019 | @return 0 for valid innodb_commit_concurrency */ |
1360 | 994 | static | 1020 | static |
1361 | @@ -2760,6 +2786,7 @@ | |||
1362 | 2760 | 2786 | ||
1363 | 2761 | innobase_hton->release_temporary_latches = | 2787 | innobase_hton->release_temporary_latches = |
1364 | 2762 | innobase_release_temporary_latches; | 2788 | innobase_release_temporary_latches; |
1365 | 2789 | innobase_hton->purge_archive_logs = innobase_purge_archive_logs; | ||
1366 | 2763 | 2790 | ||
1367 | 2764 | innobase_hton->data = &innodb_api_cb; | 2791 | innobase_hton->data = &innodb_api_cb; |
1368 | 2765 | 2792 | ||
1369 | @@ -2862,12 +2889,9 @@ | |||
1370 | 2862 | } | 2889 | } |
1371 | 2863 | 2890 | ||
1372 | 2864 | #ifdef UNIV_LOG_ARCHIVE | 2891 | #ifdef UNIV_LOG_ARCHIVE |
1379 | 2865 | /* Since innodb_log_arch_dir has no relevance under MySQL, | 2892 | if (!innobase_log_arch_dir) { |
1380 | 2866 | starting from 4.0.6 we always set it the same as | 2893 | innobase_log_arch_dir = srv_log_group_home_dir; |
1381 | 2867 | innodb_log_group_home_dir: */ | 2894 | } |
1376 | 2868 | |||
1377 | 2869 | innobase_log_arch_dir = innobase_log_group_home_dir; | ||
1378 | 2870 | |||
1382 | 2871 | srv_arch_dir = innobase_log_arch_dir; | 2895 | srv_arch_dir = innobase_log_arch_dir; |
1383 | 2872 | #endif /* UNIG_LOG_ARCHIVE */ | 2896 | #endif /* UNIG_LOG_ARCHIVE */ |
1384 | 2873 | 2897 | ||
1385 | @@ -13684,6 +13708,45 @@ | |||
1386 | 13684 | } | 13708 | } |
1387 | 13685 | 13709 | ||
1388 | 13686 | /****************************************************************//** | 13710 | /****************************************************************//** |
1389 | 13711 | Update the system variable innodb_log_arch_expire_sec using | ||
1390 | 13712 | the "saved" value. This function is registered as a callback with MySQL. */ | ||
1391 | 13713 | static | ||
1392 | 13714 | void | ||
1393 | 13715 | innodb_log_archive_expire_update( | ||
1394 | 13716 | /*==============================*/ | ||
1395 | 13717 | THD* thd, /*!< in: thread handle */ | ||
1396 | 13718 | struct st_mysql_sys_var* var, /*!< in: pointer to | ||
1397 | 13719 | system variable */ | ||
1398 | 13720 | void* var_ptr, /*!< out: unused */ | ||
1399 | 13721 | const void* save) /*!< in: immediate result | ||
1400 | 13722 | from check function */ | ||
1401 | 13723 | { | ||
1402 | 13724 | srv_log_arch_expire_sec = *(ulint*) save; | ||
1403 | 13725 | } | ||
1404 | 13726 | |||
1405 | 13727 | static | ||
1406 | 13728 | void | ||
1407 | 13729 | innodb_log_archive_update( | ||
1408 | 13730 | /*======================*/ | ||
1409 | 13731 | THD* thd, | ||
1410 | 13732 | struct st_mysql_sys_var* var, | ||
1411 | 13733 | void* var_ptr, | ||
1412 | 13734 | const void* save) | ||
1413 | 13735 | { | ||
1414 | 13736 | my_bool in_val = *static_cast<const my_bool*>(save); | ||
1415 | 13737 | |||
1416 | 13738 | if (in_val) { | ||
1417 | 13739 | /* turn archiving on */ | ||
1418 | 13740 | srv_log_archive_on = innobase_log_archive = 1; | ||
1419 | 13741 | log_archive_archivelog(); | ||
1420 | 13742 | } else { | ||
1421 | 13743 | /* turn archivng off */ | ||
1422 | 13744 | srv_log_archive_on = innobase_log_archive = 0; | ||
1423 | 13745 | log_archive_noarchivelog(); | ||
1424 | 13746 | } | ||
1425 | 13747 | } | ||
1426 | 13748 | |||
1427 | 13749 | /****************************************************************//** | ||
1428 | 13687 | Update the system variable innodb_max_dirty_pages_pct using the "saved" | 13750 | Update the system variable innodb_max_dirty_pages_pct using the "saved" |
1429 | 13688 | value. This function is registered as a callback with MySQL. */ | 13751 | value. This function is registered as a callback with MySQL. */ |
1430 | 13689 | static | 13752 | static |
1431 | @@ -15486,14 +15549,20 @@ | |||
1432 | 15486 | "Where full logs should be archived.", NULL, NULL, NULL); | 15549 | "Where full logs should be archived.", NULL, NULL, NULL); |
1433 | 15487 | 15550 | ||
1434 | 15488 | static MYSQL_SYSVAR_BOOL(log_archive, innobase_log_archive, | 15551 | static MYSQL_SYSVAR_BOOL(log_archive, innobase_log_archive, |
1437 | 15489 | PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, | 15552 | PLUGIN_VAR_OPCMDARG, |
1438 | 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.", |
1439 | 15554 | NULL, innodb_log_archive_update, FALSE); | ||
1440 | 15491 | #endif /* UNIV_LOG_ARCHIVE */ | 15555 | #endif /* UNIV_LOG_ARCHIVE */ |
1441 | 15492 | 15556 | ||
1442 | 15493 | static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir, | 15557 | static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir, |
1443 | 15494 | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, | 15558 | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, |
1444 | 15495 | "Path to InnoDB log files.", NULL, NULL, NULL); | 15559 | "Path to InnoDB log files.", NULL, NULL, NULL); |
1445 | 15496 | 15560 | ||
1446 | 15561 | static MYSQL_SYSVAR_ULONG(log_arch_expire_sec, | ||
1447 | 15562 | srv_log_arch_expire_sec, PLUGIN_VAR_OPCMDARG, | ||
1448 | 15563 | "Expiration time for archived innodb transaction logs.", | ||
1449 | 15564 | NULL, innodb_log_archive_expire_update, 0, 0, ~0L, 0); | ||
1450 | 15565 | |||
1451 | 15497 | static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct, | 15566 | static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct, |
1452 | 15498 | PLUGIN_VAR_RQCMDARG, | 15567 | PLUGIN_VAR_RQCMDARG, |
1453 | 15499 | "Percentage of dirty pages allowed in bufferpool.", | 15568 | "Percentage of dirty pages allowed in bufferpool.", |
1454 | @@ -16140,6 +16209,7 @@ | |||
1455 | 16140 | #ifdef UNIV_LOG_ARCHIVE | 16209 | #ifdef UNIV_LOG_ARCHIVE |
1456 | 16141 | MYSQL_SYSVAR(log_arch_dir), | 16210 | MYSQL_SYSVAR(log_arch_dir), |
1457 | 16142 | MYSQL_SYSVAR(log_archive), | 16211 | MYSQL_SYSVAR(log_archive), |
1458 | 16212 | MYSQL_SYSVAR(log_arch_expire_sec), | ||
1459 | 16143 | #endif /* UNIV_LOG_ARCHIVE */ | 16213 | #endif /* UNIV_LOG_ARCHIVE */ |
1460 | 16144 | MYSQL_SYSVAR(page_size), | 16214 | MYSQL_SYSVAR(page_size), |
1461 | 16145 | MYSQL_SYSVAR(log_buffer_size), | 16215 | MYSQL_SYSVAR(log_buffer_size), |
1462 | 16146 | 16216 | ||
1463 | === modified file 'Percona-Server/storage/innobase/include/fil0fil.h' | |||
1464 | --- Percona-Server/storage/innobase/include/fil0fil.h 2013-03-05 12:46:43 +0000 | |||
1465 | +++ Percona-Server/storage/innobase/include/fil0fil.h 2013-03-31 06:25:28 +0000 | |||
1466 | @@ -229,6 +229,14 @@ | |||
1467 | 229 | ulint trunc_len); /*!< in: truncate by this much; it is an error | 229 | ulint trunc_len); /*!< in: truncate by this much; it is an error |
1468 | 230 | if this does not equal to the combined size of | 230 | if this does not equal to the combined size of |
1469 | 231 | some initial files in the space */ | 231 | some initial files in the space */ |
1470 | 232 | /****************************************************************//** | ||
1471 | 233 | Check is there node in file space with given name. */ | ||
1472 | 234 | UNIV_INTERN | ||
1473 | 235 | ibool | ||
1474 | 236 | fil_space_contains_node( | ||
1475 | 237 | /*====================*/ | ||
1476 | 238 | ulint id, /*!< in: space id */ | ||
1477 | 239 | char* node_name); /*!< in: node name */ | ||
1478 | 232 | #endif /* UNIV_LOG_ARCHIVE */ | 240 | #endif /* UNIV_LOG_ARCHIVE */ |
1479 | 233 | /*******************************************************************//** | 241 | /*******************************************************************//** |
1480 | 234 | Creates a space memory object and puts it to the 'fil system' hash table. | 242 | Creates a space memory object and puts it to the 'fil system' hash table. |
1481 | @@ -371,12 +379,6 @@ | |||
1482 | 371 | contain sensible data */ | 379 | contain sensible data */ |
1483 | 372 | ulint* flags, /*!< out: tablespace flags */ | 380 | ulint* flags, /*!< out: tablespace flags */ |
1484 | 373 | ulint* space_id, /*!< out: tablespace ID */ | 381 | ulint* space_id, /*!< out: tablespace ID */ |
1485 | 374 | #ifdef UNIV_LOG_ARCHIVE | ||
1486 | 375 | ulint* min_arch_log_no, /*!< out: min of archived | ||
1487 | 376 | log numbers in data files */ | ||
1488 | 377 | ulint* max_arch_log_no, /*!< out: max of archived | ||
1489 | 378 | log numbers in data files */ | ||
1490 | 379 | #endif /* UNIV_LOG_ARCHIVE */ | ||
1491 | 380 | lsn_t* min_flushed_lsn, /*!< out: min of flushed | 382 | lsn_t* min_flushed_lsn, /*!< out: min of flushed |
1492 | 381 | lsn values in data files */ | 383 | lsn values in data files */ |
1493 | 382 | lsn_t* max_flushed_lsn); /*!< out: max of flushed | 384 | lsn_t* max_flushed_lsn); /*!< out: max of flushed |
1494 | 383 | 385 | ||
1495 | === modified file 'Percona-Server/storage/innobase/include/log0log.h' | |||
1496 | --- Percona-Server/storage/innobase/include/log0log.h 2013-03-05 12:46:43 +0000 | |||
1497 | +++ Percona-Server/storage/innobase/include/log0log.h 2013-03-31 06:25:28 +0000 | |||
1498 | @@ -70,6 +70,10 @@ | |||
1499 | 70 | /** Maximum number of log groups in log_group_t::checkpoint_buf */ | 70 | /** Maximum number of log groups in log_group_t::checkpoint_buf */ |
1500 | 71 | #define LOG_MAX_N_GROUPS 32 | 71 | #define LOG_MAX_N_GROUPS 32 |
1501 | 72 | 72 | ||
1502 | 73 | #define IB_ARCHIVED_LOGS_PREFIX "ib_log_archive_" | ||
1503 | 74 | #define IB_ARCHIVED_LOGS_PREFIX_LEN (sizeof(IB_ARCHIVED_LOGS_PREFIX) - 1) | ||
1504 | 75 | #define IB_ARCHIVED_LOGS_SERIAL_LEN 20 | ||
1505 | 76 | |||
1506 | 73 | /*******************************************************************//** | 77 | /*******************************************************************//** |
1507 | 74 | Calculates where in log files we find a specified lsn. | 78 | Calculates where in log files we find a specified lsn. |
1508 | 75 | @return log file number */ | 79 | @return log file number */ |
1509 | @@ -283,8 +287,7 @@ | |||
1510 | 283 | /*==============================*/ | 287 | /*==============================*/ |
1511 | 284 | const byte* buf, /*!< in: buffer containing checkpoint info */ | 288 | const byte* buf, /*!< in: buffer containing checkpoint info */ |
1512 | 285 | ulint n, /*!< in: nth slot */ | 289 | ulint n, /*!< in: nth slot */ |
1515 | 286 | ulint* file_no,/*!< out: archived file number */ | 290 | lsn_t* file_no);/*!< out: archived file number */ |
1514 | 287 | ulint* offset);/*!< out: archived file offset */ | ||
1516 | 288 | /******************************************************//** | 291 | /******************************************************//** |
1517 | 289 | Writes checkpoint info to groups. */ | 292 | Writes checkpoint info to groups. */ |
1518 | 290 | UNIV_INTERN | 293 | UNIV_INTERN |
1519 | @@ -340,8 +343,18 @@ | |||
1520 | 340 | log_archived_file_name_gen( | 343 | log_archived_file_name_gen( |
1521 | 341 | /*=======================*/ | 344 | /*=======================*/ |
1522 | 342 | char* buf, /*!< in: buffer where to write */ | 345 | char* buf, /*!< in: buffer where to write */ |
1523 | 346 | ulint buf_len,/*!< in: buffer length */ | ||
1524 | 343 | ulint id, /*!< in: group id */ | 347 | ulint id, /*!< in: group id */ |
1526 | 344 | ulint file_no);/*!< in: file number */ | 348 | lsn_t file_no);/*!< in: file number */ |
1527 | 349 | |||
1528 | 350 | UNIV_INTERN | ||
1529 | 351 | void | ||
1530 | 352 | log_archived_get_offset( | ||
1531 | 353 | /*====================*/ | ||
1532 | 354 | log_group_t* group, /*!< in: log group */ | ||
1533 | 355 | lsn_t file_no, /*!< in: archive log file number */ | ||
1534 | 356 | lsn_t archived_lsn, /*!< in: last archived LSN */ | ||
1535 | 357 | lsn_t* offset); /*!< out: offset within archived file */ | ||
1536 | 345 | #else /* !UNIV_HOTBACKUP */ | 358 | #else /* !UNIV_HOTBACKUP */ |
1537 | 346 | /******************************************************//** | 359 | /******************************************************//** |
1538 | 347 | Writes info to a buffer of a log group when log files are created in | 360 | Writes info to a buffer of a log group when log files are created in |
1539 | @@ -736,19 +749,19 @@ | |||
1540 | 736 | ulint archive_space_id;/*!< file space which | 749 | ulint archive_space_id;/*!< file space which |
1541 | 737 | implements the log group | 750 | implements the log group |
1542 | 738 | archive */ | 751 | archive */ |
1544 | 739 | ulint archived_file_no;/*!< file number corresponding to | 752 | lsn_t archived_file_no;/*!< file number corresponding to |
1545 | 740 | log_sys->archived_lsn */ | 753 | log_sys->archived_lsn */ |
1547 | 741 | ulint archived_offset;/*!< file offset corresponding to | 754 | lsn_t archived_offset;/*!< file offset corresponding to |
1548 | 742 | log_sys->archived_lsn, 0 if we have | 755 | log_sys->archived_lsn, 0 if we have |
1549 | 743 | not yet written to the archive file | 756 | not yet written to the archive file |
1550 | 744 | number archived_file_no */ | 757 | number archived_file_no */ |
1552 | 745 | ulint next_archived_file_no;/*!< during an archive write, | 758 | lsn_t next_archived_file_no;/*!< during an archive write, |
1553 | 746 | until the write is completed, we | 759 | until the write is completed, we |
1554 | 747 | store the next value for | 760 | store the next value for |
1555 | 748 | archived_file_no here: the write | 761 | archived_file_no here: the write |
1556 | 749 | completion function then sets the new | 762 | completion function then sets the new |
1557 | 750 | value to ..._file_no */ | 763 | value to ..._file_no */ |
1559 | 751 | ulint next_archived_offset; /*!< like the preceding field */ | 764 | lsn_t next_archived_offset; /*!< like the preceding field */ |
1560 | 752 | #endif /* UNIV_LOG_ARCHIVE */ | 765 | #endif /* UNIV_LOG_ARCHIVE */ |
1561 | 753 | /*-----------------------------*/ | 766 | /*-----------------------------*/ |
1562 | 754 | lsn_t scanned_lsn; /*!< used only in recovery: recovery scan | 767 | lsn_t scanned_lsn; /*!< used only in recovery: recovery scan |
1563 | 755 | 768 | ||
1564 | === modified file 'Percona-Server/storage/innobase/include/log0recv.h' | |||
1565 | --- Percona-Server/storage/innobase/include/log0recv.h 2013-03-05 12:46:43 +0000 | |||
1566 | +++ Percona-Server/storage/innobase/include/log0recv.h 2013-03-31 06:25:28 +0000 | |||
1567 | @@ -297,14 +297,14 @@ | |||
1568 | 297 | Recovers from archived log files, and also from log files, if they exist. | 297 | Recovers from archived log files, and also from log files, if they exist. |
1569 | 298 | @return error code or DB_SUCCESS */ | 298 | @return error code or DB_SUCCESS */ |
1570 | 299 | UNIV_INTERN | 299 | UNIV_INTERN |
1572 | 300 | ulint | 300 | dberr_t |
1573 | 301 | recv_recovery_from_archive_start( | 301 | recv_recovery_from_archive_start( |
1574 | 302 | /*=============================*/ | 302 | /*=============================*/ |
1575 | 303 | lsn_t min_flushed_lsn,/*!< in: min flushed lsn field from the | 303 | lsn_t min_flushed_lsn,/*!< in: min flushed lsn field from the |
1576 | 304 | data files */ | 304 | data files */ |
1577 | 305 | lsn_t limit_lsn, /*!< in: recover up to this lsn if | 305 | lsn_t limit_lsn, /*!< in: recover up to this lsn if |
1578 | 306 | possible */ | 306 | possible */ |
1580 | 307 | ulint first_log_no); /*!< in: number of the first archived | 307 | lsn_t first_log_no); /*!< in: number of the first archived |
1581 | 308 | log file to use in the recovery; the | 308 | log file to use in the recovery; the |
1582 | 309 | file will be searched from | 309 | file will be searched from |
1583 | 310 | INNOBASE_LOG_ARCH_DIR specified in | 310 | INNOBASE_LOG_ARCH_DIR specified in |
1584 | 311 | 311 | ||
1585 | === modified file 'Percona-Server/storage/innobase/include/srv0srv.h' | |||
1586 | --- Percona-Server/storage/innobase/include/srv0srv.h 2013-03-05 12:46:43 +0000 | |||
1587 | +++ Percona-Server/storage/innobase/include/srv0srv.h 2013-03-31 06:25:28 +0000 | |||
1588 | @@ -348,6 +348,8 @@ | |||
1589 | 348 | extern ulong srv_doublewrite_batch_size; | 348 | extern ulong srv_doublewrite_batch_size; |
1590 | 349 | extern ulong srv_checksum_algorithm; | 349 | extern ulong srv_checksum_algorithm; |
1591 | 350 | 350 | ||
1592 | 351 | extern ulong srv_log_arch_expire_sec; | ||
1593 | 352 | |||
1594 | 351 | extern ulong srv_max_buf_pool_modified_pct; | 353 | extern ulong srv_max_buf_pool_modified_pct; |
1595 | 352 | extern ulong srv_max_purge_lag; | 354 | extern ulong srv_max_purge_lag; |
1596 | 353 | extern ulong srv_max_purge_lag_delay; | 355 | extern ulong srv_max_purge_lag_delay; |
1597 | @@ -651,6 +653,18 @@ | |||
1598 | 651 | void | 653 | void |
1599 | 652 | srv_export_innodb_status(void); | 654 | srv_export_innodb_status(void); |
1600 | 653 | /*==========================*/ | 655 | /*==========================*/ |
1601 | 656 | /*************************************************************//** | ||
1602 | 657 | Removes old archived transaction log files. | ||
1603 | 658 | Both parameters couldn't be provided at the same time. | ||
1604 | 659 | @return DB_SUCCESS on success, otherwise DB_ERROR */ | ||
1605 | 660 | UNIV_INTERN | ||
1606 | 661 | dberr_t | ||
1607 | 662 | purge_archived_logs( | ||
1608 | 663 | time_t before_date, /*!< in: all files modified | ||
1609 | 664 | before timestamp should be removed */ | ||
1610 | 665 | lsn_t before_lsn); /*!< in: files with this lsn in name | ||
1611 | 666 | and earler should be removed */ | ||
1612 | 667 | /*==========================*/ | ||
1613 | 654 | /*******************************************************************//** | 668 | /*******************************************************************//** |
1614 | 655 | Get current server activity count. We don't hold srv_sys::mutex while | 669 | Get current server activity count. We don't hold srv_sys::mutex while |
1615 | 656 | reading this value as it is only used in heuristics. | 670 | reading this value as it is only used in heuristics. |
1616 | 657 | 671 | ||
1617 | === modified file 'Percona-Server/storage/innobase/include/univ.i' | |||
1618 | --- Percona-Server/storage/innobase/include/univ.i 2013-03-05 12:46:43 +0000 | |||
1619 | +++ Percona-Server/storage/innobase/include/univ.i 2013-03-31 06:25:28 +0000 | |||
1620 | @@ -46,6 +46,9 @@ | |||
1621 | 46 | #define INNODB_VERSION_MINOR 2 | 46 | #define INNODB_VERSION_MINOR 2 |
1622 | 47 | #define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH | 47 | #define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH |
1623 | 48 | 48 | ||
1624 | 49 | /* Enable UNIV_LOG_ARCHIVE in XtraDB */ | ||
1625 | 50 | #define UNIV_LOG_ARCHIVE 1 | ||
1626 | 51 | |||
1627 | 49 | /* The following is the InnoDB version as shown in | 52 | /* The following is the InnoDB version as shown in |
1628 | 50 | SELECT plugin_version FROM information_schema.plugins; | 53 | SELECT plugin_version FROM information_schema.plugins; |
1629 | 51 | calculated in make_version_string() in sql/sql_show.cc like this: | 54 | calculated in make_version_string() in sql/sql_show.cc like this: |
1630 | 52 | 55 | ||
1631 | === modified file 'Percona-Server/storage/innobase/log/log0log.cc' | |||
1632 | --- Percona-Server/storage/innobase/log/log0log.cc 2013-03-05 12:46:43 +0000 | |||
1633 | +++ Percona-Server/storage/innobase/log/log0log.cc 2013-03-31 06:25:28 +0000 | |||
1634 | @@ -817,15 +817,11 @@ | |||
1635 | 817 | rw_lock_create(archive_lock_key, &log_sys->archive_lock, | 817 | rw_lock_create(archive_lock_key, &log_sys->archive_lock, |
1636 | 818 | SYNC_NO_ORDER_CHECK); | 818 | SYNC_NO_ORDER_CHECK); |
1637 | 819 | 819 | ||
1647 | 820 | log_sys->archive_buf = NULL; | 820 | log_sys->archive_buf = static_cast<byte*>( |
1648 | 821 | 821 | ut_align(mem_zalloc(LOG_ARCHIVE_BUF_SIZE | |
1649 | 822 | /* ut_align( | 822 | + OS_FILE_LOG_BLOCK_SIZE), |
1650 | 823 | ut_malloc(LOG_ARCHIVE_BUF_SIZE | 823 | OS_FILE_LOG_BLOCK_SIZE)); |
1651 | 824 | + OS_FILE_LOG_BLOCK_SIZE), | 824 | log_sys->archive_buf_size = LOG_ARCHIVE_BUF_SIZE; |
1643 | 825 | OS_FILE_LOG_BLOCK_SIZE); */ | ||
1644 | 826 | log_sys->archive_buf_size = 0; | ||
1645 | 827 | |||
1646 | 828 | /* memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE); */ | ||
1652 | 829 | 825 | ||
1653 | 830 | log_sys->archiving_on = os_event_create(); | 826 | log_sys->archiving_on = os_event_create(); |
1654 | 831 | #endif /* UNIV_LOG_ARCHIVE */ | 827 | #endif /* UNIV_LOG_ARCHIVE */ |
1655 | @@ -896,10 +892,10 @@ | |||
1656 | 896 | mem_zalloc(sizeof(byte**) * n_files)); | 892 | mem_zalloc(sizeof(byte**) * n_files)); |
1657 | 897 | 893 | ||
1658 | 898 | #ifdef UNIV_LOG_ARCHIVE | 894 | #ifdef UNIV_LOG_ARCHIVE |
1660 | 899 | group->archive_file_header_bufs_ptr = static_cast<byte*>( | 895 | group->archive_file_header_bufs_ptr = static_cast<byte**>( |
1661 | 900 | mem_zalloc( sizeof(byte*) * n_files)); | 896 | mem_zalloc( sizeof(byte*) * n_files)); |
1662 | 901 | 897 | ||
1664 | 902 | group->archive_file_header_bufs = static_cast<byte*>( | 898 | group->archive_file_header_bufs = static_cast<byte**>( |
1665 | 903 | mem_zalloc(sizeof(byte*) * n_files)); | 899 | mem_zalloc(sizeof(byte*) * n_files)); |
1666 | 904 | #endif /* UNIV_LOG_ARCHIVE */ | 900 | #endif /* UNIV_LOG_ARCHIVE */ |
1667 | 905 | 901 | ||
1668 | @@ -924,7 +920,7 @@ | |||
1669 | 924 | #ifdef UNIV_LOG_ARCHIVE | 920 | #ifdef UNIV_LOG_ARCHIVE |
1670 | 925 | group->archive_space_id = archive_space_id; | 921 | group->archive_space_id = archive_space_id; |
1671 | 926 | 922 | ||
1673 | 927 | group->archived_file_no = 0; | 923 | group->archived_file_no = LOG_START_LSN; |
1674 | 928 | group->archived_offset = 0; | 924 | group->archived_offset = 0; |
1675 | 929 | #endif /* UNIV_LOG_ARCHIVE */ | 925 | #endif /* UNIV_LOG_ARCHIVE */ |
1676 | 930 | 926 | ||
1677 | @@ -1708,15 +1704,13 @@ | |||
1678 | 1708 | /*==============================*/ | 1704 | /*==============================*/ |
1679 | 1709 | byte* buf, /*!< in: buffer for checkpoint info */ | 1705 | byte* buf, /*!< in: buffer for checkpoint info */ |
1680 | 1710 | ulint n, /*!< in: nth slot */ | 1706 | ulint n, /*!< in: nth slot */ |
1683 | 1711 | ulint file_no,/*!< in: archived file number */ | 1707 | lsn_t file_no)/*!< in: archived file number */ |
1682 | 1712 | ulint offset) /*!< in: archived file offset */ | ||
1684 | 1713 | { | 1708 | { |
1685 | 1714 | ut_ad(n < LOG_MAX_N_GROUPS); | 1709 | ut_ad(n < LOG_MAX_N_GROUPS); |
1686 | 1715 | 1710 | ||
1691 | 1716 | mach_write_to_4(buf + LOG_CHECKPOINT_GROUP_ARRAY | 1711 | mach_write_to_8(buf + LOG_CHECKPOINT_GROUP_ARRAY + |
1692 | 1717 | + 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO, file_no); | 1712 | 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO, |
1693 | 1718 | mach_write_to_4(buf + LOG_CHECKPOINT_GROUP_ARRAY | 1713 | file_no); |
1690 | 1719 | + 8 * n + LOG_CHECKPOINT_ARCHIVED_OFFSET, offset); | ||
1694 | 1720 | } | 1714 | } |
1695 | 1721 | 1715 | ||
1696 | 1722 | /*******************************************************************//** | 1716 | /*******************************************************************//** |
1697 | @@ -1727,15 +1721,12 @@ | |||
1698 | 1727 | /*==============================*/ | 1721 | /*==============================*/ |
1699 | 1728 | const byte* buf, /*!< in: buffer containing checkpoint info */ | 1722 | const byte* buf, /*!< in: buffer containing checkpoint info */ |
1700 | 1729 | ulint n, /*!< in: nth slot */ | 1723 | ulint n, /*!< in: nth slot */ |
1703 | 1730 | ulint* file_no,/*!< out: archived file number */ | 1724 | lsn_t* file_no)/*!< out: archived file number */ |
1702 | 1731 | ulint* offset) /*!< out: archived file offset */ | ||
1704 | 1732 | { | 1725 | { |
1705 | 1733 | ut_ad(n < LOG_MAX_N_GROUPS); | 1726 | ut_ad(n < LOG_MAX_N_GROUPS); |
1706 | 1734 | 1727 | ||
1711 | 1735 | *file_no = mach_read_from_4(buf + LOG_CHECKPOINT_GROUP_ARRAY | 1728 | *file_no = mach_read_from_8(buf + LOG_CHECKPOINT_GROUP_ARRAY + |
1712 | 1736 | + 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO); | 1729 | 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO); |
1709 | 1737 | *offset = mach_read_from_4(buf + LOG_CHECKPOINT_GROUP_ARRAY | ||
1710 | 1738 | + 8 * n + LOG_CHECKPOINT_ARCHIVED_OFFSET); | ||
1713 | 1739 | } | 1730 | } |
1714 | 1740 | 1731 | ||
1715 | 1741 | /******************************************************//** | 1732 | /******************************************************//** |
1716 | @@ -1795,7 +1786,7 @@ | |||
1717 | 1795 | #endif /* UNIV_LOG_ARCHIVE */ | 1786 | #endif /* UNIV_LOG_ARCHIVE */ |
1718 | 1796 | 1787 | ||
1719 | 1797 | for (i = 0; i < LOG_MAX_N_GROUPS; i++) { | 1788 | for (i = 0; i < LOG_MAX_N_GROUPS; i++) { |
1721 | 1798 | log_checkpoint_set_nth_group_info(buf, i, 0, 0); | 1789 | log_checkpoint_set_nth_group_info(buf, i, 0); |
1722 | 1799 | } | 1790 | } |
1723 | 1800 | 1791 | ||
1724 | 1801 | group2 = UT_LIST_GET_FIRST(log_sys->log_groups); | 1792 | group2 = UT_LIST_GET_FIRST(log_sys->log_groups); |
1725 | @@ -1803,10 +1794,9 @@ | |||
1726 | 1803 | while (group2) { | 1794 | while (group2) { |
1727 | 1804 | log_checkpoint_set_nth_group_info(buf, group2->id, | 1795 | log_checkpoint_set_nth_group_info(buf, group2->id, |
1728 | 1805 | #ifdef UNIV_LOG_ARCHIVE | 1796 | #ifdef UNIV_LOG_ARCHIVE |
1731 | 1806 | group2->archived_file_no, | 1797 | group2->archived_file_no |
1730 | 1807 | group2->archived_offset | ||
1732 | 1808 | #else /* UNIV_LOG_ARCHIVE */ | 1798 | #else /* UNIV_LOG_ARCHIVE */ |
1734 | 1809 | 0, 0 | 1799 | 0 |
1735 | 1810 | #endif /* UNIV_LOG_ARCHIVE */ | 1800 | #endif /* UNIV_LOG_ARCHIVE */ |
1736 | 1811 | ); | 1801 | ); |
1737 | 1812 | 1802 | ||
1738 | @@ -2225,7 +2215,7 @@ | |||
1739 | 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, |
1740 | 2226 | (ulint) (source_offset / UNIV_PAGE_SIZE), | 2216 | (ulint) (source_offset / UNIV_PAGE_SIZE), |
1741 | 2227 | (ulint) (source_offset % UNIV_PAGE_SIZE), | 2217 | (ulint) (source_offset % UNIV_PAGE_SIZE), |
1743 | 2228 | len, buf, NULL); | 2218 | len, buf, (type == LOG_ARCHIVE) ? &log_archive_io : NULL); |
1744 | 2229 | 2219 | ||
1745 | 2230 | start_lsn += len; | 2220 | start_lsn += len; |
1746 | 2231 | buf += len; | 2221 | buf += len; |
1747 | @@ -2244,12 +2234,68 @@ | |||
1748 | 2244 | log_archived_file_name_gen( | 2234 | log_archived_file_name_gen( |
1749 | 2245 | /*=======================*/ | 2235 | /*=======================*/ |
1750 | 2246 | char* buf, /*!< in: buffer where to write */ | 2236 | char* buf, /*!< in: buffer where to write */ |
1751 | 2237 | ulint buf_len,/*!< in: buffer length */ | ||
1752 | 2247 | ulint id __attribute__((unused)), | 2238 | ulint id __attribute__((unused)), |
1753 | 2248 | /*!< in: group id; | 2239 | /*!< in: group id; |
1754 | 2249 | currently we only archive the first group */ | 2240 | currently we only archive the first group */ |
1758 | 2250 | ulint file_no)/*!< in: file number */ | 2241 | lsn_t file_no)/*!< in: file number */ |
1759 | 2251 | { | 2242 | { |
1760 | 2252 | sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, (ulong) file_no); | 2243 | ulint dirnamelen; |
1761 | 2244 | |||
1762 | 2245 | dirnamelen = strlen(srv_arch_dir); | ||
1763 | 2246 | |||
1764 | 2247 | ut_a(buf_len > dirnamelen + | ||
1765 | 2248 | IB_ARCHIVED_LOGS_SERIAL_LEN + | ||
1766 | 2249 | IB_ARCHIVED_LOGS_PREFIX_LEN + 2); | ||
1767 | 2250 | |||
1768 | 2251 | strcpy(buf, srv_arch_dir); | ||
1769 | 2252 | |||
1770 | 2253 | if (buf[dirnamelen-1] != SRV_PATH_SEPARATOR) { | ||
1771 | 2254 | buf[dirnamelen++] = SRV_PATH_SEPARATOR; | ||
1772 | 2255 | } | ||
1773 | 2256 | sprintf(buf + dirnamelen, IB_ARCHIVED_LOGS_PREFIX | ||
1774 | 2257 | "%0" IB_TO_STR(IB_ARCHIVED_LOGS_SERIAL_LEN) "llu", | ||
1775 | 2258 | file_no); | ||
1776 | 2259 | } | ||
1777 | 2260 | |||
1778 | 2261 | /******************************************************//** | ||
1779 | 2262 | Get offset within archived log file to continue to write | ||
1780 | 2263 | with. */ | ||
1781 | 2264 | UNIV_INTERN | ||
1782 | 2265 | void | ||
1783 | 2266 | log_archived_get_offset( | ||
1784 | 2267 | /*=====================*/ | ||
1785 | 2268 | log_group_t* group, /*!< in: log group */ | ||
1786 | 2269 | lsn_t file_no, /*!< in: archive log file number */ | ||
1787 | 2270 | lsn_t archived_lsn, /*!< in: last archived LSN */ | ||
1788 | 2271 | lsn_t* offset) /*!< out: offset within archived file */ | ||
1789 | 2272 | { | ||
1790 | 2273 | char file_name[OS_FILE_MAX_PATH]; | ||
1791 | 2274 | ibool exists; | ||
1792 | 2275 | os_file_type_t type; | ||
1793 | 2276 | |||
1794 | 2277 | log_archived_file_name_gen(file_name, | ||
1795 | 2278 | sizeof(file_name), group->id, file_no); | ||
1796 | 2279 | |||
1797 | 2280 | ut_a(os_file_status(file_name, &exists, &type)); | ||
1798 | 2281 | |||
1799 | 2282 | if (!exists) { | ||
1800 | 2283 | *offset = 0; | ||
1801 | 2284 | return; | ||
1802 | 2285 | } | ||
1803 | 2286 | |||
1804 | 2287 | *offset = archived_lsn - file_no + LOG_FILE_HDR_SIZE; | ||
1805 | 2288 | |||
1806 | 2289 | if (archived_lsn != IB_ULONGLONG_MAX) { | ||
1807 | 2290 | *offset = archived_lsn - file_no + LOG_FILE_HDR_SIZE; | ||
1808 | 2291 | } else { | ||
1809 | 2292 | /* Archiving was OFF prior startup */ | ||
1810 | 2293 | *offset = 0; | ||
1811 | 2294 | } | ||
1812 | 2295 | |||
1813 | 2296 | ut_a(group->file_size >= *offset + LOG_FILE_HDR_SIZE); | ||
1814 | 2297 | |||
1815 | 2298 | return; | ||
1816 | 2253 | } | 2299 | } |
1817 | 2254 | 2300 | ||
1818 | 2255 | /******************************************************//** | 2301 | /******************************************************//** |
1819 | @@ -2261,7 +2307,7 @@ | |||
1820 | 2261 | log_group_t* group, /*!< in: log group */ | 2307 | log_group_t* group, /*!< in: log group */ |
1821 | 2262 | ulint nth_file, /*!< in: header to the nth file in the | 2308 | ulint nth_file, /*!< in: header to the nth file in the |
1822 | 2263 | archive log file space */ | 2309 | archive log file space */ |
1824 | 2264 | ulint file_no, /*!< in: archived file number */ | 2310 | lsn_t file_no, /*!< in: archived file number */ |
1825 | 2265 | ib_uint64_t start_lsn) /*!< in: log file data starts at this | 2311 | ib_uint64_t start_lsn) /*!< in: log file data starts at this |
1826 | 2266 | lsn */ | 2312 | lsn */ |
1827 | 2267 | { | 2313 | { |
1828 | @@ -2287,6 +2333,7 @@ | |||
1829 | 2287 | MONITOR_INC(MONITOR_LOG_IO); | 2333 | MONITOR_INC(MONITOR_LOG_IO); |
1830 | 2288 | 2334 | ||
1831 | 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, |
1832 | 2336 | 0, | ||
1833 | 2290 | dest_offset / UNIV_PAGE_SIZE, | 2337 | dest_offset / UNIV_PAGE_SIZE, |
1834 | 2291 | dest_offset % UNIV_PAGE_SIZE, | 2338 | dest_offset % UNIV_PAGE_SIZE, |
1835 | 2292 | 2 * OS_FILE_LOG_BLOCK_SIZE, | 2339 | 2 * OS_FILE_LOG_BLOCK_SIZE, |
1836 | @@ -2322,6 +2369,7 @@ | |||
1837 | 2322 | MONITOR_INC(MONITOR_LOG_IO); | 2369 | MONITOR_INC(MONITOR_LOG_IO); |
1838 | 2323 | 2370 | ||
1839 | 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, |
1840 | 2372 | 0, | ||
1841 | 2325 | dest_offset / UNIV_PAGE_SIZE, | 2373 | dest_offset / UNIV_PAGE_SIZE, |
1842 | 2326 | dest_offset % UNIV_PAGE_SIZE, | 2374 | dest_offset % UNIV_PAGE_SIZE, |
1843 | 2327 | OS_FILE_LOG_BLOCK_SIZE, | 2375 | OS_FILE_LOG_BLOCK_SIZE, |
1844 | @@ -2340,7 +2388,7 @@ | |||
1845 | 2340 | os_file_t file_handle; | 2388 | os_file_t file_handle; |
1846 | 2341 | lsn_t start_lsn; | 2389 | lsn_t start_lsn; |
1847 | 2342 | lsn_t end_lsn; | 2390 | lsn_t end_lsn; |
1849 | 2343 | char name[1024]; | 2391 | char name[OS_FILE_MAX_PATH]; |
1850 | 2344 | byte* buf; | 2392 | byte* buf; |
1851 | 2345 | ulint len; | 2393 | ulint len; |
1852 | 2346 | ibool ret; | 2394 | ibool ret; |
1853 | @@ -2372,12 +2420,19 @@ | |||
1854 | 2372 | 2420 | ||
1855 | 2373 | if (next_offset % group->file_size == 0) { | 2421 | if (next_offset % group->file_size == 0) { |
1856 | 2374 | open_mode = OS_FILE_CREATE; | 2422 | open_mode = OS_FILE_CREATE; |
1857 | 2423 | if (n_files == 0) { | ||
1858 | 2424 | /* Adjust archived_file_no to match start_lsn | ||
1859 | 2425 | which is written in file header as well */ | ||
1860 | 2426 | group->archived_file_no = start_lsn; | ||
1861 | 2427 | } | ||
1862 | 2375 | } else { | 2428 | } else { |
1863 | 2376 | open_mode = OS_FILE_OPEN; | 2429 | open_mode = OS_FILE_OPEN; |
1864 | 2377 | } | 2430 | } |
1865 | 2378 | 2431 | ||
1868 | 2379 | log_archived_file_name_gen(name, group->id, | 2432 | log_archived_file_name_gen(name, sizeof(name), group->id, |
1869 | 2380 | group->archived_file_no + n_files); | 2433 | group->archived_file_no + |
1870 | 2434 | n_files * (group->file_size - | ||
1871 | 2435 | LOG_FILE_HDR_SIZE)); | ||
1872 | 2381 | 2436 | ||
1873 | 2382 | file_handle = os_file_create(innodb_file_log_key, | 2437 | file_handle = os_file_create(innodb_file_log_key, |
1874 | 2383 | name, open_mode, | 2438 | name, open_mode, |
1875 | @@ -2414,13 +2469,14 @@ | |||
1876 | 2414 | 2469 | ||
1877 | 2415 | /* Add the archive file as a node to the space */ | 2470 | /* Add the archive file as a node to the space */ |
1878 | 2416 | 2471 | ||
1881 | 2417 | fil_node_create(name, group->file_size / UNIV_PAGE_SIZE, | 2472 | ut_a(fil_node_create(name, group->file_size / UNIV_PAGE_SIZE, |
1882 | 2418 | group->archive_space_id, FALSE); | 2473 | group->archive_space_id, FALSE)); |
1883 | 2419 | 2474 | ||
1884 | 2420 | if (next_offset % group->file_size == 0) { | 2475 | if (next_offset % group->file_size == 0) { |
1885 | 2421 | log_group_archive_file_header_write( | 2476 | log_group_archive_file_header_write( |
1886 | 2422 | group, n_files, | 2477 | group, n_files, |
1888 | 2423 | group->archived_file_no + n_files, | 2478 | group->archived_file_no + |
1889 | 2479 | n_files * (group->file_size - LOG_FILE_HDR_SIZE), | ||
1890 | 2424 | start_lsn); | 2480 | start_lsn); |
1891 | 2425 | 2481 | ||
1892 | 2426 | next_offset += LOG_FILE_HDR_SIZE; | 2482 | next_offset += LOG_FILE_HDR_SIZE; |
1893 | @@ -2451,6 +2507,7 @@ | |||
1894 | 2451 | MONITOR_INC(MONITOR_LOG_IO); | 2507 | MONITOR_INC(MONITOR_LOG_IO); |
1895 | 2452 | 2508 | ||
1896 | 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, |
1897 | 2510 | 0, | ||
1898 | 2454 | (ulint) (next_offset / UNIV_PAGE_SIZE), | 2511 | (ulint) (next_offset / UNIV_PAGE_SIZE), |
1899 | 2455 | (ulint) (next_offset % UNIV_PAGE_SIZE), | 2512 | (ulint) (next_offset % UNIV_PAGE_SIZE), |
1900 | 2456 | ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf, | 2513 | ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf, |
1901 | @@ -2469,7 +2526,8 @@ | |||
1902 | 2469 | goto loop; | 2526 | goto loop; |
1903 | 2470 | } | 2527 | } |
1904 | 2471 | 2528 | ||
1906 | 2472 | group->next_archived_file_no = group->archived_file_no + n_files; | 2529 | group->next_archived_file_no = group->archived_file_no + |
1907 | 2530 | n_files * (group->file_size - LOG_FILE_HDR_SIZE); | ||
1908 | 2473 | group->next_archived_offset = next_offset % group->file_size; | 2531 | group->next_archived_offset = next_offset % group->file_size; |
1909 | 2474 | 2532 | ||
1910 | 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); |
1911 | @@ -2501,7 +2559,7 @@ | |||
1912 | 2501 | /*===================================*/ | 2559 | /*===================================*/ |
1913 | 2502 | { | 2560 | { |
1914 | 2503 | log_group_t* group; | 2561 | log_group_t* group; |
1916 | 2504 | ulint end_offset; | 2562 | lsn_t end_offset; |
1917 | 2505 | ulint trunc_files; | 2563 | ulint trunc_files; |
1918 | 2506 | ulint n_files; | 2564 | ulint n_files; |
1919 | 2507 | ib_uint64_t start_lsn; | 2565 | ib_uint64_t start_lsn; |
1920 | @@ -2822,18 +2880,8 @@ | |||
1921 | 2822 | trunc_len); | 2880 | trunc_len); |
1922 | 2823 | if (increment_file_count) { | 2881 | if (increment_file_count) { |
1923 | 2824 | group->archived_offset = 0; | 2882 | group->archived_offset = 0; |
1924 | 2825 | group->archived_file_no += 2; | ||
1925 | 2826 | } | 2883 | } |
1926 | 2827 | 2884 | ||
1927 | 2828 | #ifdef UNIV_DEBUG | ||
1928 | 2829 | if (log_debug_writes) { | ||
1929 | 2830 | fprintf(stderr, | ||
1930 | 2831 | "Incrementing arch file no to %lu" | ||
1931 | 2832 | " in log group %lu\n", | ||
1932 | 2833 | (ulong) group->archived_file_no + 2, | ||
1933 | 2834 | (ulong) group->id); | ||
1934 | 2835 | } | ||
1935 | 2836 | #endif /* UNIV_DEBUG */ | ||
1936 | 2837 | } | 2885 | } |
1937 | 2838 | } | 2886 | } |
1938 | 2839 | 2887 | ||
1939 | @@ -3087,7 +3135,6 @@ | |||
1940 | 3087 | /*=======================================*/ | 3135 | /*=======================================*/ |
1941 | 3088 | { | 3136 | { |
1942 | 3089 | lsn_t lsn; | 3137 | lsn_t lsn; |
1943 | 3090 | ulint arch_log_no; | ||
1944 | 3091 | ulint count = 0; | 3138 | ulint count = 0; |
1945 | 3092 | ulint total_trx; | 3139 | ulint total_trx; |
1946 | 3093 | ulint pending_io; | 3140 | ulint pending_io; |
1947 | @@ -3304,15 +3351,7 @@ | |||
1948 | 3304 | goto loop; | 3351 | goto loop; |
1949 | 3305 | } | 3352 | } |
1950 | 3306 | 3353 | ||
1951 | 3307 | arch_log_no = 0; | ||
1952 | 3308 | |||
1953 | 3309 | #ifdef UNIV_LOG_ARCHIVE | 3354 | #ifdef UNIV_LOG_ARCHIVE |
1954 | 3310 | UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no; | ||
1955 | 3311 | |||
1956 | 3312 | if (0 == UT_LIST_GET_FIRST(log_sys->log_groups)->archived_offset) { | ||
1957 | 3313 | |||
1958 | 3314 | arch_log_no--; | ||
1959 | 3315 | } | ||
1960 | 3316 | 3355 | ||
1961 | 3317 | log_archive_close_groups(TRUE); | 3356 | log_archive_close_groups(TRUE); |
1962 | 3318 | #endif /* UNIV_LOG_ARCHIVE */ | 3357 | #endif /* UNIV_LOG_ARCHIVE */ |
1963 | @@ -3371,7 +3410,7 @@ | |||
1964 | 3371 | srv_shutdown_lsn = lsn; | 3410 | srv_shutdown_lsn = lsn; |
1965 | 3372 | 3411 | ||
1966 | 3373 | if (!srv_read_only_mode) { | 3412 | if (!srv_read_only_mode) { |
1968 | 3374 | fil_write_flushed_lsn_to_data_files(lsn, arch_log_no); | 3413 | fil_write_flushed_lsn_to_data_files(lsn, 0); |
1969 | 3375 | 3414 | ||
1970 | 3376 | fil_flush_file_spaces(FIL_TABLESPACE); | 3415 | fil_flush_file_spaces(FIL_TABLESPACE); |
1971 | 3377 | } | 3416 | } |
1972 | @@ -3594,7 +3633,7 @@ | |||
1973 | 3594 | 3633 | ||
1974 | 3595 | #ifdef UNIV_LOG_ARCHIVE | 3634 | #ifdef UNIV_LOG_ARCHIVE |
1975 | 3596 | rw_lock_free(&log_sys->archive_lock); | 3635 | rw_lock_free(&log_sys->archive_lock); |
1977 | 3597 | os_event_create(); | 3636 | os_event_free(log_sys->archiving_on); |
1978 | 3598 | #endif /* UNIV_LOG_ARCHIVE */ | 3637 | #endif /* UNIV_LOG_ARCHIVE */ |
1979 | 3599 | 3638 | ||
1980 | 3600 | #ifdef UNIV_LOG_DEBUG | 3639 | #ifdef UNIV_LOG_DEBUG |
1981 | 3601 | 3640 | ||
1982 | === modified file 'Percona-Server/storage/innobase/log/log0recv.cc' | |||
1983 | --- Percona-Server/storage/innobase/log/log0recv.cc 2013-03-05 12:46:43 +0000 | |||
1984 | +++ Percona-Server/storage/innobase/log/log0recv.cc 2013-03-31 06:25:28 +0000 | |||
1985 | @@ -3115,8 +3115,10 @@ | |||
1986 | 3115 | 3115 | ||
1987 | 3116 | while (group) { | 3116 | while (group) { |
1988 | 3117 | log_checkpoint_get_nth_group_info(buf, group->id, | 3117 | log_checkpoint_get_nth_group_info(buf, group->id, |
1991 | 3118 | &(group->archived_file_no), | 3118 | &(group->archived_file_no)); |
1992 | 3119 | &(group->archived_offset)); | 3119 | |
1993 | 3120 | log_archived_get_offset(group, group->archived_file_no, | ||
1994 | 3121 | archived_lsn, &(group->archived_offset)); | ||
1995 | 3120 | 3122 | ||
1996 | 3121 | group = UT_LIST_GET_NEXT(log_groups, group); | 3123 | group = UT_LIST_GET_NEXT(log_groups, group); |
1997 | 3122 | } | 3124 | } |
1998 | @@ -3690,7 +3692,7 @@ | |||
1999 | 3690 | os_offset_t read_offset; | 3692 | os_offset_t read_offset; |
2000 | 3691 | os_offset_t file_size; | 3693 | os_offset_t file_size; |
2001 | 3692 | int input_char; | 3694 | int input_char; |
2003 | 3693 | char name[10000]; | 3695 | char name[OS_FILE_MAX_PATH]; |
2004 | 3694 | 3696 | ||
2005 | 3695 | ut_a(0); | 3697 | ut_a(0); |
2006 | 3696 | 3698 | ||
2007 | @@ -3699,7 +3701,8 @@ | |||
2008 | 3699 | 3701 | ||
2009 | 3700 | /* Add the file to the archive file space; open the file */ | 3702 | /* Add the file to the archive file space; open the file */ |
2010 | 3701 | 3703 | ||
2012 | 3702 | log_archived_file_name_gen(name, group->id, group->archived_file_no); | 3704 | log_archived_file_name_gen(name, sizeof(name), |
2013 | 3705 | group->id, group->archived_file_no); | ||
2014 | 3703 | 3706 | ||
2015 | 3704 | file_handle = os_file_create(innodb_file_log_key, | 3707 | file_handle = os_file_create(innodb_file_log_key, |
2016 | 3705 | name, OS_FILE_OPEN, | 3708 | name, OS_FILE_OPEN, |
2017 | @@ -3748,20 +3751,19 @@ | |||
2018 | 3748 | 3751 | ||
2019 | 3749 | /* Add the archive file as a node to the space */ | 3752 | /* Add the archive file as a node to the space */ |
2020 | 3750 | 3753 | ||
2026 | 3751 | fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE, | 3754 | ut_a(fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE, |
2027 | 3752 | group->archive_space_id, FALSE); | 3755 | group->archive_space_id, FALSE)); |
2028 | 3753 | #if RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE | 3756 | ut_a(RECV_SCAN_SIZE >= LOG_FILE_HDR_SIZE); |
2024 | 3754 | # error "RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE" | ||
2025 | 3755 | #endif | ||
2029 | 3756 | 3757 | ||
2030 | 3757 | /* Read the archive file header */ | 3758 | /* Read the archive file header */ |
2032 | 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, |
2033 | 3760 | 0, 0, | ||
2034 | 3759 | LOG_FILE_HDR_SIZE, buf, NULL); | 3761 | LOG_FILE_HDR_SIZE, buf, NULL); |
2035 | 3760 | 3762 | ||
2036 | 3761 | /* Check if the archive file header is consistent */ | 3763 | /* Check if the archive file header is consistent */ |
2037 | 3762 | 3764 | ||
2038 | 3763 | if (mach_read_from_4(buf + LOG_GROUP_ID) != group->id | 3765 | if (mach_read_from_4(buf + LOG_GROUP_ID) != group->id |
2040 | 3764 | || mach_read_from_4(buf + LOG_FILE_NO) | 3766 | || mach_read_from_8(buf + LOG_FILE_START_LSN) |
2041 | 3765 | != group->archived_file_no) { | 3767 | != group->archived_file_no) { |
2042 | 3766 | fprintf(stderr, | 3768 | fprintf(stderr, |
2043 | 3767 | "InnoDB: Archive file header inconsistent %s\n", name); | 3769 | "InnoDB: Archive file header inconsistent %s\n", name); |
2044 | @@ -3828,7 +3830,7 @@ | |||
2045 | 3828 | #endif /* UNIV_DEBUG */ | 3830 | #endif /* UNIV_DEBUG */ |
2046 | 3829 | 3831 | ||
2047 | 3830 | fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, | 3832 | fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, |
2049 | 3831 | group->archive_space_id, read_offset / UNIV_PAGE_SIZE, | 3833 | group->archive_space_id, 0, read_offset / UNIV_PAGE_SIZE, |
2050 | 3832 | read_offset % UNIV_PAGE_SIZE, len, buf, NULL); | 3834 | read_offset % UNIV_PAGE_SIZE, len, buf, NULL); |
2051 | 3833 | 3835 | ||
2052 | 3834 | ret = recv_scan_log_recs( | 3836 | ret = recv_scan_log_recs( |
2053 | @@ -3863,14 +3865,14 @@ | |||
2054 | 3863 | Recovers from archived log files, and also from log files, if they exist. | 3865 | Recovers from archived log files, and also from log files, if they exist. |
2055 | 3864 | @return error code or DB_SUCCESS */ | 3866 | @return error code or DB_SUCCESS */ |
2056 | 3865 | UNIV_INTERN | 3867 | UNIV_INTERN |
2058 | 3866 | ulint | 3868 | dberr_t |
2059 | 3867 | recv_recovery_from_archive_start( | 3869 | recv_recovery_from_archive_start( |
2060 | 3868 | /*=============================*/ | 3870 | /*=============================*/ |
2061 | 3869 | ib_uint64_t min_flushed_lsn,/*!< in: min flushed lsn field from the | 3871 | ib_uint64_t min_flushed_lsn,/*!< in: min flushed lsn field from the |
2062 | 3870 | data files */ | 3872 | data files */ |
2063 | 3871 | ib_uint64_t limit_lsn, /*!< in: recover up to this lsn if | 3873 | ib_uint64_t limit_lsn, /*!< in: recover up to this lsn if |
2064 | 3872 | possible */ | 3874 | possible */ |
2066 | 3873 | ulint first_log_no) /*!< in: number of the first archived | 3875 | lsn_t first_log_no) /*!< in: number of the first archived |
2067 | 3874 | log file to use in the recovery; the | 3876 | log file to use in the recovery; the |
2068 | 3875 | file will be searched from | 3877 | file will be searched from |
2069 | 3876 | INNOBASE_LOG_ARCH_DIR specified in | 3878 | INNOBASE_LOG_ARCH_DIR specified in |
2070 | @@ -3880,7 +3882,7 @@ | |||
2071 | 3880 | ulint group_id; | 3882 | ulint group_id; |
2072 | 3881 | ulint trunc_len; | 3883 | ulint trunc_len; |
2073 | 3882 | ibool ret; | 3884 | ibool ret; |
2075 | 3883 | ulint err; | 3885 | dberr_t err; |
2076 | 3884 | 3886 | ||
2077 | 3885 | ut_a(0); | 3887 | ut_a(0); |
2078 | 3886 | 3888 | ||
2079 | @@ -3939,7 +3941,7 @@ | |||
2080 | 3939 | trunc_len); | 3941 | trunc_len); |
2081 | 3940 | } | 3942 | } |
2082 | 3941 | 3943 | ||
2084 | 3942 | group->archived_file_no++; | 3944 | group->archived_file_no += group->file_size - LOG_FILE_HDR_SIZE; |
2085 | 3943 | } | 3945 | } |
2086 | 3944 | 3946 | ||
2087 | 3945 | if (recv_sys->recovered_lsn < limit_lsn) { | 3947 | if (recv_sys->recovered_lsn < limit_lsn) { |
2088 | 3946 | 3948 | ||
2089 | === modified file 'Percona-Server/storage/innobase/srv/srv0srv.cc' | |||
2090 | --- Percona-Server/storage/innobase/srv/srv0srv.cc 2013-03-05 12:46:43 +0000 | |||
2091 | +++ Percona-Server/storage/innobase/srv/srv0srv.cc 2013-03-31 06:25:28 +0000 | |||
2092 | @@ -67,6 +67,7 @@ | |||
2093 | 67 | #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */ | 67 | #include "os0sync.h" /* for HAVE_ATOMIC_BUILTINS */ |
2094 | 68 | #include "srv0mon.h" | 68 | #include "srv0mon.h" |
2095 | 69 | #include "ut0crc32.h" | 69 | #include "ut0crc32.h" |
2096 | 70 | #include "os0file.h" | ||
2097 | 70 | 71 | ||
2098 | 71 | #include "mysql/plugin.h" | 72 | #include "mysql/plugin.h" |
2099 | 72 | #include "mysql/service_thd_wait.h" | 73 | #include "mysql/service_thd_wait.h" |
2100 | @@ -111,6 +112,7 @@ | |||
2101 | 111 | 112 | ||
2102 | 112 | #ifdef UNIV_LOG_ARCHIVE | 113 | #ifdef UNIV_LOG_ARCHIVE |
2103 | 113 | UNIV_INTERN char* srv_arch_dir = NULL; | 114 | UNIV_INTERN char* srv_arch_dir = NULL; |
2104 | 115 | UNIV_INTERN ulong srv_log_arch_expire_sec = 0; | ||
2105 | 114 | #endif /* UNIV_LOG_ARCHIVE */ | 116 | #endif /* UNIV_LOG_ARCHIVE */ |
2106 | 115 | 117 | ||
2107 | 116 | /** Set if InnoDB must operate in read-only mode. We don't do any | 118 | /** Set if InnoDB must operate in read-only mode. We don't do any |
2108 | @@ -1852,6 +1854,134 @@ | |||
2109 | 1852 | return(thread_active); | 1854 | return(thread_active); |
2110 | 1853 | } | 1855 | } |
2111 | 1854 | 1856 | ||
2112 | 1857 | /*************************************************************//** | ||
2113 | 1858 | Removes old archived transaction log files. | ||
2114 | 1859 | Both parameters couldn't be provided at the same time */ | ||
2115 | 1860 | dberr_t | ||
2116 | 1861 | purge_archived_logs( | ||
2117 | 1862 | time_t before_date, /*!< in: all files modified | ||
2118 | 1863 | before timestamp should be removed */ | ||
2119 | 1864 | lsn_t before_no) /*!< in: files with this number in name | ||
2120 | 1865 | and earler should be removed */ | ||
2121 | 1866 | { | ||
2122 | 1867 | log_group_t* group = UT_LIST_GET_FIRST(log_sys->log_groups); | ||
2123 | 1868 | |||
2124 | 1869 | os_file_dir_t dir; | ||
2125 | 1870 | os_file_stat_t fileinfo; | ||
2126 | 1871 | char archived_log_filename[OS_FILE_MAX_PATH]; | ||
2127 | 1872 | char namegen[OS_FILE_MAX_PATH]; | ||
2128 | 1873 | ulint dirnamelen; | ||
2129 | 1874 | |||
2130 | 1875 | if (srv_arch_dir) { | ||
2131 | 1876 | dir = os_file_opendir(srv_arch_dir, FALSE); | ||
2132 | 1877 | if (!dir) { | ||
2133 | 1878 | fprintf(stderr, | ||
2134 | 1879 | "InnoDB: Note: opening archived log directory " | ||
2135 | 1880 | "%s failed. " | ||
2136 | 1881 | "Purge archived logs are not available\n", | ||
2137 | 1882 | srv_arch_dir); | ||
2138 | 1883 | /* failed to open directory */ | ||
2139 | 1884 | return(DB_ERROR); | ||
2140 | 1885 | } | ||
2141 | 1886 | } else { | ||
2142 | 1887 | /* log archive directory is not specified */ | ||
2143 | 1888 | return(DB_ERROR); | ||
2144 | 1889 | } | ||
2145 | 1890 | |||
2146 | 1891 | dirnamelen = strlen(srv_arch_dir); | ||
2147 | 1892 | |||
2148 | 1893 | memcpy(archived_log_filename, srv_arch_dir, dirnamelen); | ||
2149 | 1894 | if (dirnamelen && | ||
2150 | 1895 | archived_log_filename[dirnamelen - 1] != SRV_PATH_SEPARATOR) { | ||
2151 | 1896 | archived_log_filename[dirnamelen++] = SRV_PATH_SEPARATOR; | ||
2152 | 1897 | } | ||
2153 | 1898 | |||
2154 | 1899 | memset(&fileinfo, 0, sizeof(fileinfo)); | ||
2155 | 1900 | while(!os_file_readdir_next_file(srv_arch_dir, dir, | ||
2156 | 1901 | &fileinfo) ) { | ||
2157 | 1902 | if (strncmp(fileinfo.name, | ||
2158 | 1903 | IB_ARCHIVED_LOGS_PREFIX, IB_ARCHIVED_LOGS_PREFIX_LEN)) { | ||
2159 | 1904 | continue; | ||
2160 | 1905 | } | ||
2161 | 1906 | if (dirnamelen + strlen(fileinfo.name) + 2 > OS_FILE_MAX_PATH) | ||
2162 | 1907 | continue; | ||
2163 | 1908 | |||
2164 | 1909 | snprintf(archived_log_filename + dirnamelen, OS_FILE_MAX_PATH, | ||
2165 | 1910 | "%s", fileinfo.name); | ||
2166 | 1911 | |||
2167 | 1912 | if (before_no) { | ||
2168 | 1913 | ib_uint64_t log_file_no = strtoull(fileinfo.name + | ||
2169 | 1914 | IB_ARCHIVED_LOGS_PREFIX_LEN, | ||
2170 | 1915 | NULL, 10); | ||
2171 | 1916 | if (log_file_no == 0 || before_no <= log_file_no) { | ||
2172 | 1917 | continue; | ||
2173 | 1918 | } | ||
2174 | 1919 | } else { | ||
2175 | 1920 | fileinfo.mtime = 0; | ||
2176 | 1921 | if (os_file_get_status(archived_log_filename, | ||
2177 | 1922 | &fileinfo, false) != DB_SUCCESS || | ||
2178 | 1923 | fileinfo.mtime == 0) { | ||
2179 | 1924 | continue; | ||
2180 | 1925 | } | ||
2181 | 1926 | |||
2182 | 1927 | if (before_date == 0 || fileinfo.mtime > before_date) { | ||
2183 | 1928 | continue; | ||
2184 | 1929 | } | ||
2185 | 1930 | } | ||
2186 | 1931 | |||
2187 | 1932 | /* We are going to delete archived file. Acquire log_sys->mutex | ||
2188 | 1933 | to make sure that we are the only who try to delete file. This | ||
2189 | 1934 | also prevents log system from using this file. Do not delete | ||
2190 | 1935 | file if it is currently in progress of writting or have | ||
2191 | 1936 | pending IO. This is enforced by checking: | ||
2192 | 1937 | 1. fil_space_contains_node. | ||
2193 | 1938 | 2. group->archived_offset % group->file_size != 0, i.e. | ||
2194 | 1939 | there is archive in progress and we are going to delete it. | ||
2195 | 1940 | This covers 3 cases: | ||
2196 | 1941 | a. Usual case when we have one archive in progress, | ||
2197 | 1942 | both 1 and 2 are TRUE | ||
2198 | 1943 | b. When we have more then 1 archive in fil_space, | ||
2199 | 1944 | this can happen when flushed LSN range crosses file | ||
2200 | 1945 | boundary | ||
2201 | 1946 | c. When we have empty fil_space, but existing file will be | ||
2202 | 1947 | opened once archiving operation is requested. This usually | ||
2203 | 1948 | happens on startup. | ||
2204 | 1949 | */ | ||
2205 | 1950 | |||
2206 | 1951 | mutex_enter(&log_sys->mutex); | ||
2207 | 1952 | |||
2208 | 1953 | log_archived_file_name_gen(namegen, sizeof(namegen), | ||
2209 | 1954 | group->id, group->archived_file_no); | ||
2210 | 1955 | |||
2211 | 1956 | if (fil_space_contains_node(group->archive_space_id, | ||
2212 | 1957 | archived_log_filename) || | ||
2213 | 1958 | (group->archived_offset % group->file_size != 0 && | ||
2214 | 1959 | strcmp(namegen, archived_log_filename) == 0)) { | ||
2215 | 1960 | |||
2216 | 1961 | mutex_exit(&log_sys->mutex); | ||
2217 | 1962 | continue; | ||
2218 | 1963 | } | ||
2219 | 1964 | |||
2220 | 1965 | if (os_file_delete_if_exists(archived_log_filename) == FALSE) { | ||
2221 | 1966 | fprintf(stderr, | ||
2222 | 1967 | "InnoDB: Note: can't delete archived log file " | ||
2223 | 1968 | "%s.\n", archived_log_filename); | ||
2224 | 1969 | |||
2225 | 1970 | mutex_exit(&log_sys->mutex); | ||
2226 | 1971 | os_file_closedir(dir); | ||
2227 | 1972 | |||
2228 | 1973 | return(DB_ERROR); | ||
2229 | 1974 | } | ||
2230 | 1975 | |||
2231 | 1976 | mutex_exit(&log_sys->mutex); | ||
2232 | 1977 | } | ||
2233 | 1978 | |||
2234 | 1979 | os_file_closedir(dir); | ||
2235 | 1980 | |||
2236 | 1981 | return(DB_SUCCESS); | ||
2237 | 1982 | } | ||
2238 | 1983 | |||
2239 | 1984 | |||
2240 | 1855 | /*******************************************************************//** | 1985 | /*******************************************************************//** |
2241 | 1856 | Tells the InnoDB server that there has been activity in the database | 1986 | Tells the InnoDB server that there has been activity in the database |
2242 | 1857 | and wakes up the master thread if it is suspended (not sleeping). Used | 1987 | and wakes up the master thread if it is suspended (not sleeping). Used |
2243 | @@ -2205,6 +2335,16 @@ | |||
2244 | 2205 | log_checkpoint(TRUE, FALSE); | 2335 | log_checkpoint(TRUE, FALSE); |
2245 | 2206 | MONITOR_INC_TIME_IN_MICRO_SECS(MONITOR_SRV_CHECKPOINT_MICROSECOND, | 2336 | MONITOR_INC_TIME_IN_MICRO_SECS(MONITOR_SRV_CHECKPOINT_MICROSECOND, |
2246 | 2207 | counter_time); | 2337 | counter_time); |
2247 | 2338 | |||
2248 | 2339 | if (srv_shutdown_state > 0) { | ||
2249 | 2340 | return; | ||
2250 | 2341 | } | ||
2251 | 2342 | |||
2252 | 2343 | if (srv_log_arch_expire_sec) { | ||
2253 | 2344 | srv_main_thread_op_info = "purging archived logs"; | ||
2254 | 2345 | purge_archived_logs(ut_time() - srv_log_arch_expire_sec, | ||
2255 | 2346 | 0); | ||
2256 | 2347 | } | ||
2257 | 2208 | } | 2348 | } |
2258 | 2209 | 2349 | ||
2259 | 2210 | /*********************************************************************//** | 2350 | /*********************************************************************//** |
2260 | 2211 | 2351 | ||
2261 | === modified file 'Percona-Server/storage/innobase/srv/srv0start.cc' | |||
2262 | --- Percona-Server/storage/innobase/srv/srv0start.cc 2013-03-05 12:46:43 +0000 | |||
2263 | +++ Percona-Server/storage/innobase/srv/srv0start.cc 2013-03-31 06:25:28 +0000 | |||
2264 | @@ -640,6 +640,11 @@ | |||
2265 | 640 | } | 640 | } |
2266 | 641 | } | 641 | } |
2267 | 642 | 642 | ||
2268 | 643 | #ifdef UNIV_LOG_ARCHIVE | ||
2269 | 644 | /* Create the file space object for archived logs. */ | ||
2270 | 645 | fil_space_create("arch_log_space", SRV_LOG_SPACE_FIRST_ID + 1, | ||
2271 | 646 | 0, FIL_LOG); | ||
2272 | 647 | #endif | ||
2273 | 643 | log_group_init(0, srv_n_log_files, | 648 | log_group_init(0, srv_n_log_files, |
2274 | 644 | srv_log_file_size * UNIV_PAGE_SIZE, | 649 | srv_log_file_size * UNIV_PAGE_SIZE, |
2275 | 645 | SRV_LOG_SPACE_FIRST_ID, | 650 | SRV_LOG_SPACE_FIRST_ID, |
2276 | @@ -650,7 +655,12 @@ | |||
2277 | 650 | /* Create a log checkpoint. */ | 655 | /* Create a log checkpoint. */ |
2278 | 651 | mutex_enter(&log_sys->mutex); | 656 | mutex_enter(&log_sys->mutex); |
2279 | 652 | ut_d(recv_no_log_write = FALSE); | 657 | ut_d(recv_no_log_write = FALSE); |
2281 | 653 | recv_reset_logs(lsn); | 658 | recv_reset_logs( |
2282 | 659 | #ifdef UNIV_LOG_ARCHIVE | ||
2283 | 660 | UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no, | ||
2284 | 661 | TRUE, | ||
2285 | 662 | #endif | ||
2286 | 663 | lsn); | ||
2287 | 654 | mutex_exit(&log_sys->mutex); | 664 | mutex_exit(&log_sys->mutex); |
2288 | 655 | 665 | ||
2289 | 656 | return(DB_SUCCESS); | 666 | return(DB_SUCCESS); |
2290 | @@ -738,9 +748,9 @@ | |||
2291 | 738 | ibool* create_new_db, /*!< out: TRUE if new database should be | 748 | ibool* create_new_db, /*!< out: TRUE if new database should be |
2292 | 739 | created */ | 749 | created */ |
2293 | 740 | #ifdef UNIV_LOG_ARCHIVE | 750 | #ifdef UNIV_LOG_ARCHIVE |
2295 | 741 | ulint* min_arch_log_no,/*!< out: min of archived log | 751 | lsn_t* min_arch_log_no,/*!< out: min of archived log |
2296 | 742 | numbers in data files */ | 752 | numbers in data files */ |
2298 | 743 | ulint* max_arch_log_no,/*!< out: max of archived log | 753 | lsn_t* max_arch_log_no,/*!< out: max of archived log |
2299 | 744 | numbers in data files */ | 754 | numbers in data files */ |
2300 | 745 | #endif /* UNIV_LOG_ARCHIVE */ | 755 | #endif /* UNIV_LOG_ARCHIVE */ |
2301 | 746 | lsn_t* min_flushed_lsn,/*!< out: min of flushed lsn | 756 | lsn_t* min_flushed_lsn,/*!< out: min of flushed lsn |
2302 | @@ -963,9 +973,6 @@ | |||
2303 | 963 | skip_size_check: | 973 | skip_size_check: |
2304 | 964 | fil_read_first_page( | 974 | fil_read_first_page( |
2305 | 965 | files[i], one_opened, &flags, &space, | 975 | files[i], one_opened, &flags, &space, |
2306 | 966 | #ifdef UNIV_LOG_ARCHIVE | ||
2307 | 967 | min_arch_log_no, max_arch_log_no, | ||
2308 | 968 | #endif /* UNIV_LOG_ARCHIVE */ | ||
2309 | 969 | min_flushed_lsn, max_flushed_lsn); | 976 | min_flushed_lsn, max_flushed_lsn); |
2310 | 970 | 977 | ||
2311 | 971 | /* The first file of the system tablespace must | 978 | /* The first file of the system tablespace must |
2312 | @@ -1443,8 +1450,8 @@ | |||
2313 | 1443 | lsn_t min_flushed_lsn; | 1450 | lsn_t min_flushed_lsn; |
2314 | 1444 | lsn_t max_flushed_lsn; | 1451 | lsn_t max_flushed_lsn; |
2315 | 1445 | #ifdef UNIV_LOG_ARCHIVE | 1452 | #ifdef UNIV_LOG_ARCHIVE |
2318 | 1446 | ulint min_arch_log_no; | 1453 | lsn_t min_arch_log_no; |
2319 | 1447 | ulint max_arch_log_no; | 1454 | lsn_t max_arch_log_no; |
2320 | 1448 | #endif /* UNIV_LOG_ARCHIVE */ | 1455 | #endif /* UNIV_LOG_ARCHIVE */ |
2321 | 1449 | ulint sum_of_new_sizes; | 1456 | ulint sum_of_new_sizes; |
2322 | 1450 | ulint sum_of_data_file_sizes; | 1457 | ulint sum_of_data_file_sizes; |
2323 | @@ -1883,17 +1890,6 @@ | |||
2324 | 1883 | os_thread_create(io_handler_thread, n + i, thread_ids + i); | 1890 | os_thread_create(io_handler_thread, n + i, thread_ids + i); |
2325 | 1884 | } | 1891 | } |
2326 | 1885 | 1892 | ||
2327 | 1886 | #ifdef UNIV_LOG_ARCHIVE | ||
2328 | 1887 | if (0 != ut_strcmp(srv_log_group_home_dir, srv_arch_dir)) { | ||
2329 | 1888 | ut_print_timestamp(stderr); | ||
2330 | 1889 | fprintf(stderr, " InnoDB: Error: you must set the log group home dir in my.cnf\n"); | ||
2331 | 1890 | ut_print_timestamp(stderr); | ||
2332 | 1891 | fprintf(stderr, " InnoDB: the same as log arch dir.\n"); | ||
2333 | 1892 | |||
2334 | 1893 | return(DB_ERROR); | ||
2335 | 1894 | } | ||
2336 | 1895 | #endif /* UNIV_LOG_ARCHIVE */ | ||
2337 | 1896 | |||
2338 | 1897 | if (srv_n_log_files * srv_log_file_size * UNIV_PAGE_SIZE | 1893 | if (srv_n_log_files * srv_log_file_size * UNIV_PAGE_SIZE |
2339 | 1898 | >= 512ULL * 1024ULL * 1024ULL * 1024ULL) { | 1894 | >= 512ULL * 1024ULL * 1024ULL * 1024ULL) { |
2340 | 1899 | /* log_block_convert_lsn_to_no() limits the returned block | 1895 | /* log_block_convert_lsn_to_no() limits the returned block |
2341 | @@ -1982,7 +1978,6 @@ | |||
2342 | 1982 | 1978 | ||
2343 | 1983 | #ifdef UNIV_LOG_ARCHIVE | 1979 | #ifdef UNIV_LOG_ARCHIVE |
2344 | 1984 | srv_normalize_path_for_win(srv_arch_dir); | 1980 | srv_normalize_path_for_win(srv_arch_dir); |
2345 | 1985 | srv_arch_dir = srv_add_path_separator_if_needed(srv_arch_dir); | ||
2346 | 1986 | #endif /* UNIV_LOG_ARCHIVE */ | 1981 | #endif /* UNIV_LOG_ARCHIVE */ |
2347 | 1987 | 1982 | ||
2348 | 1988 | dirnamelen = strlen(srv_log_group_home_dir); | 1983 | dirnamelen = strlen(srv_log_group_home_dir); |
2349 | @@ -2462,6 +2457,8 @@ | |||
2350 | 2462 | if (!srv_log_archive_on) { | 2457 | if (!srv_log_archive_on) { |
2351 | 2463 | ut_a(DB_SUCCESS == log_archive_noarchivelog()); | 2458 | ut_a(DB_SUCCESS == log_archive_noarchivelog()); |
2352 | 2464 | } else { | 2459 | } else { |
2353 | 2460 | bool start_archive; | ||
2354 | 2461 | |||
2355 | 2465 | mutex_enter(&(log_sys->mutex)); | 2462 | mutex_enter(&(log_sys->mutex)); |
2356 | 2466 | 2463 | ||
2357 | 2467 | start_archive = FALSE; | 2464 | start_archive = FALSE; |
http:// jenkins. percona. com/view/ PS%205. 6/job/percona- server- 5.6-param/ 37/