@@ -1104,31 +1104,13 @@ pg_switch_xlog(pgBackup *backup)
1104
1104
static void
1105
1105
get_lsn (PGresult * res , TimeLineID * timeline , XLogRecPtr * lsn )
1106
1106
{
1107
- uint32 off_upper ;
1108
- uint32 xlogid ;
1109
- uint32 xrecoff ;
1110
-
1111
1107
if (res == NULL || PQntuples (res ) != 1 || PQnfields (res ) != 2 )
1112
1108
elog (ERROR_PG_COMMAND ,
1113
1109
_ ("result of pg_xlogfile_name_offset() is invalid: %s" ),
1114
1110
PQerrorMessage (connection ));
1115
1111
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 );
1132
1114
}
1133
1115
1134
1116
/*
0 commit comments