Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
632fbe77
Commit
632fbe77
authored
Oct 14, 2016
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pg_archivecleanup: Add NLS
Reviewed-by:
Michael Paquier
<
michael.paquier@gmail.com
>
parent
84ad68d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
36 deletions
+41
-36
src/bin/pg_archivecleanup/nls.mk
src/bin/pg_archivecleanup/nls.mk
+4
-0
src/bin/pg_archivecleanup/pg_archivecleanup.c
src/bin/pg_archivecleanup/pg_archivecleanup.c
+37
-36
No files found.
src/bin/pg_archivecleanup/nls.mk
0 → 100644
View file @
632fbe77
# src/bin/pg_archivecleanup/nls.mk
CATALOG_NAME
=
pg_archivecleanup
AVAIL_LANGUAGES
=
GETTEXT_FILES
=
pg_archivecleanup.c
src/bin/pg_archivecleanup/pg_archivecleanup.c
View file @
632fbe77
...
@@ -70,7 +70,7 @@ Initialize(void)
...
@@ -70,7 +70,7 @@ Initialize(void)
if
(
stat
(
archiveLocation
,
&
stat_buf
)
!=
0
||
if
(
stat
(
archiveLocation
,
&
stat_buf
)
!=
0
||
!
S_ISDIR
(
stat_buf
.
st_mode
))
!
S_ISDIR
(
stat_buf
.
st_mode
))
{
{
fprintf
(
stderr
,
"%s: archive location
\"
%s
\"
does not exist
\n
"
,
fprintf
(
stderr
,
_
(
"%s: archive location
\"
%s
\"
does not exist
\n
"
)
,
progname
,
archiveLocation
);
progname
,
archiveLocation
);
exit
(
2
);
exit
(
2
);
}
}
...
@@ -146,19 +146,19 @@ CleanupPriorWALFiles(void)
...
@@ -146,19 +146,19 @@ CleanupPriorWALFiles(void)
printf
(
"%s
\n
"
,
WALFilePath
);
printf
(
"%s
\n
"
,
WALFilePath
);
if
(
debug
)
if
(
debug
)
fprintf
(
stderr
,
fprintf
(
stderr
,
"%s: file
\"
%s
\"
would be removed
\n
"
,
_
(
"%s: file
\"
%s
\"
would be removed
\n
"
)
,
progname
,
WALFilePath
);
progname
,
WALFilePath
);
continue
;
continue
;
}
}
if
(
debug
)
if
(
debug
)
fprintf
(
stderr
,
"%s: removing file
\"
%s
\"\n
"
,
fprintf
(
stderr
,
_
(
"%s: removing file
\"
%s
\"\n
"
)
,
progname
,
WALFilePath
);
progname
,
WALFilePath
);
rc
=
unlink
(
WALFilePath
);
rc
=
unlink
(
WALFilePath
);
if
(
rc
!=
0
)
if
(
rc
!=
0
)
{
{
fprintf
(
stderr
,
"%s: ERROR: could not remove file
\"
%s
\"
: %s
\n
"
,
fprintf
(
stderr
,
_
(
"%s: ERROR: could not remove file
\"
%s
\"
: %s
\n
"
)
,
progname
,
WALFilePath
,
strerror
(
errno
));
progname
,
WALFilePath
,
strerror
(
errno
));
break
;
break
;
}
}
...
@@ -166,14 +166,14 @@ CleanupPriorWALFiles(void)
...
@@ -166,14 +166,14 @@ CleanupPriorWALFiles(void)
}
}
if
(
errno
)
if
(
errno
)
fprintf
(
stderr
,
"%s: could not read archive location
\"
%s
\"
: %s
\n
"
,
fprintf
(
stderr
,
_
(
"%s: could not read archive location
\"
%s
\"
: %s
\n
"
)
,
progname
,
archiveLocation
,
strerror
(
errno
));
progname
,
archiveLocation
,
strerror
(
errno
));
if
(
closedir
(
xldir
))
if
(
closedir
(
xldir
))
fprintf
(
stderr
,
"%s: could not close archive location
\"
%s
\"
: %s
\n
"
,
fprintf
(
stderr
,
_
(
"%s: could not close archive location
\"
%s
\"
: %s
\n
"
)
,
progname
,
archiveLocation
,
strerror
(
errno
));
progname
,
archiveLocation
,
strerror
(
errno
));
}
}
else
else
fprintf
(
stderr
,
"%s: could not open archive location
\"
%s
\"
: %s
\n
"
,
fprintf
(
stderr
,
_
(
"%s: could not open archive location
\"
%s
\"
: %s
\n
"
)
,
progname
,
archiveLocation
,
strerror
(
errno
));
progname
,
archiveLocation
,
strerror
(
errno
));
}
}
...
@@ -246,8 +246,8 @@ SetWALFileNameForCleanup(void)
...
@@ -246,8 +246,8 @@ SetWALFileNameForCleanup(void)
if
(
!
fnameOK
)
if
(
!
fnameOK
)
{
{
fprintf
(
stderr
,
"%s: invalid filename input
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"%s: invalid filename input
\n
"
)
,
progname
);
fprintf
(
stderr
,
"Try
\"
%s --help
\"
for more information.
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
)
,
progname
);
exit
(
2
);
exit
(
2
);
}
}
}
}
...
@@ -260,25 +260,25 @@ SetWALFileNameForCleanup(void)
...
@@ -260,25 +260,25 @@ SetWALFileNameForCleanup(void)
static
void
static
void
usage
(
void
)
usage
(
void
)
{
{
printf
(
"%s removes older WAL files from PostgreSQL archives.
\n\n
"
,
progname
);
printf
(
_
(
"%s removes older WAL files from PostgreSQL archives.
\n\n
"
)
,
progname
);
printf
(
"Usage:
\n
"
);
printf
(
_
(
"Usage:
\n
"
)
);
printf
(
" %s [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE
\n
"
,
progname
);
printf
(
_
(
" %s [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE
\n
"
)
,
progname
);
printf
(
"
\n
Options:
\n
"
);
printf
(
_
(
"
\n
Options:
\n
"
)
);
printf
(
" -d generate debug output (verbose mode)
\n
"
);
printf
(
_
(
" -d generate debug output (verbose mode)
\n
"
)
);
printf
(
" -n dry run, show the names of the files that would be removed
\n
"
);
printf
(
_
(
" -n dry run, show the names of the files that would be removed
\n
"
)
);
printf
(
" -V, --version output version information, then exit
\n
"
);
printf
(
_
(
" -V, --version output version information, then exit
\n
"
)
);
printf
(
" -x EXT clean up files if they have this extension
\n
"
);
printf
(
_
(
" -x EXT clean up files if they have this extension
\n
"
)
);
printf
(
" -?, --help show this help, then exit
\n
"
);
printf
(
_
(
" -?, --help show this help, then exit
\n
"
)
);
printf
(
"
\n
"
printf
(
_
(
"
\n
"
"For use as archive_cleanup_command in recovery.conf when standby_mode = on:
\n
"
"For use as archive_cleanup_command in recovery.conf when standby_mode = on:
\n
"
" archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'
\n
"
" archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'
\n
"
"e.g.
\n
"
"e.g.
\n
"
" archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'
\n
"
);
" archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'
\n
"
)
);
printf
(
"
\n
"
printf
(
_
(
"
\n
"
"Or for use as a standalone archive cleaner:
\n
"
"Or for use as a standalone archive cleaner:
\n
"
"e.g.
\n
"
"e.g.
\n
"
" pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup
\n
"
);
" pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup
\n
"
)
);
printf
(
"
\n
Report bugs to <pgsql-bugs@postgresql.org>.
\n
"
);
printf
(
_
(
"
\n
Report bugs to <pgsql-bugs@postgresql.org>.
\n
"
)
);
}
}
/*------------ MAIN ----------------------------------------*/
/*------------ MAIN ----------------------------------------*/
...
@@ -287,6 +287,7 @@ main(int argc, char **argv)
...
@@ -287,6 +287,7 @@ main(int argc, char **argv)
{
{
int
c
;
int
c
;
set_pglocale_pgservice
(
argv
[
0
],
PG_TEXTDOMAIN
(
"pg_archivecleanup"
));
progname
=
get_progname
(
argv
[
0
]);
progname
=
get_progname
(
argv
[
0
]);
if
(
argc
>
1
)
if
(
argc
>
1
)
...
@@ -318,7 +319,7 @@ main(int argc, char **argv)
...
@@ -318,7 +319,7 @@ main(int argc, char **argv)
* from xlogfile names */
* from xlogfile names */
break
;
break
;
default:
default:
fprintf
(
stderr
,
"Try
\"
%s --help
\"
for more information.
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
)
,
progname
);
exit
(
2
);
exit
(
2
);
break
;
break
;
}
}
...
@@ -338,8 +339,8 @@ main(int argc, char **argv)
...
@@ -338,8 +339,8 @@ main(int argc, char **argv)
}
}
else
else
{
{
fprintf
(
stderr
,
"%s: must specify archive location
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"%s: must specify archive location
\n
"
)
,
progname
);
fprintf
(
stderr
,
"Try
\"
%s --help
\"
for more information.
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
)
,
progname
);
exit
(
2
);
exit
(
2
);
}
}
...
@@ -350,15 +351,15 @@ main(int argc, char **argv)
...
@@ -350,15 +351,15 @@ main(int argc, char **argv)
}
}
else
else
{
{
fprintf
(
stderr
,
"%s: must specify restartfilename
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"%s: must specify restartfilename
\n
"
)
,
progname
);
fprintf
(
stderr
,
"Try
\"
%s --help
\"
for more information.
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
)
,
progname
);
exit
(
2
);
exit
(
2
);
}
}
if
(
optind
<
argc
)
if
(
optind
<
argc
)
{
{
fprintf
(
stderr
,
"%s: too many parameters
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"%s: too many parameters
\n
"
)
,
progname
);
fprintf
(
stderr
,
"Try
\"
%s --help
\"
for more information.
\n
"
,
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
)
,
progname
);
exit
(
2
);
exit
(
2
);
}
}
...
@@ -376,7 +377,7 @@ main(int argc, char **argv)
...
@@ -376,7 +377,7 @@ main(int argc, char **argv)
{
{
snprintf
(
WALFilePath
,
MAXPGPATH
,
"%s/%s"
,
snprintf
(
WALFilePath
,
MAXPGPATH
,
"%s/%s"
,
archiveLocation
,
exclusiveCleanupFileName
);
archiveLocation
,
exclusiveCleanupFileName
);
fprintf
(
stderr
,
"%s: keep WAL file
\"
%s
\"
and later
\n
"
,
fprintf
(
stderr
,
_
(
"%s: keep WAL file
\"
%s
\"
and later
\n
"
)
,
progname
,
WALFilePath
);
progname
,
WALFilePath
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment