}
else
{
- query = "SELECT pg_last_xlog_receive_location()";
+ query = "SELECT pg_last_xlog_replay_location()";
}
sts = do_query(slots[i]->con, query, &res, PROTO_MAJOR_V3);
*/
static long text_to_lsn(char *text)
{
+/*
+ * WAL segment size in bytes. XXX We should fetch this from
+ * PostgreSQL, rather than having fixed value.
+ */
+#define WALSEGMENTSIZE 16 * 1024 * 1024
+
unsigned int xlogid;
unsigned int xrecoff;
unsigned long long int lsn;
pool_error("text_to_lsn: wrong log location format: %s", text);
return 0;
}
- lsn = xlogid * 16 * 1024 * 1024 * 255 + xrecoff;
+ lsn = xlogid * ((unsigned long long int)0xffffffff - WALSEGMENTSIZE) + xrecoff;
+#ifdef DEBUG
+ pool_log("lsn: %X %X %llX", xlogid, xrecoff, lsn);
+#endif
return lsn;
}