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

Commit3ed1956

Browse files
Make enum for sync methods available to frontend code.
This commit renames RecoveryInitSyncMethod to DataDirSyncMethod andmoves it to common/file_utils.h. This is preparatory work for afollow-up commit that will allow specifying the synchronizationmethod in frontend utilities such as pg_upgrade and pg_basebackup.Reviewed-by: Michael PaquierDiscussion:https://postgr.es/m/ZN2ZB4afQ2JbR9TA%40paquier.xyz
1 parent059e4ee commit3ed1956

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ intmax_safe_fds = FD_MINFREE;/* default if not changed */
162162
booldata_sync_retry= false;
163163

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

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

35153515
#ifdefHAVE_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
structdirent*de;

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

Lines 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
staticconststructconfig_enum_entryrecovery_init_sync_method_options[]= {
433-
{"fsync",RECOVERY_INIT_SYNC_METHOD_FSYNC, false},
434+
{"fsync",DATA_DIR_SYNC_METHOD_FSYNC, false},
434435
#ifdefHAVE_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

Lines 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+
typedefenumDataDirSyncMethod
28+
{
29+
DATA_DIR_SYNC_METHOD_FSYNC,
30+
DATA_DIR_SYNC_METHOD_SYNCFS
31+
}DataDirSyncMethod;
32+
2733
structiovec;/* avoid including port/pg_iovec.h here */
2834

2935
#ifdefFRONTEND

‎src/include/storage/fd.h

Lines 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-
typedefenumRecoveryInitSyncMethod
50-
{
51-
RECOVERY_INIT_SYNC_METHOD_FSYNC,
52-
RECOVERY_INIT_SYNC_METHOD_SYNCFS
53-
}RecoveryInitSyncMethod;
54-
5549
typedefintFile;
5650

5751

‎src/tools/pgindent/typedefs.list

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp