~akopytov/percona-xtrabackup/xtrabackup-1.6-copy-diagnostics

« back to all changes in this revision

Viewing changes to doc/source/xtrabackup_bin/implementation_details.rst

  • Committer: Hrvoje Matijakovic
  • Date: 2012-02-16 17:05:16 UTC
  • Revision ID: hrvoje.matijakovic@percona.com-20120216170516-s3b0nk7x6av63b7t
imported the sphinx docs from the current trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
========================
 
2
 Implementation Details
 
3
========================
 
4
 
 
5
This page contains notes on various internal aspects of the |xtrabackup| tool's operation.
 
6
 
 
7
File Permissions
 
8
================
 
9
 
 
10
|xtrabackup| opens the source data files in read-write mode, although it does not modify the files. This means that you must run |xtrabackup| as a user who has permission to write the data files. The reason for opening the files in read-write mode is that |xtrabackup| uses the embedded |InnoDB| libraries to open and read the files, and |InnoDB| opens them in read-write mode because it normally assumes it is going to write to them.
 
11
 
 
12
Tuning the OS Buffers
 
13
=====================
 
14
 
 
15
Because |xtrabackup| reads large amounts of data from the filesystem, it uses ``posix_fadvise()`` where possible, to instruct the operating system not to try to cache the blocks it reads from disk. Without this hint, the operating system would prefer to cache the blocks, assuming that ``xtrabackup`` is likely to need them again, which is not the case. Caching such large files can place pressure on the operating system's virtual memory and cause other processes, such as the database server, to be swapped out. The ``xtrabackup`` tool avoids this with the following hint on both the source and destination files: ::
 
16
 
 
17
  posix_fadvise(file, 0, 0, POSIX_FADV_DONTNEED)
 
18
 
 
19
In addition, xtrabackup asks the operating system to perform more aggressive read-ahead optimizations on the source files: ::
 
20
 
 
21
  posix_fadvise(file, 0, 0, POSIX_FADV_SEQUENTIAL)
 
22
 
 
23
Copying Data Files
 
24
==================
 
25
 
 
26
When copying the data files to the target directory, |xtrabackup| reads and writes 1MB of data at a time. This is not configurable. When copying the log file, |xtrabackup| reads and writes 512 bytes at a time. This is also not possible to configure, and matches |InnoDB| 's behavior.
 
27
 
 
28
After reading from the files, ``xtrabackup`` iterates over the 1MB buffer a page at a time, and checks for page corruption on each page with InnoDB's ``buf_page_is_corrupted()`` function. If the page is corrupt, it re-reads and retries up to 10 times for each page. It skips this check on the doublewrite buffer.