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

Appearance settings

Commit 3ed1956

Browse filesBrowse files
Make enum for sync methods available to frontend code.
This commit renames RecoveryInitSyncMethod to DataDirSyncMethod and moves it to common/file_utils.h. This is preparatory work for a follow-up commit that will allow specifying the synchronization method in frontend utilities such as pg_upgrade and pg_basebackup. Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/ZN2ZB4afQ2JbR9TA%40paquier.xyz
1 parent 059e4ee commit 3ed1956
Copy full SHA for 3ed1956

File tree

Expand file treeCollapse file tree

5 files changed

+13
-11
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+13
-11
lines changed

‎src/backend/storage/file/fd.c

Copy file name to clipboardExpand all lines: src/backend/storage/file/fd.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ int max_safe_fds = FD_MINFREE; /* default if not changed */
162162
bool data_sync_retry = false;
163163

164164
/* How SyncDataDirectory() should do its job. */
165-
int recovery_init_sync_method = RECOVERY_INIT_SYNC_METHOD_FSYNC;
165+
int recovery_init_sync_method = DATA_DIR_SYNC_METHOD_FSYNC;
166166

167167
/* Which kinds of files should be opened with PG_O_DIRECT. */
168168
int io_direct_flags;
@@ -3513,7 +3513,7 @@ SyncDataDirectory(void)
35133513
}
35143514

35153515
#ifdef HAVE_SYNCFS
3516-
if (recovery_init_sync_method == RECOVERY_INIT_SYNC_METHOD_SYNCFS)
3516+
if (recovery_init_sync_method == DATA_DIR_SYNC_METHOD_SYNCFS)
35173517
{
35183518
DIR *dir;
35193519
struct dirent *de;

‎src/backend/utils/misc/guc_tables.c

Copy file name to clipboardExpand all lines: src/backend/utils/misc/guc_tables.c
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "commands/trigger.h"
4242
#include "commands/user.h"
4343
#include "commands/vacuum.h"
44+
#include "common/file_utils.h"
4445
#include "common/scram-common.h"
4546
#include "jit/jit.h"
4647
#include "libpq/auth.h"
@@ -430,9 +431,9 @@ StaticAssertDecl(lengthof(ssl_protocol_versions_info) == (PG_TLS1_3_VERSION + 2)
430431
"array length mismatch");
431432

432433
static const struct config_enum_entry recovery_init_sync_method_options[] = {
433-
{"fsync", RECOVERY_INIT_SYNC_METHOD_FSYNC, false},
434+
{"fsync", DATA_DIR_SYNC_METHOD_FSYNC, false},
434435
#ifdef HAVE_SYNCFS
435-
{"syncfs", RECOVERY_INIT_SYNC_METHOD_SYNCFS, false},
436+
{"syncfs", DATA_DIR_SYNC_METHOD_SYNCFS, false},
436437
#endif
437438
{NULL, 0, false}
438439
};
@@ -4953,7 +4954,7 @@ struct config_enum ConfigureNamesEnum[] =
49534954
gettext_noop("Sets the method for synchronizing the data directory before crash recovery."),
49544955
},
49554956
&recovery_init_sync_method,
4956-
RECOVERY_INIT_SYNC_METHOD_FSYNC, recovery_init_sync_method_options,
4957+
DATA_DIR_SYNC_METHOD_FSYNC, recovery_init_sync_method_options,
49574958
NULL, NULL, NULL
49584959
},
49594960

‎src/include/common/file_utils.h

Copy file name to clipboardExpand all lines: src/include/common/file_utils.h
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ typedef enum PGFileType
2424
PGFILETYPE_LNK
2525
} PGFileType;
2626

27+
typedef enum DataDirSyncMethod
28+
{
29+
DATA_DIR_SYNC_METHOD_FSYNC,
30+
DATA_DIR_SYNC_METHOD_SYNCFS
31+
} DataDirSyncMethod;
32+
2733
struct iovec; /* avoid including port/pg_iovec.h here */
2834

2935
#ifdef FRONTEND

‎src/include/storage/fd.h

Copy file name to clipboardExpand all lines: src/include/storage/fd.h
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646
#include <dirent.h>
4747
#include <fcntl.h>
4848

49-
typedef enum RecoveryInitSyncMethod
50-
{
51-
RECOVERY_INIT_SYNC_METHOD_FSYNC,
52-
RECOVERY_INIT_SYNC_METHOD_SYNCFS
53-
} RecoveryInitSyncMethod;
54-
5549
typedef int File;
5650

5751

‎src/tools/pgindent/typedefs.list

Copy file name to clipboardExpand all lines: src/tools/pgindent/typedefs.list
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ DR_printtup
545545
DR_sqlfunction
546546
DR_transientrel
547547
DWORD
548+
DataDirSyncMethod
548549
DataDumperPtr
549550
DataPageDeleteStack
550551
DatabaseInfo

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.