Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
bc028beb
Commit
bc028beb
authored
Jan 06, 2004
by
Neil Conway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the 'wal_debug' GUC variable a boolean (rather than an integer), and
hide it behind #ifdef WAL_DEBUG blocks.
parent
b0c4a50b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
36 deletions
+63
-36
doc/src/sgml/ref/show.sgml
doc/src/sgml/ref/show.sgml
+2
-2
doc/src/sgml/runtime.sgml
doc/src/sgml/runtime.sgml
+6
-3
doc/src/sgml/wal.sgml
doc/src/sgml/wal.sgml
+10
-11
src/backend/access/transam/xlog.c
src/backend/access/transam/xlog.c
+16
-2
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+18
-15
src/include/access/xlog.h
src/include/access/xlog.h
+4
-2
src/include/pg_config_manual.h
src/include/pg_config_manual.h
+7
-1
No files found.
doc/src/sgml/ref/show.sgml
View file @
bc028beb
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/show.sgml,v 1.3
4 2003/11/29 19:51:39 pgsql
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/show.sgml,v 1.3
5 2004/01/06 17:26:23 neilc
Exp $
PostgreSQL documentation
-->
...
...
@@ -172,7 +172,7 @@ SHOW ALL;
.
.
.
wal_debug |
0
wal_debug |
off
wal_sync_method | fdatasync
(94 rows)
</programlisting>
...
...
doc/src/sgml/runtime.sgml
View file @
bc028beb
<!--
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.22
8 2004/01/05 20:37:51
neilc Exp $
$PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.22
9 2004/01/06 17:26:22
neilc Exp $
-->
<Chapter Id="runtime">
...
...
@@ -2667,10 +2667,13 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
</varlistentry>
<varlistentry>
<term><varname>wal_debug</varname> (<type>
integer
</type>)</term>
<term><varname>wal_debug</varname> (<type>
boolean
</type>)</term>
<listitem>
<para>
If nonzero, turn on WAL-related debugging output.
If true, emit WAL-related debugging output. This option is
only available if the <symbol>WAL_DEBUG</symbol> macro was
defined when <productname>PostgreSQL</productname> was
compiled.
</para>
</listitem>
</varlistentry>
...
...
doc/src/sgml/wal.sgml
View file @
bc028beb
<!-- $PostgreSQL: pgsql/doc/src/sgml/wal.sgml,v 1.2
6 2003/11/29 19:51:38 pgsql
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/wal.sgml,v 1.2
7 2004/01/06 17:26:23 neilc
Exp $ -->
<chapter id="wal">
<title>Write-Ahead Logging (<acronym>WAL</acronym>)</title>
...
...
@@ -19,10 +19,10 @@
transaction processing. Briefly, <acronym>WAL</acronym>'s central
concept is that changes to data files (where tables and indexes
reside) must be written only after those changes have been logged,
that is, when log records
have been flushed to permanent
storage. If we follow this procedure, we do not need to flush
data pages to disk on every transaction commit, because we know
that in the event of a crash we will be able to recover the
that is, when log records
describing the changes have been flushed
to permanent storage. If we follow this procedure, we do not need
to flush data pages to disk on every transaction commit, because we
know
that in the event of a crash we will be able to recover the
database using the log: any changes that have not been applied to
the data pages will first be redone from the log records (this is
roll-forward recovery, also known as REDO) and then changes made by
...
...
@@ -187,7 +187,7 @@
<para>
There will be at least one 16 MB segment file, and will normally
not be more than 2 * <varname>checkpoint_segments</varname> + 1
files. You can use this to estimate space requirements for
WAL
.
files. You can use this to estimate space requirements for
<acronym>WAL</acronym>
.
Ordinarily, when old log segment files are no longer needed, they
are recycled (renamed to become the next segments in the numbered
sequence). If, due to a short-term peak of log output rate, there
...
...
@@ -254,7 +254,7 @@
<para>
The <varname>wal_sync_method</varname> parameter determines how
<productname>PostgreSQL</productname> will ask the kernel to force
WAL
updates out to disk.
<acronym>WAL</acronym>
updates out to disk.
All the options should be the same as far as reliability goes,
but it's quite platform-specific which one will be the fastest.
Note that this parameter is irrelevant if <varname>fsync</varname>
...
...
@@ -262,11 +262,10 @@
</para>
<para>
Setting the <varname>wal_debug</varname> parameter to any nonzero
value
will result in each <function>LogInsert</function> and
Enabling the <varname>wal_debug</varname> configuration parameter
will result in each <function>LogInsert</function> and
<function>LogFlush</function> <acronym>WAL</acronym> call being
logged to the server log. At present, it makes no difference what
the nonzero value is. This option may be replaced by a more
logged to the server log. This option may be replaced by a more
general mechanism in the future.
</para>
</sect1>
...
...
src/backend/access/transam/xlog.c
View file @
bc028beb
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.1
29 2003/12/20 17:31:20 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.1
30 2004/01/06 17:26:23 neilc
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -86,12 +86,15 @@
/* User-settable parameters */
int
CheckPointSegments
=
3
;
int
XLOGbuffers
=
8
;
int
XLOG_DEBUG
=
0
;
char
*
XLOG_sync_method
=
NULL
;
const
char
XLOG_sync_method_default
[]
=
DEFAULT_SYNC_METHOD_STR
;
char
XLOG_archive_dir
[
MAXPGPATH
];
/* null string means
* delete 'em */
#ifdef WAL_DEBUG
bool
XLOG_DEBUG
=
false
;
#endif
/*
* XLOGfileslop is used in the code as the allowed "fuzz" in the number of
* preallocated XLOG segments --- we try to have at least XLOGfiles advance
...
...
@@ -766,6 +769,7 @@ begin:;
MyProc
->
logRec
=
RecPtr
;
}
#ifdef WAL_DEBUG
if
(
XLOG_DEBUG
)
{
char
buf
[
8192
];
...
...
@@ -779,6 +783,7 @@ begin:;
}
elog
(
LOG
,
"%s"
,
buf
);
}
#endif
/* Record begin of record in appropriate places */
if
(
!
no_tran
)
...
...
@@ -1074,8 +1079,10 @@ XLogWrite(XLogwrtRqst WriteRqst)
openLogSeg
>=
(
RedoRecPtr
.
xrecoff
/
XLogSegSize
)
+
(
uint32
)
CheckPointSegments
))
{
#ifdef WAL_DEBUG
if
(
XLOG_DEBUG
)
elog
(
LOG
,
"time for a checkpoint, signaling postmaster"
);
#endif
SendPostmasterSignal
(
PMSIGNAL_DO_CHECKPOINT
);
}
}
...
...
@@ -1214,11 +1221,13 @@ XLogFlush(XLogRecPtr record)
if
(
XLByteLE
(
record
,
LogwrtResult
.
Flush
))
return
;
#ifdef WAL_DEBUG
if
(
XLOG_DEBUG
)
elog
(
LOG
,
"xlog flush request %X/%X; write %X/%X; flush %X/%X"
,
record
.
xlogid
,
record
.
xrecoff
,
LogwrtResult
.
Write
.
xlogid
,
LogwrtResult
.
Write
.
xrecoff
,
LogwrtResult
.
Flush
.
xlogid
,
LogwrtResult
.
Flush
.
xrecoff
);
#endif
START_CRIT_SECTION
();
...
...
@@ -2613,8 +2622,10 @@ StartupXLOG(void)
/* This is just to allow attaching to startup process with a debugger */
#ifdef XLOG_REPLAY_DELAY
#ifdef WAL_DEBUG
if
(
XLOG_DEBUG
&&
ControlFile
->
state
!=
DB_SHUTDOWNED
)
sleep
(
60
);
#endif
#endif
/*
...
...
@@ -2742,6 +2753,8 @@ StartupXLOG(void)
ShmemVariableCache
->
nextXid
=
record
->
xl_xid
;
TransactionIdAdvance
(
ShmemVariableCache
->
nextXid
);
}
#ifdef WAL_DEBUG
if
(
XLOG_DEBUG
)
{
char
buf
[
8192
];
...
...
@@ -2755,6 +2768,7 @@ StartupXLOG(void)
record
->
xl_info
,
XLogRecGetData
(
record
));
elog
(
LOG
,
"%s"
,
buf
);
}
#endif
if
(
record
->
xl_info
&
XLR_BKP_BLOCK_MASK
)
RestoreBkpBlocks
(
record
,
EndRecPtr
);
...
...
src/backend/utils/misc/guc.c
View file @
bc028beb
...
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.17
5 2003/12/03 18:52:00 joe
Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.17
6 2004/01/06 17:26:23 neilc
Exp $
*
*--------------------------------------------------------------------
*/
...
...
@@ -336,17 +336,18 @@ const char *const config_type_names[] =
* TO ADD AN OPTION:
*
* 1. Declare a global variable of type bool, int, double, or char*
* and make use of it.
*
and make use of it.
*
* 2. Decide at what times it's safe to set the option. See guc.h for
* details.
*
details.
*
* 3. Decide on a name, a default value, upper and lower bounds (if
* applicable), etc.
*
applicable), etc.
*
* 4. Add a record below.
*
* 5. Add it to src/backend/utils/misc/postgresql.conf.sample.
* 5. Add it to src/backend/utils/misc/postgresql.conf.sample, if
* appropriate
*
* 6. Add it to src/bin/psql/tab-complete.c, if it's a USERSET option.
*
...
...
@@ -862,6 +863,18 @@ static struct config_bool ConfigureNamesBool[] =
#endif
},
#ifdef WAL_DEBUG
{
{
"wal_debug"
,
PGC_SUSET
,
DEVELOPER_OPTIONS
,
gettext_noop
(
"Emit WAL-related debugging output."
),
NULL
,
GUC_NOT_IN_SAMPLE
},
&
XLOG_DEBUG
,
false
,
NULL
,
NULL
},
#endif
/* End-of-list marker */
{
{
NULL
,
0
,
0
,
NULL
,
NULL
},
NULL
,
false
,
NULL
,
NULL
...
...
@@ -1171,16 +1184,6 @@ static struct config_int ConfigureNamesInt[] =
8
,
4
,
INT_MAX
,
NULL
,
NULL
},
{
{
"wal_debug"
,
PGC_SUSET
,
DEVELOPER_OPTIONS
,
gettext_noop
(
"If nonzero, WAL-related debugging output is logged."
),
NULL
,
GUC_NOT_IN_SAMPLE
},
&
XLOG_DEBUG
,
0
,
0
,
16
,
NULL
,
NULL
},
{
{
"commit_delay"
,
PGC_USERSET
,
WAL_CHECKPOINTS
,
gettext_noop
(
"Sets the delay in microseconds between transaction commit and "
...
...
src/include/access/xlog.h
View file @
bc028beb
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.4
6 2003/12/12 18:45:10 petere
Exp $
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.4
7 2004/01/06 17:26:23 neilc
Exp $
*/
#ifndef XLOG_H
#define XLOG_H
...
...
@@ -189,10 +189,12 @@ extern XLogRecPtr ProcLastRecEnd;
extern
int
CheckPointSegments
;
extern
int
CheckPointWarning
;
extern
int
XLOGbuffers
;
extern
int
XLOG_DEBUG
;
extern
char
*
XLOG_sync_method
;
extern
const
char
XLOG_sync_method_default
[];
#ifdef WAL_DEBUG
extern
bool
XLOG_DEBUG
;
#endif
extern
XLogRecPtr
XLogInsert
(
RmgrId
rmid
,
uint8
info
,
XLogRecData
*
rdata
);
extern
void
XLogFlush
(
XLogRecPtr
RecPtr
);
...
...
src/include/pg_config_manual.h
View file @
bc028beb
...
...
@@ -6,7 +6,7 @@
* for developers. If you edit any of these, be sure to do a *full*
* rebuild (and an initdb if noted).
*
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.
8 2003/11/29 22:40:53 pgsql
Exp $
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.
9 2004/01/06 17:26:23 neilc
Exp $
*------------------------------------------------------------------------
*/
...
...
@@ -224,6 +224,12 @@
*/
/* #define LOCK_DEBUG */
/*
* Enable debugging print statements for WAL-related operations; see
* also the wal_debug GUC var.
*/
/* #define WAL_DEBUG */
/*
* Other debug #defines (documentation, anyone?)
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment