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
f99760c1
Commit
f99760c1
authored
May 12, 2008
by
Magnus Hagander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert wal_sync_method to guc enum.
parent
f8c4d7db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
63 deletions
+77
-63
src/backend/access/transam/xlog.c
src/backend/access/transam/xlog.c
+53
-40
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+16
-10
src/include/access/xlog.h
src/include/access/xlog.h
+3
-4
src/include/access/xlogdefs.h
src/include/access/xlogdefs.h
+2
-6
src/include/utils/guc.h
src/include/utils/guc.h
+3
-3
No files found.
src/backend/access/transam/xlog.c
View file @
f99760c1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.30
3 2008/05/12 00:00:46 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.30
4 2008/05/12 08:35:05 mha
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -66,8 +66,6 @@ int XLOGbuffers = 8;
...
@@ -66,8 +66,6 @@ int XLOGbuffers = 8;
int
XLogArchiveTimeout
=
0
;
int
XLogArchiveTimeout
=
0
;
bool
XLogArchiveMode
=
false
;
bool
XLogArchiveMode
=
false
;
char
*
XLogArchiveCommand
=
NULL
;
char
*
XLogArchiveCommand
=
NULL
;
char
*
XLOG_sync_method
=
NULL
;
const
char
XLOG_sync_method_default
[]
=
DEFAULT_SYNC_METHOD_STR
;
bool
fullPageWrites
=
true
;
bool
fullPageWrites
=
true
;
bool
log_checkpoints
=
false
;
bool
log_checkpoints
=
false
;
...
@@ -95,6 +93,25 @@ static int open_sync_bit = DEFAULT_SYNC_FLAGBIT;
...
@@ -95,6 +93,25 @@ static int open_sync_bit = DEFAULT_SYNC_FLAGBIT;
#define XLOG_SYNC_BIT (enableFsync ? open_sync_bit : 0)
#define XLOG_SYNC_BIT (enableFsync ? open_sync_bit : 0)
/*
* GUC support
*/
const
struct
config_enum_entry
sync_method_options
[]
=
{
{
"fsync"
,
SYNC_METHOD_FSYNC
},
#ifdef HAVE_FSYNC_WRITETHROUGH
{
"fsync_writethrough"
,
SYNC_METHOD_FSYNC_WRITETHROUGH
},
#endif
#ifdef HAVE_FDATASYNC
{
"fdatasync"
,
SYNC_METHOD_FDATASYNC
},
#endif
#ifdef OPEN_SYNC_FLAG
{
"open_sync"
,
SYNC_METHOD_OPEN
},
#endif
#ifdef OPEN_DATASYNC_FLAG
{
"open_datasync"
,
SYNC_METHOD_OPEN_DSYNC
},
#endif
{
NULL
,
0
}
};
/*
/*
* Statistics for current checkpoint are collected in this global struct.
* Statistics for current checkpoint are collected in this global struct.
...
@@ -1601,7 +1618,7 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible, bool xlog_switch)
...
@@ -1601,7 +1618,7 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible, bool xlog_switch)
* have no open file or the wrong one. However, we do not need to
* have no open file or the wrong one. However, we do not need to
* fsync more than one file.
* fsync more than one file.
*/
*/
if
(
sync_method
!=
SYNC_METHOD_OPEN
)
if
(
sync_method
!=
SYNC_METHOD_OPEN
&&
sync_method
!=
SYNC_METHOD_OPEN_DSYNC
)
{
{
if
(
openLogFile
>=
0
&&
if
(
openLogFile
>=
0
&&
!
XLByteInPrevSeg
(
LogwrtResult
.
Write
,
openLogId
,
openLogSeg
))
!
XLByteInPrevSeg
(
LogwrtResult
.
Write
,
openLogId
,
openLogSeg
))
...
@@ -6314,50 +6331,46 @@ xlog_outrec(StringInfo buf, XLogRecord *record)
...
@@ -6314,50 +6331,46 @@ xlog_outrec(StringInfo buf, XLogRecord *record)
/*
/*
* GUC support
* GUC support
*/
*/
const
char
*
bool
assign_xlog_sync_method
(
const
char
*
method
,
bool
doit
,
GucSource
source
)
assign_xlog_sync_method
(
int
new_sync_
method
,
bool
doit
,
GucSource
source
)
{
{
int
new_sync_method
;
int
new_sync_bit
=
0
;
int
new_sync_bit
;
if
(
pg_strcasecmp
(
method
,
"fsync"
)
==
0
)
switch
(
new_sync_method
)
{
new_sync_method
=
SYNC_METHOD_FSYNC
;
new_sync_bit
=
0
;
}
#ifdef HAVE_FSYNC_WRITETHROUGH
else
if
(
pg_strcasecmp
(
method
,
"fsync_writethrough"
)
==
0
)
{
new_sync_method
=
SYNC_METHOD_FSYNC_WRITETHROUGH
;
new_sync_bit
=
0
;
}
#endif
#ifdef HAVE_FDATASYNC
else
if
(
pg_strcasecmp
(
method
,
"fdatasync"
)
==
0
)
{
{
new_sync_method
=
SYNC_METHOD_FDATASYNC
;
/*
new_sync_bit
=
0
;
* Values for these sync options are defined even if they are not
}
* supported on the current platform. They are not included in
#endif
* the enum option array, and therefor will never be set if the
* platform doesn't support it.
*/
case
SYNC_METHOD_FSYNC
:
case
SYNC_METHOD_FSYNC_WRITETHROUGH
:
case
SYNC_METHOD_FDATASYNC
:
new_sync_bit
=
0
;
break
;
#ifdef OPEN_SYNC_FLAG
#ifdef OPEN_SYNC_FLAG
else
if
(
pg_strcasecmp
(
method
,
"open_sync"
)
==
0
)
case
SYNC_METHOD_OPEN
:
{
new_sync_bit
=
OPEN_SYNC_FLAG
;
new_sync_method
=
SYNC_METHOD_OPEN
;
break
;
new_sync_bit
=
OPEN_SYNC_FLAG
;
}
#endif
#endif
#ifdef OPEN_DATASYNC_FLAG
#ifdef OPEN_DATASYNC_FLAG
else
if
(
pg_strcasecmp
(
method
,
"open_datasync"
)
==
0
)
case
SYNC_METHOD_OPEN_DSYNC
:
{
new_sync_bit
=
OPEN_DATASYNC_FLAG
;
new_sync_method
=
SYNC_METHOD_OPEN
;
break
;
new_sync_bit
=
OPEN_DATASYNC_FLAG
;
}
#endif
#endif
else
default:
return
NULL
;
/*
* This "can never happen", since the available values in
* new_sync_method are controlled by the available enum
* options.
*/
elog
(
PANIC
,
"unrecognized wal_sync_method: %d"
,
sync_method
);
break
;
}
if
(
!
doit
)
if
(
!
doit
)
return
method
;
return
true
;
if
(
sync_method
!=
new_sync_method
||
open_sync_bit
!=
new_sync_bit
)
if
(
sync_method
!=
new_sync_method
||
open_sync_bit
!=
new_sync_bit
)
{
{
...
@@ -6381,7 +6394,7 @@ assign_xlog_sync_method(const char *method, bool doit, GucSource source)
...
@@ -6381,7 +6394,7 @@ assign_xlog_sync_method(const char *method, bool doit, GucSource source)
open_sync_bit
=
new_sync_bit
;
open_sync_bit
=
new_sync_bit
;
}
}
return
method
;
return
true
;
}
}
...
...
src/backend/utils/misc/guc.c
View file @
f99760c1
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.45
2 2008/05/12 00:00:52 alvherre
Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.45
3 2008/05/12 08:35:05 mha
Exp $
*
*
*--------------------------------------------------------------------
*--------------------------------------------------------------------
*/
*/
...
@@ -270,6 +270,11 @@ static const struct config_enum_entry backslash_quote_options[] = {
...
@@ -270,6 +270,11 @@ static const struct config_enum_entry backslash_quote_options[] = {
{
NULL
,
0
}
{
NULL
,
0
}
};
};
/*
* Options for enum values stored in other modules
*/
extern
const
struct
config_enum_entry
sync_method_options
[];
/*
/*
* GUC option variables that are exported from this module
* GUC option variables that are exported from this module
*/
*/
...
@@ -2327,15 +2332,6 @@ static struct config_string ConfigureNamesString[] =
...
@@ -2327,15 +2332,6 @@ static struct config_string ConfigureNamesString[] =
"localhost"
,
NULL
,
NULL
"localhost"
,
NULL
,
NULL
},
},
{
{
"wal_sync_method"
,
PGC_SIGHUP
,
WAL_SETTINGS
,
gettext_noop
(
"Selects the method used for forcing WAL updates to disk."
),
NULL
},
&
XLOG_sync_method
,
XLOG_sync_method_default
,
assign_xlog_sync_method
,
NULL
},
{
{
{
"custom_variable_classes"
,
PGC_SIGHUP
,
CUSTOM_OPTIONS
,
{
"custom_variable_classes"
,
PGC_SIGHUP
,
CUSTOM_OPTIONS
,
gettext_noop
(
"Sets the list of known custom variable classes."
),
gettext_noop
(
"Sets the list of known custom variable classes."
),
...
@@ -2528,6 +2524,16 @@ static struct config_enum ConfigureNamesEnum[] =
...
@@ -2528,6 +2524,16 @@ static struct config_enum ConfigureNamesEnum[] =
assign_session_replication_role
,
NULL
assign_session_replication_role
,
NULL
},
},
{
{
"wal_sync_method"
,
PGC_SIGHUP
,
WAL_SETTINGS
,
gettext_noop
(
"Selects the method used for forcing WAL updates to disk."
),
NULL
},
&
sync_method
,
DEFAULT_SYNC_METHOD
,
sync_method_options
,
assign_xlog_sync_method
,
NULL
},
{
{
{
"xmlbinary"
,
PGC_USERSET
,
CLIENT_CONN_STATEMENT
,
{
"xmlbinary"
,
PGC_USERSET
,
CLIENT_CONN_STATEMENT
,
gettext_noop
(
"Sets how binary values are to be encoded in XML."
),
gettext_noop
(
"Sets how binary values are to be encoded in XML."
),
...
...
src/include/access/xlog.h
View file @
f99760c1
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.8
7 2008/01/01 19:45:56 momjian
Exp $
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.8
8 2008/05/12 08:35:05 mha
Exp $
*/
*/
#ifndef XLOG_H
#ifndef XLOG_H
#define XLOG_H
#define XLOG_H
...
@@ -88,8 +88,9 @@ typedef struct XLogRecord
...
@@ -88,8 +88,9 @@ typedef struct XLogRecord
/* Sync methods */
/* Sync methods */
#define SYNC_METHOD_FSYNC 0
#define SYNC_METHOD_FSYNC 0
#define SYNC_METHOD_FDATASYNC 1
#define SYNC_METHOD_FDATASYNC 1
#define SYNC_METHOD_OPEN 2
/* for O_SYNC
and O_DSYNC
*/
#define SYNC_METHOD_OPEN 2
/* for O_SYNC */
#define SYNC_METHOD_FSYNC_WRITETHROUGH 3
#define SYNC_METHOD_FSYNC_WRITETHROUGH 3
#define SYNC_METHOD_OPEN_DSYNC 4
/* for O_DSYNC */
extern
int
sync_method
;
extern
int
sync_method
;
/*
/*
...
@@ -141,8 +142,6 @@ extern int XLOGbuffers;
...
@@ -141,8 +142,6 @@ extern int XLOGbuffers;
extern
bool
XLogArchiveMode
;
extern
bool
XLogArchiveMode
;
extern
char
*
XLogArchiveCommand
;
extern
char
*
XLogArchiveCommand
;
extern
int
XLogArchiveTimeout
;
extern
int
XLogArchiveTimeout
;
extern
char
*
XLOG_sync_method
;
extern
const
char
XLOG_sync_method_default
[];
extern
bool
log_checkpoints
;
extern
bool
log_checkpoints
;
#define XLogArchivingActive() (XLogArchiveMode)
#define XLogArchivingActive() (XLogArchiveMode)
...
...
src/include/access/xlogdefs.h
View file @
f99760c1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.
19 2008/01/01 19:45:56 momjian
Exp $
* $PostgreSQL: pgsql/src/include/access/xlogdefs.h,v 1.
20 2008/05/12 08:35:05 mha
Exp $
*/
*/
#ifndef XLOG_DEFS_H
#ifndef XLOG_DEFS_H
#define XLOG_DEFS_H
#define XLOG_DEFS_H
...
@@ -109,19 +109,15 @@ typedef uint32 TimeLineID;
...
@@ -109,19 +109,15 @@ typedef uint32 TimeLineID;
#endif
#endif
#if defined(OPEN_DATASYNC_FLAG)
#if defined(OPEN_DATASYNC_FLAG)
#define DEFAULT_SYNC_METHOD_STR "open_datasync"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC
#define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN
#define DEFAULT_SYNC_FLAGBIT OPEN_DATASYNC_FLAG
#define DEFAULT_SYNC_FLAGBIT OPEN_DATASYNC_FLAG
#elif defined(HAVE_FDATASYNC)
#elif defined(HAVE_FDATASYNC)
#define DEFAULT_SYNC_METHOD_STR "fdatasync"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
#define DEFAULT_SYNC_FLAGBIT 0
#define DEFAULT_SYNC_FLAGBIT 0
#elif defined(HAVE_FSYNC_WRITETHROUGH_ONLY)
#elif defined(HAVE_FSYNC_WRITETHROUGH_ONLY)
#define DEFAULT_SYNC_METHOD_STR "fsync_writethrough"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC_WRITETHROUGH
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC_WRITETHROUGH
#define DEFAULT_SYNC_FLAGBIT 0
#define DEFAULT_SYNC_FLAGBIT 0
#else
#else
#define DEFAULT_SYNC_METHOD_STR "fsync"
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC
#define DEFAULT_SYNC_FLAGBIT 0
#define DEFAULT_SYNC_FLAGBIT 0
#endif
#endif
...
...
src/include/utils/guc.h
View file @
f99760c1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
*
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.9
4 2008/04/18 01:42:17 tgl
Exp $
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.9
5 2008/05/12 08:35:05 mha
Exp $
*--------------------------------------------------------------------
*--------------------------------------------------------------------
*/
*/
#ifndef GUC_H
#ifndef GUC_H
...
@@ -267,7 +267,7 @@ extern const char *assign_search_path(const char *newval,
...
@@ -267,7 +267,7 @@ extern const char *assign_search_path(const char *newval,
bool
doit
,
GucSource
source
);
bool
doit
,
GucSource
source
);
/* in access/transam/xlog.c */
/* in access/transam/xlog.c */
extern
const
char
*
assign_xlog_sync_method
(
const
char
*
method
,
extern
bool
assign_xlog_sync_method
(
int
newval
,
bool
doit
,
GucSource
source
);
bool
doit
,
GucSource
source
);
#endif
/* GUC_H */
#endif
/* GUC_H */
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