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

Commitb9e2150

Browse files
author
Vladimir Ershov
committed
Merge remote-tracking branch 'origin/PGPROEE9_6' into PGPROEE9_6_scheduler
2 parents963efe8 +89e1be6 commitb9e2150

File tree

8 files changed

+283
-20
lines changed

8 files changed

+283
-20
lines changed

‎doc/src/sgml/ref/pg_xlogdump.sgml

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ doc/src/sgml/ref/pg_xlogdump.sgml
2323
<cmdsynopsis>
2424
<command>pg_xlogdump</command>
2525
<arg rep="repeat" choice="opt"><option>option</option></arg>
26+
<arg rep="repeat" choice="opt"><option>timestamp-option</option></arg>
2627
<arg choice="opt"><option>startseg</option>
2728
<arg choice="opt"><option>endseg</option></arg>
2829
</arg>
@@ -32,8 +33,8 @@ doc/src/sgml/ref/pg_xlogdump.sgml
3233
<refsect1 id="R1-APP-PGXLOGDUMP-1">
3334
<title>Description</title>
3435
<para>
35-
<command>pg_xlogdump</command> displays the write-ahead log (WAL) andis mainly
36-
useful for debugging or educational purposes.
36+
<command>pg_xlogdump</command> displays the write-ahead log (WAL) andprints timestamps for WAL records.
37+
This utility is mainlyuseful for debugging or educational purposes.
3738
</para>
3839

3940
<para>
@@ -55,7 +56,7 @@ doc/src/sgml/ref/pg_xlogdump.sgml
5556
<term><replaceable class="parameter">startseg</replaceable></term>
5657
<listitem>
5758
<para>
58-
Start reading at the specified log segment file.This implicitly determines
59+
Start reading at the specified log segment file. This implicitly determines
5960
the path in which files will be searched for, and the timeline to use.
6061
</para>
6162
</listitem>
@@ -117,9 +118,9 @@ doc/src/sgml/ref/pg_xlogdump.sgml
117118
<term><option>--path=<replaceable>path</replaceable></option></term>
118119
<listitem>
119120
<para>
120-
Specifies a directory to search for log segment files or a
121+
Specify a directory to search for log segment files or a
121122
directory with a <literal>pg_xlog</literal> subdirectory that
122-
contains such files.The default is to search in the current
123+
contains such files. The default is to search in the current
123124
directory, the <literal>pg_xlog</literal> subdirectory of the
124125
current directory, and the <literal>pg_xlog</literal> subdirectory
125126
of <envar>PGDATA</envar>.
@@ -132,9 +133,9 @@ doc/src/sgml/ref/pg_xlogdump.sgml
132133
<term><option>--rmgr=<replaceable>rmgr</replaceable></option></term>
133134
<listitem>
134135
<para>
135-
Only display records generated by the specified resource manager.
136-
If <literal>list</>is passedasname, print a list of valid resource manager
137-
names, andexit.
136+
Only display records generated by the specified<literal>rmgr</literal>resource manager.
137+
Ifyou pass<literal>list</> asan argument, <application>pg_xlogdump</application> prints a list of valid resource manager
138+
names andexits.
138139
</para>
139140
</listitem>
140141
</varlistentry>
@@ -206,12 +207,71 @@ doc/src/sgml/ref/pg_xlogdump.sgml
206207
</varlistentry>
207208
</variablelist>
208209
</para>
210+
211+
<para>
212+
The following command-line options enable printing timestamps for various types of WAL records. You can use these options together with
213+
<replaceable class="parameter">startseg</replaceable>, <replaceable class="parameter">endseg</replaceable>, <option>-s</option>, and <option>-e</option> options.
214+
<variablelist>
215+
216+
<varlistentry>
217+
<term><option>-E</option></term>
218+
<listitem>
219+
<para>
220+
Print the timestamp of the last WAL record of the specified type found in the log segment file. When using this option, you must also specify the <option>-S</option> option.</para>
221+
<para>By default, <application>pg_xlogdump</application> prints timestamps only for COMMIT records. You can specify other record types using the <option>-F</option> option.
222+
</para>
223+
</listitem>
224+
</varlistentry>
225+
226+
<varlistentry>
227+
<term><option>-F</option> [<replaceable>argument1</replaceable>,<replaceable>argument2</replaceable>,...]</term>
228+
<listitem>
229+
<para>
230+
Specify WAL record types for which to print timestamps. When using this option, you must also specify the <option>-S</option> option.</para>
231+
<para>The <option>-F</option> option can take the following arguments, in the comma-separated format:</para>
232+
<itemizedlist>
233+
<listitem>
234+
<para><option>XLOG_RESTORE_POINT</option> &mdash; named restore points created with the <link linkend="functions-admin-backup">pg_create_restore_point()</link> function.</para>
235+
</listitem>
236+
<listitem>
237+
<para><option>XLOG_XACT_COMMIT</option> &mdash; commit records for transactions. These records are caused by the <xref linkend="sql-commit"> command.</para>
238+
</listitem>
239+
<listitem>
240+
<para><option>XLOG_XACT_COMMIT_PREPARED</option> &mdash; commit records for transactions that were earlier prepared for a two-phase commit. These records are caused by the <xref linkend="sql-commit-prepared"> command.</para>
241+
</listitem>
242+
<listitem>
243+
<para><option>XLOG_XACT_ABORT</option> &mdash; abort records for transactions. These records are caused by the <xref linkend="sql-rollback"> command.</para>
244+
</listitem>
245+
<listitem>
246+
<para><option>XLOG_XACT_ABORT_PREPARED</option> &mdash; abort records for transactions that were earlier prepared for a two-phase commit. These records are caused by the <xref linkend="sql-rollback-prepared"> command.</para>
247+
</listitem>
248+
</itemizedlist>
249+
<para>By default, <application>pg_xlogdump</application> prints timestamps only for COMMIT records.
250+
</para>
251+
</listitem>
252+
</varlistentry>
253+
254+
<varlistentry>
255+
<term><option>-S</option></term>
256+
<listitem>
257+
<para>
258+
Print the timestamp of the first WAL record of the specified type found in the log segment file. This option is required if you are going to use <option>-E</option> or <option>-F</option> options.</para>
259+
<para>By default, <application>pg_xlogdump</application> prints timestamps only for COMMIT records. You can specify other record types using the <option>-F</option> option.
260+
</para>
261+
</listitem>
262+
</varlistentry>
263+
264+
265+
</variablelist>
266+
</para>
267+
268+
209269
</refsect1>
210270

211271
<refsect1>
212272
<title>Notes</title>
213273
<para>
214-
Can give wrong results when the server is running.
274+
<application>pg_xlogdump</> can give wrong results when the server is running.
215275
</para>
216276

217277
<para>
@@ -221,8 +281,8 @@ doc/src/sgml/ref/pg_xlogdump.sgml
221281

222282
<para>
223283
<application>pg_xlogdump</> cannot read WAL files with suffix
224-
<literal>.partial</>. Ifthose files need to be read, <literal>.partial</>
225-
suffix needs to be removedfrom thefile name.
284+
<literal>.partial</>. Ifsuch files need to be read, <literal>.partial</>
285+
remove the suffixfrom thefilename.
226286
</para>
227287
</refsect1>
228288

‎src/backend/access/transam/xlog.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ intCommitDelay = 0;/* precommit delay in microseconds */
103103
intCommitSiblings=5;/* # concurrent xacts needed to sleep */
104104
intwal_retrieve_retry_interval=5000;
105105

106+
TransactionIdstart_xid=0;
107+
MultiXactIdstart_mx_id=0;
108+
MultiXactOffsetstart_mx_offset=0;
109+
106110
#ifdefWAL_DEBUG
107111
boolXLOG_DEBUG= false;
108112
#endif
@@ -4832,14 +4836,13 @@ BootStrapXLOG(void)
48324836
checkPoint.ThisTimeLineID=ThisTimeLineID;
48334837
checkPoint.PrevTimeLineID=ThisTimeLineID;
48344838
checkPoint.fullPageWrites=fullPageWrites;
4835-
checkPoint.nextXid=FirstNormalTransactionId+1;
4839+
checkPoint.nextXid=Max(FirstNormalTransactionId+1,start_xid);
48364840
checkPoint.nextOid=FirstBootstrapObjectId;
4837-
checkPoint.nextMulti=FirstMultiXactId;
4838-
checkPoint.nextMultiOffset=0;
4839-
checkPoint.nextMulti++;
4841+
checkPoint.nextMulti=Max(FirstMultiXactId+1,start_mx_id);
4842+
checkPoint.nextMultiOffset=start_mx_offset;
48404843
checkPoint.oldestXid=checkPoint.nextXid-1;
48414844
checkPoint.oldestXidDB=TemplateDbOid;
4842-
checkPoint.oldestMulti=FirstMultiXactId;
4845+
checkPoint.oldestMulti=checkPoint.nextMulti-1;
48434846
checkPoint.oldestMultiDB=TemplateDbOid;
48444847
checkPoint.oldestCommitTsXid=InvalidTransactionId;
48454848
checkPoint.newestCommitTsXid=InvalidTransactionId;

‎src/backend/bootstrap/bootstrap.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ AuxiliaryProcessMain(int argc, char *argv[])
219219
/* If no -x argument, we are a CheckerProcess */
220220
MyAuxProcType=CheckerProcess;
221221

222-
while ((flag=getopt(argc,argv,"B:c:d:D:Fkr:x:-:"))!=-1)
222+
start_xid=start_mx_id=start_mx_offset=0;
223+
while ((flag=getopt(argc,argv,"B:c:d:D:Fkm:o:r:X:x:-:"))!=-1)
223224
{
224225
switch (flag)
225226
{
@@ -248,9 +249,30 @@ AuxiliaryProcessMain(int argc, char *argv[])
248249
case'k':
249250
bootstrap_data_checksum_version=PG_DATA_CHECKSUM_VERSION;
250251
break;
252+
case'm':
253+
if (sscanf(optarg,HEX_XID_FMT,&start_mx_id)!=1)
254+
{
255+
fprintf(stderr,"%s: invalid hex value of multixact-id\n",progname);
256+
exit(1);
257+
}
258+
break;
259+
case'o':
260+
if (sscanf(optarg,XID_FMT,&start_mx_offset)!=1)
261+
{
262+
fprintf(stderr,"%s: invalid decimal value of multixact-offset\n",progname);
263+
exit(1);
264+
}
265+
break;
251266
case'r':
252267
strlcpy(OutputFileName,optarg,MAXPGPATH);
253268
break;
269+
case'X':
270+
if (sscanf(optarg,HEX_XID_FMT,&start_xid)!=1)
271+
{
272+
fprintf(stderr,"%s: invalid hex value of xid\n",progname);
273+
exit(1);
274+
}
275+
break;
254276
case'x':
255277
MyAuxProcType=atoi(optarg);
256278
break;

‎src/bin/initdb/initdb.c

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ static bool sync_only = false;
144144
staticboolshow_setting= false;
145145
staticbooldata_checksums= false;
146146
staticchar*xlog_dir="";
147+
staticTransactionIdstart_xid=0;
148+
staticMultiXactIdstart_mx_id=0;
149+
staticMultiXactOffsetstart_mx_offset=0;
147150

148151

149152
/* internal vars */
@@ -1535,9 +1538,12 @@ bootstrap_template1(void)
15351538
unsetenv("PGCLIENTENCODING");
15361539

15371540
snprintf(cmd,sizeof(cmd),
1538-
"\"%s\" --boot -x1 %s %s %s",
1541+
"\"%s\" --boot -x1 %s %s"HEX_XID_FMT" %s "HEX_XID_FMT" %s "XID_FMT" %s%s",
15391542
backend_exec,
15401543
data_checksums ?"-k" :"",
1544+
"-X",start_xid,
1545+
"-m",start_mx_id,
1546+
"-o",start_mx_offset,
15411547
boot_options,talkargs);
15421548

15431549
PG_CMD_OPEN;
@@ -2683,16 +2689,24 @@ usage(const char *progname)
26832689
printf(_(" --no-locale equivalent to --locale=C\n"));
26842690
printf(_(" --pwfile=FILE read password for the new superuser from file\n"));
26852691
printf(_(" -T, --text-search-config=CFG\n"
2686-
" default text search configuration\n"));
2692+
" default text search configuration\n"));
26872693
printf(_(" -U, --username=NAME database superuser name\n"));
26882694
printf(_(" -W, --pwprompt prompt for a password for the new superuser\n"));
26892695
printf(_(" -X, --xlogdir=XLOGDIR location for the transaction log directory\n"));
2696+
printf(_(" -x, --xid=START_XID specify start xid value in hex format for new db instance to test 64-bit xids,\n"
2697+
" default value is 0\n"));
26902698
printf(_("\nLess commonly used options:\n"));
26912699
printf(_(" -d, --debug generate lots of debugging output\n"));
26922700
printf(_(" -k, --data-checksums use data page checksums\n"));
26932701
printf(_(" -L DIRECTORY where to find the input files\n"));
2702+
printf(_(" -m, --multixact-id=START_MX_ID\n"
2703+
" specify start multixact id value in hex format for new db instance\n"
2704+
" to test 64-bit xids, default value is 0\n"));
26942705
printf(_(" -n, --noclean do not clean up after errors\n"));
26952706
printf(_(" -N, --nosync do not wait for changes to be written safely to disk\n"));
2707+
printf(_(" -o, --multixact-offset=START_MX_OFFSET\n"
2708+
" specify start multixact offset value in decimal format for new db instance\n"
2709+
" to test 64-bit xids, default value is 0\n"));
26962710
printf(_(" -s, --show show internal settings\n"));
26972711
printf(_(" -S, --sync-only only sync data directory\n"));
26982712
printf(_("\nOther options:\n"));
@@ -3371,6 +3385,9 @@ main(int argc, char *argv[])
33713385
{"nosync",no_argument,NULL,'N'},
33723386
{"sync-only",no_argument,NULL,'S'},
33733387
{"xlogdir",required_argument,NULL,'X'},
3388+
{"xid",required_argument,NULL,'x'},
3389+
{"multixact-id",required_argument,NULL,'m'},
3390+
{"multixact-offset",required_argument,NULL,'o'},
33743391
{"data-checksums",no_argument,NULL,'k'},
33753392
{NULL,0,NULL,0}
33763393
};
@@ -3412,7 +3429,7 @@ main(int argc, char *argv[])
34123429

34133430
/* process command-line options */
34143431

3415-
while ((c=getopt_long(argc,argv,"dD:E:kL:nNU:WA:sST:X:",long_options,&option_index))!=-1)
3432+
while ((c=getopt_long(argc,argv,"dD:E:kL:m:nNU:WA:o:sST:X:x:",long_options,&option_index))!=-1)
34163433
{
34173434
switch (c)
34183435
{
@@ -3451,13 +3468,27 @@ main(int argc, char *argv[])
34513468
debug= true;
34523469
printf(_("Running in debug mode.\n"));
34533470
break;
3471+
case'm':
3472+
if (sscanf(optarg,HEX_XID_FMT,&start_mx_id)!=1)
3473+
{
3474+
fprintf(stderr,"%s: invalid hex value of multixact-id\n",progname);
3475+
exit(1);
3476+
}
3477+
break;
34543478
case'n':
34553479
noclean= true;
34563480
printf(_("Running in noclean mode. Mistakes will not be cleaned up.\n"));
34573481
break;
34583482
case'N':
34593483
do_sync= false;
34603484
break;
3485+
case'o':
3486+
if (sscanf(optarg,XID_FMT,&start_mx_offset)!=1)
3487+
{
3488+
fprintf(stderr,"%s: invalid decimal value of multixact-offset\n",progname);
3489+
exit(1);
3490+
}
3491+
break;
34613492
case'S':
34623493
sync_only= true;
34633494
break;
@@ -3503,6 +3534,13 @@ main(int argc, char *argv[])
35033534
case'X':
35043535
xlog_dir=pg_strdup(optarg);
35053536
break;
3537+
case'x':
3538+
if (sscanf(optarg,HEX_XID_FMT,&start_xid)!=1)
3539+
{
3540+
fprintf(stderr,"%s: invalid hex value of xid\n",progname);
3541+
exit(1);
3542+
}
3543+
break;
35063544
default:
35073545
/* getopt_long already emitted a complaint */
35083546
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),

‎src/bin/pg_xlogdump/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ install: all installdirs
3333
installdirs:
3434
$(MKDIR_P)'$(DESTDIR)$(bindir)'
3535

36+
check:
37+
$(prove_check)
38+
3639
uninstall:
3740
rm -f'$(DESTDIR)$(bindir)/pg_xlogdump$(X)'
3841

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp