Skip to content

Commit 068280f

Browse files
author
otsuka.knj@gmail.com
committed
Supporting PostgreSQL 9.2.
Fix a bug about --recovery-target-time. Fix SPEC files for using normal user. (Reported by Nagayasu-san) Fix a compiling bug on no LZLib environment. Add restriction about Incremental backup. git-svn-id: http://pg-rman.googlecode.com/svn/trunk@71 182aca00-e38e-11de-a668-6fd11605f5ce
1 parent 98b6bac commit 068280f

File tree

12 files changed

+80
-17
lines changed

12 files changed

+80
-17
lines changed

SPECS/pg_rman90.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## Set general information for pg_rman.
1010
Summary: Backup and Recovery Tool for PostgreSQL
1111
Name: pg_rman
12-
Version: 1.2.4
12+
Version: 1.2.5
1313
Release: 1%{?dist}
1414
License: BSD
1515
Group: Applications/Databases
@@ -44,7 +44,7 @@ USE_PGXS=1 make %{?_smp_mflags}
4444
%install
4545
rm -rf %{buildroot}
4646

47-
USE_PGXS=1 make %{?_smp_mflags} install
47+
USE_PGXS=1 DESTDIR=%{buildroot} make %{?_smp_mflags} install
4848

4949
install -d %{buildroot}%{_bindir}
5050
install -m 755 pg_rman %{buildroot}%{_bindir}/pg_rman

SPECS/pg_rman91.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## Set general information for pg_rman.
1010
Summary: Backup and Recovery Tool for PostgreSQL
1111
Name: pg_rman
12-
Version: 1.2.4
12+
Version: 1.2.5
1313
Release: 1%{?dist}
1414
License: BSD
1515
Group: Applications/Databases
@@ -44,7 +44,7 @@ USE_PGXS=1 make %{?_smp_mflags}
4444
%install
4545
rm -rf %{buildroot}
4646

47-
USE_PGXS=1 make %{?_smp_mflags} install
47+
USE_PGXS=1 DESTDIR=%{buildroot} make %{?_smp_mflags} install
4848

4949
install -d %{buildroot}%{_bindir}
5050
install -m 755 pg_rman %{buildroot}%{_bindir}/pg_rman

SPECS/pg_rman92.spec

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# SPEC file for pg_rman
2+
# Copyright(C) 2009-2012 NIPPON TELEGRAPH AND TELEPHONE CORPORATION
3+
4+
%define _pgdir /usr/pgsql-9.2
5+
%define _bindir %{_pgdir}/bin
6+
%define _libdir %{_pgdir}/lib
7+
%define _datadir %{_pgdir}/share
8+
9+
## Set general information for pg_rman.
10+
Summary: Backup and Recovery Tool for PostgreSQL
11+
Name: pg_rman
12+
Version: 1.2.5
13+
Release: 1%{?dist}
14+
License: BSD
15+
Group: Applications/Databases
16+
Source0: %{name}-%{version}.tar.gz
17+
URL: http://code.google.com/p/pg-rman/
18+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
19+
Vendor: NIPPON TELEGRAPH AND TELEPHONE CORPORATION
20+
21+
## We use postgresql-devel package
22+
BuildRequires: postgresql92-devel
23+
Requires: postgresql92-libs
24+
25+
## Description for "pg_rman"
26+
%description
27+
pg_rman manages backup and recovery of PostgreSQL.
28+
pg_rman has the features below:
29+
-Takes a backup while database including tablespaces with just one command.
30+
-Can recovery from backup with just one command.
31+
-Supports incremental backup and compression of backup files so that it takes less disk spaces.
32+
-Manages backup generations and shows a catalog of the backups.
33+
34+
35+
## pre work for build pg_rman
36+
%prep
37+
%setup -q -n %{name}-%{version}
38+
39+
## Set variables for build environment
40+
%build
41+
USE_PGXS=1 make %{?_smp_mflags}
42+
43+
## Set variables for install
44+
%install
45+
rm -rf %{buildroot}
46+
47+
USE_PGXS=1 DESTDIR=%{buildroot} make %{?_smp_mflags} install
48+
49+
install -d %{buildroot}%{_bindir}
50+
install -m 755 pg_rman %{buildroot}%{_bindir}/pg_rman
51+
52+
%clean
53+
rm -rf %{buildroot}
54+
55+
%files
56+
%defattr(755,root,root)
57+
%{_bindir}/pg_rman
58+
59+
# History of pg_rman.
60+
%changelog
61+
* Wed Nov 10 2010 - NTT OSS Center <tomonari.katsumata@oss.ntt.co.jp> 1.2.0-1
62+
* Wed Dec 9 2009 - NTT OSS Center <itagaki.takahiro@oss.ntt.co.jp> 1.1.1-1
63+
- Initial cut for 1.1.1
64+

backup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,10 +684,10 @@ do_backup(bool smooth_checkpoint,
684684
elog(ERROR_ARGS, _("required parameter not specified: SRVLOG_PATH (-S, --srvlog-path)"));
685685

686686
#ifndef HAVE_LIBZ
687-
if (current->compress_data)
687+
if (current.compress_data)
688688
{
689689
elog(WARNING, _("requested compression not available in this: installation -- archive will be uncompressed"));
690-
current->compress_data = false;
690+
current.compress_data = false;
691691
}
692692
#endif
693693

data.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ backup_data_file(const char *from_root, const char *to_root,
294294
z_stream z;
295295
char outbuf[zlibOutSize];
296296
#endif
297-
298297
INIT_CRC32(crc);
299298

300299
/* reset size summary */
@@ -787,7 +786,6 @@ copy_file(const char *from_root, const char *to_root, pgFile *file,
787786
char outbuf[zlibOutSize];
788787
char inbuf[zlibInSize];
789788
#endif
790-
791789
INIT_CRC32(crc);
792790

793791
/* reset size summary */

expected/backup_restore.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ diff files in BACKUP_PATH/backup/pg_xlog
1515
1
1616
diff files in BACKUP_PATH/backup/pg_xlog
1717
# of files in BACKUP_PATH/backup/srvlog
18-
1
18+
2
1919
full database backup after recovery
2020
CHECKPOINT
2121
# of files in BACKUP_PATH/backup/pg_xlog
2222
0
2323
# of files in BACKUP_PATH/backup/srvlog
24-
1
24+
2
2525
# of symbolic links in ARCLOG_PATH
2626
0
2727
# of files in BACKUP_PATH/timeline_history

expected/option.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Generic options:
5454

5555
Read the website for details. <http://code.google.com/p/pg-rman/>
5656
Report bugs to <http://code.google.com/p/pg-rman/issues/list>.
57-
pg_rman 1.2.4
57+
pg_rman 1.2.5
5858
ERROR: required parameter not specified: BACKUP_PATH (-B, --backup-path)
5959
ERROR: required parameter not specified: BACKUP_MODE (-b, --backup-mode)
6060
ERROR: required parameter not specified: ARCLOG_PATH (-A, --arclog-path)

pg_rman.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <time.h>
1515
#include <sys/stat.h>
1616

17-
const char *PROGRAM_VERSION = "1.2.4";
17+
const char *PROGRAM_VERSION = "1.2.5";
1818
const char *PROGRAM_URL = "http://code.google.com/p/pg-rman/";
1919
const char *PROGRAM_EMAIL = "http://code.google.com/p/pg-rman/issues/list";
2020

restore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ do_restore(const char *target_time,
163163
if (base_backup->compress_data &&
164164
(HAVE_DATABASE(base_backup) || HAVE_ARCLOG(base_backup)))
165165
{
166-
elog(EXIT_NOT_SUPPORTED,
166+
elog(ERROR_SYSTEM,
167167
_("can't restore from compressed backup (compression not supported in this installation)"));
168168
}
169169
#endif
@@ -201,7 +201,7 @@ do_restore(const char *target_time,
201201
continue;
202202

203203
/* is the backup is necessary for restore to target timeline ? */
204-
if (!satisfy_timeline(timelines, backup) && !satisfy_recovery_target(backup, rt))
204+
if (!satisfy_timeline(timelines, backup) || !satisfy_recovery_target(backup, rt))
205205
continue;
206206

207207
if (verbose)

sql/backup.sql

Lines changed: 0 additions & 3 deletions
This file was deleted.

sql/backup_restore.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ logging_collector = on
7878
wal_level = archive
7979
archive_mode = on
8080
archive_command = 'cp "%p" "$ARCLOG_PATH/%f"'
81+
log_filename = 'postgresql-%F_%H%M%S.log'
8182
EOF
8283

8384
mkdir -p $ARCLOG_PATH

xlog.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ typedef struct MemoryContextData *MemoryContext;
2828
#define XLOG_PAGE_MAGIC_v84 0xD063 /* 8.4 */
2929
#define XLOG_PAGE_MAGIC_v90 0xD064 /* 9.0 */
3030
#define XLOG_PAGE_MAGIC_v91 0xD066 /* 9.1 */
31+
#define XLOG_PAGE_MAGIC_v92 0xD071 /* 9.2 */
3132

3233
/*
3334
* XLogLongPageHeaderData is modified in 8.3, but the layout is compatible
@@ -78,6 +79,8 @@ xlog_is_complete_wal(const pgFile *file, int server_version)
7879
xlog_page_magic = XLOG_PAGE_MAGIC_v90;
7980
else if (server_version < 90200)
8081
xlog_page_magic = XLOG_PAGE_MAGIC_v91;
82+
else if (server_version < 90300)
83+
xlog_page_magic = XLOG_PAGE_MAGIC_v92;
8184
else
8285
return false; /* not supported */
8386

0 commit comments

Comments
 (0)