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

Commit022aea3

Browse files
committed
pg_upgrade: preserve the timestamp epoch
This is useful for replication tools like Slony and Skytools. This is abackpatch ofa74a4aa.Report by Sergey KonoplevBackpatch through 9.3
1 parentb8b4124 commit022aea3

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

‎contrib/pg_upgrade/controldata.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,20 @@ get_control_data(ClusterInfo *cluster, bool live_check)
233233
}
234234
elseif ((p=strstr(bufin,"Latest checkpoint's NextXID:"))!=NULL)
235235
{
236-
char*op=strchr(p,'/');
236+
p=strchr(p,':');
237+
238+
if (p==NULL||strlen(p) <=1)
239+
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
237240

238-
if (op==NULL)
239-
op=strchr(p,':');
241+
p++;/* removing ':' char */
242+
cluster->controldata.chkpnt_nxtepoch=str2uint(p);
240243

241-
if (op==NULL||strlen(op) <=1)
244+
p=strchr(p,'/');
245+
if (p==NULL||strlen(p) <=1)
242246
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
243247

244-
op++;/* removing ':' char */
245-
cluster->controldata.chkpnt_nxtxid=str2uint(op);
248+
p++;/* removing '/' char */
249+
cluster->controldata.chkpnt_nxtxid=str2uint(p);
246250
got_xid= true;
247251
}
248252
elseif ((p=strstr(bufin,"Latest checkpoint's NextOID:"))!=NULL)

‎contrib/pg_upgrade/pg_upgrade.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,16 @@ copy_clog_xlog_xid(void)
422422
/* copy old commit logs to new data dir */
423423
copy_subdir_files("pg_clog");
424424

425-
/* set the next transaction id of the new cluster */
426-
prep_status("Setting next transaction ID for new cluster");
425+
/* set the next transaction idand epochof the new cluster */
426+
prep_status("Setting next transaction IDand epochfor new cluster");
427427
exec_prog(UTILITY_LOG_FILE,NULL, true,
428428
"\"%s/pg_resetxlog\" -f -x %u \"%s\"",
429429
new_cluster.bindir,old_cluster.controldata.chkpnt_nxtxid,
430430
new_cluster.pgdata);
431+
exec_prog(UTILITY_LOG_FILE,NULL, true,
432+
"\"%s/pg_resetxlog\" -f -e %u \"%s\"",
433+
new_cluster.bindir,old_cluster.controldata.chkpnt_nxtepoch,
434+
new_cluster.pgdata);
431435
check_ok();
432436

433437
/*

‎contrib/pg_upgrade/pg_upgrade.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ typedef struct
190190
charnextxlogfile[25];
191191
uint32chkpnt_tli;
192192
uint32chkpnt_nxtxid;
193+
uint32chkpnt_nxtepoch;
193194
uint32chkpnt_nxtoid;
194195
uint32chkpnt_nxtmulti;
195196
uint32chkpnt_nxtmxoff;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp