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
e98d635d
Commit
e98d635d
authored
Jun 22, 2015
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pg_rewind: Improve message wording
parent
747781f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
56 deletions
+54
-56
src/bin/pg_rewind/copy_fetch.c
src/bin/pg_rewind/copy_fetch.c
+2
-2
src/bin/pg_rewind/file_ops.c
src/bin/pg_rewind/file_ops.c
+4
-4
src/bin/pg_rewind/filemap.c
src/bin/pg_rewind/filemap.c
+2
-2
src/bin/pg_rewind/libpq_fetch.c
src/bin/pg_rewind/libpq_fetch.c
+15
-15
src/bin/pg_rewind/parsexlog.c
src/bin/pg_rewind/parsexlog.c
+2
-2
src/bin/pg_rewind/pg_rewind.c
src/bin/pg_rewind/pg_rewind.c
+21
-23
src/bin/pg_rewind/timeline.c
src/bin/pg_rewind/timeline.c
+8
-8
No files found.
src/bin/pg_rewind/copy_fetch.c
View file @
e98d635d
...
@@ -148,7 +148,7 @@ recurse_dir(const char *datadir, const char *parentpath,
...
@@ -148,7 +148,7 @@ recurse_dir(const char *datadir, const char *parentpath,
fullparentpath
,
strerror
(
errno
));
fullparentpath
,
strerror
(
errno
));
if
(
closedir
(
xldir
))
if
(
closedir
(
xldir
))
pg_fatal
(
"could not close
archive location
\"
%s
\"
: %s
\n
"
,
pg_fatal
(
"could not close
directory
\"
%s
\"
: %s
\n
"
,
fullparentpath
,
strerror
(
errno
));
fullparentpath
,
strerror
(
errno
));
}
}
...
@@ -199,7 +199,7 @@ copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
...
@@ -199,7 +199,7 @@ copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
}
}
if
(
close
(
srcfd
)
!=
0
)
if
(
close
(
srcfd
)
!=
0
)
pg_fatal
(
"
error closing
file
\"
%s
\"
: %s
\n
"
,
srcpath
,
strerror
(
errno
));
pg_fatal
(
"
could not close
file
\"
%s
\"
: %s
\n
"
,
srcpath
,
strerror
(
errno
));
}
}
/*
/*
...
...
src/bin/pg_rewind/file_ops.c
View file @
e98d635d
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#include "pg_rewind.h"
#include "pg_rewind.h"
/*
/*
* Currently open
destination
file.
* Currently open
target
file.
*/
*/
static
int
dstfd
=
-
1
;
static
int
dstfd
=
-
1
;
static
char
dstpath
[
MAXPGPATH
]
=
""
;
static
char
dstpath
[
MAXPGPATH
]
=
""
;
...
@@ -61,7 +61,7 @@ open_target_file(const char *path, bool trunc)
...
@@ -61,7 +61,7 @@ open_target_file(const char *path, bool trunc)
mode
|=
O_TRUNC
;
mode
|=
O_TRUNC
;
dstfd
=
open
(
dstpath
,
mode
,
0600
);
dstfd
=
open
(
dstpath
,
mode
,
0600
);
if
(
dstfd
<
0
)
if
(
dstfd
<
0
)
pg_fatal
(
"could not open
destination
file
\"
%s
\"
: %s
\n
"
,
pg_fatal
(
"could not open
target
file
\"
%s
\"
: %s
\n
"
,
dstpath
,
strerror
(
errno
));
dstpath
,
strerror
(
errno
));
}
}
...
@@ -75,7 +75,7 @@ close_target_file(void)
...
@@ -75,7 +75,7 @@ close_target_file(void)
return
;
return
;
if
(
close
(
dstfd
)
!=
0
)
if
(
close
(
dstfd
)
!=
0
)
pg_fatal
(
"
error closing destination
file
\"
%s
\"
: %s
\n
"
,
pg_fatal
(
"
could not close target
file
\"
%s
\"
: %s
\n
"
,
dstpath
,
strerror
(
errno
));
dstpath
,
strerror
(
errno
));
dstfd
=
-
1
;
dstfd
=
-
1
;
...
@@ -96,7 +96,7 @@ write_target_range(char *buf, off_t begin, size_t size)
...
@@ -96,7 +96,7 @@ write_target_range(char *buf, off_t begin, size_t size)
return
;
return
;
if
(
lseek
(
dstfd
,
begin
,
SEEK_SET
)
==
-
1
)
if
(
lseek
(
dstfd
,
begin
,
SEEK_SET
)
==
-
1
)
pg_fatal
(
"could not seek in
destination
file
\"
%s
\"
: %s
\n
"
,
pg_fatal
(
"could not seek in
target
file
\"
%s
\"
: %s
\n
"
,
dstpath
,
strerror
(
errno
));
dstpath
,
strerror
(
errno
));
writeleft
=
size
;
writeleft
=
size
;
...
...
src/bin/pg_rewind/filemap.c
View file @
e98d635d
...
@@ -93,7 +93,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
...
@@ -93,7 +93,7 @@ process_source_file(const char *path, file_type_t type, size_t newsize,
* regular file
* regular file
*/
*/
if
(
type
!=
FILE_TYPE_REGULAR
&&
isRelDataFile
(
path
))
if
(
type
!=
FILE_TYPE_REGULAR
&&
isRelDataFile
(
path
))
pg_fatal
(
"data file
in source
\"
%s
\"
is not a regular file
\n
"
,
path
);
pg_fatal
(
"data file
\"
%s
\"
in source
is not a regular file
\n
"
,
path
);
snprintf
(
localpath
,
sizeof
(
localpath
),
"%s/%s"
,
datadir_target
,
path
);
snprintf
(
localpath
,
sizeof
(
localpath
),
"%s/%s"
,
datadir_target
,
path
);
...
@@ -256,7 +256,7 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
...
@@ -256,7 +256,7 @@ process_target_file(const char *path, file_type_t type, size_t oldsize,
if
(
lstat
(
localpath
,
&
statbuf
)
<
0
)
if
(
lstat
(
localpath
,
&
statbuf
)
<
0
)
{
{
if
(
errno
!=
ENOENT
)
if
(
errno
!=
ENOENT
)
pg_fatal
(
"could not stat file
\"
%s
\"
: %s"
,
pg_fatal
(
"could not stat file
\"
%s
\"
: %s
\n
"
,
localpath
,
strerror
(
errno
));
localpath
,
strerror
(
errno
));
exists
=
false
;
exists
=
false
;
...
...
src/bin/pg_rewind/libpq_fetch.c
View file @
e98d635d
...
@@ -52,10 +52,10 @@ libpqConnect(const char *connstr)
...
@@ -52,10 +52,10 @@ libpqConnect(const char *connstr)
conn
=
PQconnectdb
(
connstr
);
conn
=
PQconnectdb
(
connstr
);
if
(
PQstatus
(
conn
)
==
CONNECTION_BAD
)
if
(
PQstatus
(
conn
)
==
CONNECTION_BAD
)
pg_fatal
(
"could not connect to
remote server: %s
\n
"
,
pg_fatal
(
"could not connect to
server: %s
"
,
PQerrorMessage
(
conn
));
PQerrorMessage
(
conn
));
pg_log
(
PG_PROGRESS
,
"connected to
remote
server
\n
"
);
pg_log
(
PG_PROGRESS
,
"connected to server
\n
"
);
/*
/*
* Check that the server is not in hot standby mode. There is no
* Check that the server is not in hot standby mode. There is no
...
@@ -91,12 +91,12 @@ run_simple_query(const char *sql)
...
@@ -91,12 +91,12 @@ run_simple_query(const char *sql)
res
=
PQexec
(
conn
,
sql
);
res
=
PQexec
(
conn
,
sql
);
if
(
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
)
if
(
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
)
pg_fatal
(
"error running query (%s) in source server: %s
\n
"
,
pg_fatal
(
"error running query (%s) in source server: %s"
,
sql
,
PQresultErrorMessage
(
res
));
sql
,
PQresultErrorMessage
(
res
));
/* sanity check the result set */
/* sanity check the result set */
if
(
PQnfields
(
res
)
!=
1
||
PQntuples
(
res
)
!=
1
||
PQgetisnull
(
res
,
0
,
0
))
if
(
PQnfields
(
res
)
!=
1
||
PQntuples
(
res
)
!=
1
||
PQgetisnull
(
res
,
0
,
0
))
pg_fatal
(
"unexpected result set
while running
query
\n
"
);
pg_fatal
(
"unexpected result set
from
query
\n
"
);
result
=
pg_strdup
(
PQgetvalue
(
res
,
0
,
0
));
result
=
pg_strdup
(
PQgetvalue
(
res
,
0
,
0
));
...
@@ -119,7 +119,7 @@ libpqGetCurrentXlogInsertLocation(void)
...
@@ -119,7 +119,7 @@ libpqGetCurrentXlogInsertLocation(void)
val
=
run_simple_query
(
"SELECT pg_current_xlog_insert_location()"
);
val
=
run_simple_query
(
"SELECT pg_current_xlog_insert_location()"
);
if
(
sscanf
(
val
,
"%X/%X"
,
&
hi
,
&
lo
)
!=
2
)
if
(
sscanf
(
val
,
"%X/%X"
,
&
hi
,
&
lo
)
!=
2
)
pg_fatal
(
"un
expected result
\"
%s
\"
while fetching
current XLOG insert location
\n
"
,
val
);
pg_fatal
(
"un
recognized result
\"
%s
\"
for
current XLOG insert location
\n
"
,
val
);
result
=
((
uint64
)
hi
)
<<
32
|
lo
;
result
=
((
uint64
)
hi
)
<<
32
|
lo
;
...
@@ -167,7 +167,7 @@ libpqProcessFileList(void)
...
@@ -167,7 +167,7 @@ libpqProcessFileList(void)
res
=
PQexec
(
conn
,
sql
);
res
=
PQexec
(
conn
,
sql
);
if
(
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
)
if
(
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
)
pg_fatal
(
"
unexpected result while fetching file list: %s
\n
"
,
pg_fatal
(
"
could not fetch file list: %s
"
,
PQresultErrorMessage
(
res
));
PQresultErrorMessage
(
res
));
/* sanity check the result set */
/* sanity check the result set */
...
@@ -210,7 +210,7 @@ receiveFileChunks(const char *sql)
...
@@ -210,7 +210,7 @@ receiveFileChunks(const char *sql)
PGresult
*
res
;
PGresult
*
res
;
if
(
PQsendQueryParams
(
conn
,
sql
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
1
)
!=
1
)
if
(
PQsendQueryParams
(
conn
,
sql
,
0
,
NULL
,
NULL
,
NULL
,
NULL
,
1
)
!=
1
)
pg_fatal
(
"could not send query: %s
\n
"
,
PQerrorMessage
(
conn
));
pg_fatal
(
"could not send query: %s"
,
PQerrorMessage
(
conn
));
pg_log
(
PG_DEBUG
,
"getting file chunks"
);
pg_log
(
PG_DEBUG
,
"getting file chunks"
);
...
@@ -262,7 +262,7 @@ receiveFileChunks(const char *sql)
...
@@ -262,7 +262,7 @@ receiveFileChunks(const char *sql)
PQgetisnull
(
res
,
0
,
1
)
||
PQgetisnull
(
res
,
0
,
1
)
||
PQgetisnull
(
res
,
0
,
2
))
PQgetisnull
(
res
,
0
,
2
))
{
{
pg_fatal
(
"unexpected
NULL
result while fetching remote files
\n
"
);
pg_fatal
(
"unexpected
null values in
result while fetching remote files
\n
"
);
}
}
if
(
PQgetlength
(
res
,
0
,
1
)
!=
sizeof
(
int32
))
if
(
PQgetlength
(
res
,
0
,
1
)
!=
sizeof
(
int32
))
...
@@ -280,7 +280,7 @@ receiveFileChunks(const char *sql)
...
@@ -280,7 +280,7 @@ receiveFileChunks(const char *sql)
chunk
=
PQgetvalue
(
res
,
0
,
2
);
chunk
=
PQgetvalue
(
res
,
0
,
2
);
pg_log
(
PG_DEBUG
,
"received chunk for file
\"
%s
\"
, off
%d, len
%d
\n
"
,
pg_log
(
PG_DEBUG
,
"received chunk for file
\"
%s
\"
, off
set %d, size
%d
\n
"
,
filename
,
chunkoff
,
chunksize
);
filename
,
chunkoff
,
chunksize
);
open_target_file
(
filename
,
false
);
open_target_file
(
filename
,
false
);
...
@@ -309,7 +309,7 @@ libpqGetFile(const char *filename, size_t *filesize)
...
@@ -309,7 +309,7 @@ libpqGetFile(const char *filename, size_t *filesize)
1
,
NULL
,
paramValues
,
NULL
,
NULL
,
1
);
1
,
NULL
,
paramValues
,
NULL
,
NULL
,
1
);
if
(
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
)
if
(
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
)
pg_fatal
(
"
unexpected result while fetching remote file
\"
%s
\"
: %s
\n
"
,
pg_fatal
(
"
could not fetch remote file
\"
%s
\"
: %s
"
,
filename
,
PQresultErrorMessage
(
res
));
filename
,
PQresultErrorMessage
(
res
));
/* sanity check the result set */
/* sanity check the result set */
...
@@ -355,7 +355,7 @@ fetch_file_range(const char *path, unsigned int begin, unsigned int end)
...
@@ -355,7 +355,7 @@ fetch_file_range(const char *path, unsigned int begin, unsigned int end)
snprintf
(
linebuf
,
sizeof
(
linebuf
),
"%s
\t
%u
\t
%u
\n
"
,
path
,
begin
,
len
);
snprintf
(
linebuf
,
sizeof
(
linebuf
),
"%s
\t
%u
\t
%u
\n
"
,
path
,
begin
,
len
);
if
(
PQputCopyData
(
conn
,
linebuf
,
strlen
(
linebuf
))
!=
1
)
if
(
PQputCopyData
(
conn
,
linebuf
,
strlen
(
linebuf
))
!=
1
)
pg_fatal
(
"
error sending COPY data: %s
\n
"
,
pg_fatal
(
"
could not send COPY data: %s
"
,
PQerrorMessage
(
conn
));
PQerrorMessage
(
conn
));
begin
+=
len
;
begin
+=
len
;
...
@@ -381,14 +381,14 @@ libpq_executeFileMap(filemap_t *map)
...
@@ -381,14 +381,14 @@ libpq_executeFileMap(filemap_t *map)
res
=
PQexec
(
conn
,
sql
);
res
=
PQexec
(
conn
,
sql
);
if
(
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
if
(
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
pg_fatal
(
"
error creating temporary table: %s
\n
"
,
pg_fatal
(
"
could not create temporary table: %s
"
,
PQresultErrorMessage
(
res
));
PQresultErrorMessage
(
res
));
sql
=
"COPY fetchchunks FROM STDIN"
;
sql
=
"COPY fetchchunks FROM STDIN"
;
res
=
PQexec
(
conn
,
sql
);
res
=
PQexec
(
conn
,
sql
);
if
(
PQresultStatus
(
res
)
!=
PGRES_COPY_IN
)
if
(
PQresultStatus
(
res
)
!=
PGRES_COPY_IN
)
pg_fatal
(
"
unexpected result while sending file list: %s
\n
"
,
pg_fatal
(
"
could not send file list: %s
"
,
PQresultErrorMessage
(
res
));
PQresultErrorMessage
(
res
));
for
(
i
=
0
;
i
<
map
->
narray
;
i
++
)
for
(
i
=
0
;
i
<
map
->
narray
;
i
++
)
...
@@ -429,13 +429,13 @@ libpq_executeFileMap(filemap_t *map)
...
@@ -429,13 +429,13 @@ libpq_executeFileMap(filemap_t *map)
}
}
if
(
PQputCopyEnd
(
conn
,
NULL
)
!=
1
)
if
(
PQputCopyEnd
(
conn
,
NULL
)
!=
1
)
pg_fatal
(
"
error sending end-of-COPY: %s
\n
"
,
pg_fatal
(
"
could not send end-of-COPY: %s
"
,
PQerrorMessage
(
conn
));
PQerrorMessage
(
conn
));
while
((
res
=
PQgetResult
(
conn
))
!=
NULL
)
while
((
res
=
PQgetResult
(
conn
))
!=
NULL
)
{
{
if
(
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
if
(
PQresultStatus
(
res
)
!=
PGRES_COMMAND_OK
)
pg_fatal
(
"unexpected result while sending file list: %s
\n
"
,
pg_fatal
(
"unexpected result while sending file list: %s"
,
PQresultErrorMessage
(
res
));
PQresultErrorMessage
(
res
));
}
}
...
...
src/bin/pg_rewind/parsexlog.c
View file @
e98d635d
...
@@ -84,11 +84,11 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, TimeLineID tli,
...
@@ -84,11 +84,11 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, TimeLineID tli,
errptr
=
startpoint
?
startpoint
:
xlogreader
->
EndRecPtr
;
errptr
=
startpoint
?
startpoint
:
xlogreader
->
EndRecPtr
;
if
(
errormsg
)
if
(
errormsg
)
pg_fatal
(
"
error reading WAL
at %X/%X: %s
\n
"
,
pg_fatal
(
"
could not read WAL record
at %X/%X: %s
\n
"
,
(
uint32
)
(
errptr
>>
32
),
(
uint32
)
(
errptr
),
(
uint32
)
(
errptr
>>
32
),
(
uint32
)
(
errptr
),
errormsg
);
errormsg
);
else
else
pg_fatal
(
"
error reading WAL
at %X/%X
\n
"
,
pg_fatal
(
"
could not read WAL record
at %X/%X
\n
"
,
(
uint32
)
(
startpoint
>>
32
),
(
uint32
)
(
startpoint
>>
32
),
(
uint32
)
(
startpoint
));
(
uint32
)
(
startpoint
));
}
}
...
...
src/bin/pg_rewind/pg_rewind.c
View file @
e98d635d
...
@@ -56,22 +56,18 @@ bool dry_run = false;
...
@@ -56,22 +56,18 @@ bool dry_run = false;
static
void
static
void
usage
(
const
char
*
progname
)
usage
(
const
char
*
progname
)
{
{
printf
(
_
(
"%s resynchronizes a cluster with another copy of the cluster.
\n\n
"
),
progname
);
printf
(
_
(
"%s resynchronizes a
PostgreSQL
cluster with another copy of the cluster.
\n\n
"
),
progname
);
printf
(
_
(
"Usage:
\n
%s [OPTION]...
\n\n
"
),
progname
);
printf
(
_
(
"Usage:
\n
%s [OPTION]...
\n\n
"
),
progname
);
printf
(
_
(
"Options:
\n
"
));
printf
(
_
(
"Options:
\n
"
));
printf
(
_
(
" -D, --target-pgdata=DIRECTORY
\n
"
));
printf
(
_
(
" -D, --target-pgdata=DIRECTORY existing data directory to modify
\n
"
));
printf
(
_
(
" existing data directory to modify
\n
"
));
printf
(
_
(
" --source-pgdata=DIRECTORY source data directory to sync with
\n
"
));
printf
(
_
(
" --source-pgdata=DIRECTORY
\n
"
));
printf
(
_
(
" --source-server=CONNSTR source server to sync with
\n
"
));
printf
(
_
(
" source data directory to sync with
\n
"
));
printf
(
_
(
" -n, --dry-run stop before modifying anything
\n
"
));
printf
(
_
(
" --source-server=CONNSTR
\n
"
));
printf
(
_
(
" -P, --progress write progress messages
\n
"
));
printf
(
_
(
" source server to sync with
\n
"
));
printf
(
_
(
" --debug write a lot of debug messages
\n
"
));
printf
(
_
(
" -P, --progress write progress messages
\n
"
));
printf
(
_
(
" -V, --version output version information, then exit
\n
"
));
printf
(
_
(
" -n, --dry-run stop before modifying anything
\n
"
));
printf
(
_
(
" -?, --help show this help, then exit
\n
"
));
printf
(
_
(
" --debug write a lot of debug messages
\n
"
));
printf
(
_
(
"
\n
Report bugs to <pgsql-bugs@postgresql.org>.
\n
"
));
printf
(
_
(
" -V, --version output version information, then exit
\n
"
));
printf
(
_
(
" -?, --help show this help, then exit
\n
"
));
printf
(
_
(
"
\n
"
));
printf
(
_
(
"Report bugs to <pgsql-bugs@postgresql.org>.
\n
"
));
}
}
...
@@ -154,24 +150,24 @@ main(int argc, char **argv)
...
@@ -154,24 +150,24 @@ main(int argc, char **argv)
}
}
}
}
/* No source given? Show usage */
if
(
datadir_source
==
NULL
&&
connstr_source
==
NULL
)
if
(
datadir_source
==
NULL
&&
connstr_source
==
NULL
)
{
{
fprintf
(
stderr
,
_
(
"
no source specified (--source-pgdata or --source-server)
\n
"
)
);
fprintf
(
stderr
,
_
(
"
%s: no source specified (--source-pgdata or --source-server)
\n
"
),
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
exit
(
1
);
exit
(
1
);
}
}
if
(
datadir_target
==
NULL
)
if
(
datadir_target
==
NULL
)
{
{
fprintf
(
stderr
,
_
(
"
no target data directory specified (--target-pgdata)
\n
"
)
);
fprintf
(
stderr
,
_
(
"
%s: no target data directory specified (--target-pgdata)
\n
"
),
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
exit
(
1
);
exit
(
1
);
}
}
if
(
argc
!=
optind
)
if
(
optind
<
argc
)
{
{
fprintf
(
stderr
,
_
(
"invalid arguments
\n
"
));
fprintf
(
stderr
,
_
(
"%s: too many command-line arguments (first is
\"
%s
\"
)
\n
"
),
progname
,
argv
[
optind
]);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
fprintf
(
stderr
,
_
(
"Try
\"
%s --help
\"
for more information.
\n
"
),
progname
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -184,9 +180,11 @@ main(int argc, char **argv)
...
@@ -184,9 +180,11 @@ main(int argc, char **argv)
*/
*/
#ifndef WIN32
#ifndef WIN32
if
(
geteuid
()
==
0
)
if
(
geteuid
()
==
0
)
pg_fatal
(
"cannot be executed by
\"
root
\"\n
"
{
"You must run %s as the PostgreSQL superuser.
\n
"
,
fprintf
(
stderr
,
_
(
"cannot be executed by
\"
root
\"\n
"
));
progname
);
fprintf
(
stderr
,
_
(
"You must run %s as the PostgreSQL superuser.
\n
"
),
progname
);
}
#endif
#endif
get_restricted_token
(
progname
);
get_restricted_token
(
progname
);
...
@@ -295,7 +293,7 @@ main(int argc, char **argv)
...
@@ -295,7 +293,7 @@ main(int argc, char **argv)
*/
*/
if
(
showprogress
)
if
(
showprogress
)
{
{
pg_log
(
PG_PROGRESS
,
"
N
eed to copy %lu MB (total source directory size is %lu MB)
\n
"
,
pg_log
(
PG_PROGRESS
,
"
n
eed to copy %lu MB (total source directory size is %lu MB)
\n
"
,
(
unsigned
long
)
(
filemap
->
fetch_size
/
(
1024
*
1024
)),
(
unsigned
long
)
(
filemap
->
fetch_size
/
(
1024
*
1024
)),
(
unsigned
long
)
(
filemap
->
total_size
/
(
1024
*
1024
)));
(
unsigned
long
)
(
filemap
->
total_size
/
(
1024
*
1024
)));
...
...
src/bin/pg_rewind/timeline.c
View file @
e98d635d
...
@@ -73,20 +73,20 @@ rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
...
@@ -73,20 +73,20 @@ rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
if
(
nfields
<
1
)
if
(
nfields
<
1
)
{
{
/* expect a numeric timeline ID as first field of line */
/* expect a numeric timeline ID as first field of line */
printf
(
_
(
"syntax error in history file: %s
\n
"
),
fline
);
fprintf
(
stderr
,
_
(
"syntax error in history file: %s
\n
"
),
fline
);
printf
(
_
(
"Expected a numeric timeline ID.
\n
"
));
fprintf
(
stderr
,
_
(
"Expected a numeric timeline ID.
\n
"
));
exit
(
1
);
exit
(
1
);
}
}
if
(
nfields
!=
3
)
if
(
nfields
!=
3
)
{
{
printf
(
_
(
"syntax error in history file: %s
\n
"
),
fline
);
fprintf
(
stderr
,
_
(
"syntax error in history file: %s
\n
"
),
fline
);
printf
(
_
(
"Expected an XLOG switchpoint location.
\n
"
));
fprintf
(
stderr
,
_
(
"Expected an XLOG switchpoint location.
\n
"
));
exit
(
1
);
exit
(
1
);
}
}
if
(
entries
&&
tli
<=
lasttli
)
if
(
entries
&&
tli
<=
lasttli
)
{
{
printf
(
_
(
"invalid data in history file: %s
\n
"
),
fline
);
fprintf
(
stderr
,
_
(
"invalid data in history file: %s
\n
"
),
fline
);
printf
(
_
(
"Timeline IDs must be in increasing sequence.
\n
"
));
fprintf
(
stderr
,
_
(
"Timeline IDs must be in increasing sequence.
\n
"
));
exit
(
1
);
exit
(
1
);
}
}
...
@@ -106,8 +106,8 @@ rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
...
@@ -106,8 +106,8 @@ rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
if
(
entries
&&
targetTLI
<=
lasttli
)
if
(
entries
&&
targetTLI
<=
lasttli
)
{
{
printf
(
_
(
"invalid data in history file
\n
"
));
fprintf
(
stderr
,
_
(
"invalid data in history file
\n
"
));
printf
(
_
(
"Timeline IDs must be less than child timeline's ID.
\n
"
));
fprintf
(
stderr
,
_
(
"Timeline IDs must be less than child timeline's ID.
\n
"
));
exit
(
1
);
exit
(
1
);
}
}
...
...
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