1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-11 11:41:33 +02:00
Commit Graph

682 Commits

Author SHA1 Message Date
Michael Paquier
9cd8e33508 Remove undocumented option "force" for delete command
This was in code, not in the docs...
2014-01-10 02:57:15 +09:00
Michael Paquier
e04426361f Allow only one keep parameter to trigger log and archive deletion
Same as previously, having two satisfy two conditions where most of the
users will just look for one policy usually is kind of awkward.
2014-01-10 02:48:11 +09:00
Michael Paquier
fcaae1a34b Allow only one keep parameter to trigger backup deletion
Having files satisfying both conditions seems somewhat awkward, as users
would usually choose either the number of generations to keep or the
amount of days to keep the files. Hence deletion of a backup is bypassed
only when both parameters are set to infinite.

At the same time correct some typos and incorrections in the deletion
code.
2014-01-10 02:37:33 +09:00
Michael Paquier
cb939f6bef Block backup operations for standbys
Backup from standbys should use a method based on replication protocol
in a way similar to what is done in pg_basebackup, as it cannot use
pg_start/stop_backup. As I am not sure what would be the right approach
by the way, it is better for the time being to block backups taken
from a standby. It does not penalize the functionality though as taking
disk snapshots is not forbidden either, and a user can still recover
from that. This commit removes at the same time some home-made functions
that created custom backup label files, this is not relyable, especially
if Postgres core format for this file changes across versions. Removing
them at least will save from some bugs for sure.
2013-12-26 21:16:01 +09:00
Michael Paquier
85f0c1e802 Block archive backup for a standby node
A standby node only replays WAL, and does not actually archive them so
in this case this mode does not have much sense.
2013-12-25 08:52:38 +09:00
Michael Paquier
a66e683dd4 Improve comment explaining how search_next_wal works with LSN
This makes the explanation a bit clearer, as the LSN in this function
is used with the current timeline to generate the file name.
2013-12-25 08:26:25 +09:00
Michael Paquier
ced83f7703 Fix WAL segment file generation
Name file of WAL segment was generated using the API of xlog_internal.h
called XlogFileName, based on XLogSegNo and not XLogRecPtr as the
previous code assumed. This leaded to backup incorrect, actually too
many WAL files in the archive code path because the analysis was based
on a name completely fucked up. This commit fixes at the same time an
issue in search_next_wal where the function could loop for a too long
amount of time, eating much CPU when looking for the next WAL file.

Regression tests are passing cleanly with this patch.
2013-12-25 08:17:01 +09:00
Michael Paquier
78d92ff8fb Fix typo 2013-12-25 05:33:50 +09:00
Michael Paquier
1bc1f1d1b6 Improve backup mode management
This commit makes mandatory the presence of a full backup when doing
an incremental or archive backup on an existing timeline. In this case
the process will now simply error out and not take any backup. It looks
safer to use that as a default by the way, so as user will be forced
to take a full backup once a recovery has been done.

Database backup also contained the following condition when doing an
incremental backup:
prev_backup->tli != current.tli
This means that an incremental backup cannot be taken if there is not
already a full backup present in the same timeline. The same condition
should also be used for archive backup but it didn't seem to be the
case...
2013-12-25 05:27:25 +09:00
Michael Paquier
26b8870665 Fix archive backup mode due to incorrect timeline assigned
This bug has been introduced by some older code, it looks that it will be
necessary to re-create a battery of regression tests to test all those
things automtically, as former tests contain nothing to test archive
mode directly.
2013-12-25 04:36:07 +09:00
Michael Paquier
e5ab0917cc Fix pg_switch_xlog for archive mode
An additional parenthesis was present in the code.
2013-12-25 03:53:18 +09:00
Michael Paquier
3f79be1789 Add documentation of pg_rman
Documentation is fairly refactored and rewritten, fixing many typos and
many grammar mistakes in the previous version of the docs.
2013-12-25 03:48:36 +09:00
Michael Paquier
8efe5c9da4 Change version number to 1.3dev 2013-12-18 19:25:26 +08:00
Michael Paquier
a8f98e9e27 Update project and bug report URLs
As this project has been forked to github...
2013-12-18 19:24:27 +08:00
Michael Paquier
90c2f645f6 Mention in README platforms supported 2013-12-15 22:07:32 +09:00
Michael Paquier
8acd23c28a Add README to project
This was still missing, and explains the fundamentals of the project.
2013-12-15 22:05:36 +09:00
Michael Paquier
3af0a65383 Fix create_dir not working properly for OSX
This makes pg_rman working normally, caused by some OS-related subtility...
2013-12-15 21:32:02 +09:00
Michael Paquier
ef59f85d0d Remove duplicated definition of Datum and MemoryContext 2013-12-16 01:16:08 +09:00
Michael Paquier
f4cf982e9f Correct typo in comment 2013-12-16 01:10:29 +09:00
Michael Paquier
83f4e80a74 Always return an error in case of incorrect backup mode
Some code paths allowed an invalid backup mode to be passed, something
rather crazy as they directly depended on that...
2013-12-16 00:50:36 +09:00
Michael Paquier
9ecd5acb97 Update comment in pg\rman.h about new file status.c 2013-12-16 00:36:50 +09:00
Michael Paquier
0938c645bb Update regression output after latest commit
Missed that actually...
2013-12-16 00:35:14 +09:00
Michael Paquier
05ce188607 Simplify code related to HAVE_DATABASE, HAVE_ARCLOG, TOTAL_READ_SIZE
Those macros were mainly used in code paths where they didn't make that
much sense, complicating heavily the code. Correct at the same time some
code comments.
2013-12-16 00:30:49 +09:00
Michael Paquier
96cfb3eb13 Simplify code for recovery target identification
Some unnecessary comments are removed and cleaned as well at the same
time.
2013-12-15 23:50:04 +09:00
Michael Paquier
f77d141b7c Simplify beginning of database backup
It was unclear what was being errored out at the beginning of the
process. But it happens that it is just necessary to check if the
backup running is only an archive or not, then return a NULL file
list before continuing process. This should be part of some safety
checks though.
2013-12-15 23:41:42 +09:00
Michael Paquier
4b0f88e4d5 Remove standby-site option
The documentation found on internet is rather unclear about the role
and the goal of this feature, which looks more like a kludge to cover
the fact that most of the system XLOG functions do not work on standby
nodes. Now that this restriction has been removed by using the control
file to look for the current timestamp, this feature is not needed.
2013-12-13 04:14:29 +09:00
Michael Paquier
308d00b80c Obtain timeline ID with control file and not XLOG system function
The system function used up to now was pg_xlogfile_name_offset, which
cannot be used on a node in recovery, and it was the only way present
to fetch the timeline ID of a backup, either incremental or full. So
instead scan the control file of server and fetch the timeline from
that. This also removes the restriction on which a backup could not
be taken on a standby node. The next step being to have the possibility
to take backups from streams.
2013-12-13 03:55:39 +09:00
Michael Paquier
a31fdbd260 Remove outdated versions of PageHeaderData
This code was dead and maintained ony for multi-versioning.
2013-12-13 01:07:43 +09:00
Michael Paquier
9acc962fd7 Remove outdated functions in pgut 2013-12-13 01:02:43 +09:00
Michael Paquier
9e35dd0d47 Adapt output of regressions with new options and "show" output
Because of that two regression tests were failing:
- option
- show_validate
2013-12-13 00:57:54 +09:00
Michael Paquier
fd8bde8e10 Merge "show timeline" and "show" as a single command
It is just troublesome to have to type a subcommands for something that
could be merged into a single table. The output could be made in a
smarter way though...
2013-12-13 00:54:27 +09:00
Michael Paquier
ef44c4f347 Add missing --verbose/-v option in --help 2013-12-13 00:41:53 +09:00
Michael Paquier
1de877d38f Fix server status not correctly fetched
This error has been introduced by ebe2166 because of some incorrect
refactoring.
2013-12-13 00:29:25 +09:00
Michael Paquier
10ea7426e6 Remove SPECS for RPM packaging 2013-12-13 00:21:10 +09:00
Michael Paquier
b92d722bdb Clean up the snapshot related stuff
This is not really part of the core of pg_rman, rather better to
focus on incremental backup or stuff like that.
2013-12-13 00:20:20 +09:00
Michael Paquier
ebe2166379 Refactor code in pgsql_src for server monitoring
Most of those things are taken from pg_ctl.c, but were somewhat not
really in a place corresponding to their role.
2013-12-12 23:54:52 +09:00
Michael Paquier
5f3823c3c4 Remove reference to pg_crc.h
It was simply not used, and could be fetched from core if necessary.
2013-12-12 23:35:49 +09:00
Michael Paquier
30430a3729 Remove dead code
Those files were simply not used, remnants of a far greater past
perhaps.
2013-12-12 23:28:44 +09:00
Michael Paquier
2a23a50743 Simplify LSN calculation from result of pg_stop_backup
New behavior relies on XLogFromFileName instead of having a custom sscanf
doing exactly the same thing.
2013-12-12 22:56:35 +09:00
Michael Paquier
cf6ca26ba9 Remove notion of Xlog ID/offset and use XLogRecPtr instead
This simplifies algorithm and APIs a bit, and removes a duplication
function used to generate a file name...
2013-12-12 22:45:57 +09:00
Michael Paquier
5bc716415a Begin cleanup of version-related code
Due to changes in XlogRecPtr in 9.3, older version of pg_rman are
already incompatible either way, and it is a pain to maintain code
duplicated from past versions of Postgres, so rely a maximum on the
core structures.
2013-12-12 22:20:08 +09:00
Michael Paquier
83462de39b Remove some internal variables in xlog_internal.h
It serves nothing to replicate such things.
2013-12-12 21:39:40 +09:00
Michael Paquier
200d1fde63 Remove multi-versioning of XLOG_PAGE_MAGIC
This is a pain to maintain, and simplifies the code a bit.
2013-12-12 21:28:33 +09:00
Michael Paquier
8a34a18ea1 Fix regression tests
Postgres 9.3 has introduced the previous timeline ID at last checkpoint
in pg_controldata, conflicting with the regression script used here...
2013-12-10 18:11:32 +09:00
Michael Paquier
26b97fbcee Simplify regression test script for restore
The same condition was checked twice...
2013-12-10 17:50:28 +09:00
Michael Paquier
8aa6b84b98 Fix history file parsing when fetched from archive
History file format has changed from 9.2 to 9.3 to indicate the WAL record
when timeline branched off. In 9.2, the complete WAL file name was used
while in 9.3 the WAL record is used (like 1/4000090). pg_rman contains a
copy of a function of postgres core code to parse the history file that
was not anymore compatible, leading to errors related to timelines.
2013-12-10 17:27:51 +09:00
Michael Paquier
71d019ce56 Avoid regression diffs generated by custom .psqlrc
This is done by using psql with --no-psqlrc mode in related test script.
2013-12-10 09:28:05 +09:00
Michael Paquier
bd75d08ef3 Rename XLogFileName to XLogFileNameLong
This is a lazy solution to avoid a conflict with the existing API in
xlog_internal.h, and should be corrected to use the one in core.
2013-12-10 03:29:47 +09:00
Michael Paquier
4d7bf5373c Fix uint64 cast forgotten by latest commit 2013-12-10 03:24:01 +09:00
Michael Paquier
1bc0f9baff Support pg_rman for PG_VERSION_NUM >= 9.3
In Postgres 9.3, XLogRecPtr has been changed to a unique uint64, making
the old structure based on two uint32 obsolete. Note that this makes
pg_rman incompatible with PG <= 9.2.
2013-12-10 03:21:07 +09:00