}
else if ((p = strstr(bufin, "Latest checkpoint's NextXID:")) != NULL)
{
- char *op = strchr(p, '/');
+ p = strchr(p, ':');
+
+ if (p == NULL || strlen(p) <= 1)
+ pg_fatal("%d: controldata retrieval problem\n", __LINE__);
- if (op == NULL)
- op = strchr(p, ':');
+ p++; /* removing ':' char */
+ cluster->controldata.chkpnt_nxtepoch = str2uint(p);
- if (op == NULL || strlen(op) <= 1)
+ p = strchr(p, '/');
+ if (p == NULL || strlen(p) <= 1)
pg_fatal("%d: controldata retrieval problem\n", __LINE__);
- op++; /* removing ':' char */
- cluster->controldata.chkpnt_nxtxid = str2uint(op);
+ p++; /* removing '/' char */
+ cluster->controldata.chkpnt_nxtxid = str2uint(p);
got_xid = true;
}
else if ((p = strstr(bufin, "Latest checkpoint's NextOID:")) != NULL)
/* copy old commit logs to new data dir */
copy_subdir_files("pg_clog");
- /* set the next transaction id of the new cluster */
- prep_status("Setting next transaction ID for new cluster");
+ /* set the next transaction id and epoch of the new cluster */
+ prep_status("Setting next transaction ID and epoch for new cluster");
exec_prog(UTILITY_LOG_FILE, NULL, true,
"\"%s/pg_resetxlog\" -f -x %u \"%s\"",
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtxid,
new_cluster.pgdata);
+ exec_prog(UTILITY_LOG_FILE, NULL, true,
+ "\"%s/pg_resetxlog\" -f -e %u \"%s\"",
+ new_cluster.bindir, old_cluster.controldata.chkpnt_nxtepoch,
+ new_cluster.pgdata);
check_ok();
/*