Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a23a50

Browse files
author
Michael Paquier
committed
Simplify LSN calculation from result of pg_stop_backup
New behavior relies on XLogFromFileName instead of having a custom sscanfdoing exactly the same thing.
1 parentcf6ca26 commit2a23a50

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

‎backup.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,31 +1104,13 @@ pg_switch_xlog(pgBackup *backup)
11041104
staticvoid
11051105
get_lsn(PGresult*res,TimeLineID*timeline,XLogRecPtr*lsn)
11061106
{
1107-
uint32off_upper;
1108-
uint32xlogid;
1109-
uint32xrecoff;
1110-
11111107
if (res==NULL||PQntuples(res)!=1||PQnfields(res)!=2)
11121108
elog(ERROR_PG_COMMAND,
11131109
_("result of pg_xlogfile_name_offset() is invalid: %s"),
11141110
PQerrorMessage(connection));
11151111

1116-
/* get TimeLineID, LSN from result of pg_stop_backup() */
1117-
if (sscanf(PQgetvalue(res,0,0),"%08X%08X%08X",
1118-
timeline,&xlogid,&off_upper)!=3||
1119-
sscanf(PQgetvalue(res,0,1),"%u",&xrecoff)!=1)
1120-
{
1121-
elog(ERROR_PG_COMMAND,
1122-
_("result of pg_xlogfile_name_offset() is invalid: %s"),
1123-
PQerrorMessage(connection));
1124-
}
1125-
1126-
elog(LOG,"%s():%s %s",
1127-
__FUNCTION__,PQgetvalue(res,0,0),PQgetvalue(res,0,1));
1128-
xrecoff+=off_upper <<24;
1129-
1130-
/* Set LSN correctly */
1131-
*lsn= (XLogRecPtr) ((uint64)xlogid <<32) |xrecoff;
1112+
/* Extract timeline and LSN from result of pg_stop_backup() */
1113+
XLogFromFileName(PQgetvalue(res,0,0),timeline,lsn);
11321114
}
11331115

11341116
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp