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

Commita74a4aa

Browse files
committed
pg_upgrade: preserve the timestamp epoch
This is useful for replication tools like Slony and Skytools.Report by Sergey Konoplev
1 parent1f4d107 commita74a4aa

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

‎contrib/pg_upgrade/controldata.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,20 @@ get_control_data(ClusterInfo *cluster, bool live_check)
209209
}
210210
elseif ((p=strstr(bufin,"Latest checkpoint's NextXID:"))!=NULL)
211211
{
212-
char*op=strchr(p,'/');
212+
p=strchr(p,':');
213+
214+
if (p==NULL||strlen(p) <=1)
215+
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
213216

214-
if (op==NULL)
215-
op=strchr(p,':');
217+
p++;/* removing ':' char */
218+
cluster->controldata.chkpnt_nxtepoch=str2uint(p);
216219

217-
if (op==NULL||strlen(op) <=1)
220+
p=strchr(p,'/');
221+
if (p==NULL||strlen(p) <=1)
218222
pg_fatal("%d: controldata retrieval problem\n",__LINE__);
219223

220-
op++;/* removing ':' char */
221-
cluster->controldata.chkpnt_nxtxid=str2uint(op);
224+
p++;/* removing '/' char */
225+
cluster->controldata.chkpnt_nxtxid=str2uint(p);
222226
got_xid= true;
223227
}
224228
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
@@ -420,12 +420,16 @@ copy_clog_xlog_xid(void)
420420
/* copy old commit logs to new data dir */
421421
copy_subdir_files("pg_clog");
422422

423-
/* set the next transaction id of the new cluster */
424-
prep_status("Setting next transaction ID for new cluster");
423+
/* set the next transaction idand epochof the new cluster */
424+
prep_status("Setting next transaction IDand epochfor new cluster");
425425
exec_prog(UTILITY_LOG_FILE,NULL, true,
426426
"\"%s/pg_resetxlog\" -f -x %u \"%s\"",
427427
new_cluster.bindir,old_cluster.controldata.chkpnt_nxtxid,
428428
new_cluster.pgdata);
429+
exec_prog(UTILITY_LOG_FILE,NULL, true,
430+
"\"%s/pg_resetxlog\" -f -e %u \"%s\"",
431+
new_cluster.bindir,old_cluster.controldata.chkpnt_nxtepoch,
432+
new_cluster.pgdata);
429433
check_ok();
430434

431435
/*

‎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;

‎doc/src/sgml/ref/pg_resetxlog.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ PostgreSQL documentation
166166
except in the field that is set by <command>pg_resetxlog</command>,
167167
so any value will work so far as the database itself is concerned.
168168
You might need to adjust this value to ensure that replication
169-
systems such as <application>Slony-I</> work correctly &mdash;
169+
systems such as <application>Slony-I</> and
170+
<application>Skytools</> work correctly &mdash;
170171
if so, an appropriate value should be obtainable from the state of
171172
the downstream replicated database.
172173
</para>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp