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

Commitff40057

Browse files
committed
Fix initdb's logic for picking shared_buffers/max_fsm_pages, which had
gotten rather thoroughly whacked out by careless recent changes: theintended ratio between the two was off by a lot, and the minimum numberof shared buffers tried had increased by a lot. Problem exposed byfailures on buildfarm members with smaller SHMMAX values.
1 parentaf0af42 commitff40057

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.124 2006/10/0400:30:04 momjian Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.125 2006/10/0418:58:08 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1105,23 +1105,18 @@ test_config_settings(void)
11051105
* These macros define the minimum shared_buffers we want for a given
11061106
* max_connections value, and the max_fsm_pages setting to be used for a
11071107
* given shared_buffers value.The arrays show the settings to try.
1108-
*
11091108
*/
11101109

1111-
#defineMIN_BUFS_FOR_CONNS(nconns)((nconns) * 10 * (BLCKSZ/1024))
1110+
#defineMIN_BUFS_FOR_CONNS(nconns)((nconns) * 10)
11121111
#defineFSM_FOR_BUFS(nbuffers)((nbuffers) > 1000 ? 50 * (nbuffers) : 20000)
11131112

11141113
staticconstinttrial_conns[]= {
11151114
100,50,40,30,20,10
11161115
};
1117-
1118-
/*
1119-
* Candidate values for shared_buffers in kB. When the value is divisible
1120-
* by 1024, we write it in MB-unit to configuration files.
1121-
*/
11221116
staticconstinttrial_bufs[]= {
1123-
32768,28672,24576,20480,16384,12288,
1124-
8192,7200,6400,5600,4800,4000,
1117+
4096,3584,3072,2560,2048,1536,
1118+
1000,900,800,700,600,500,
1119+
400,300,200,100,50
11251120
};
11261121

11271122
charcmd[MAXPGPATH];
@@ -1147,7 +1142,7 @@ test_config_settings(void)
11471142
snprintf(cmd,sizeof(cmd),
11481143
"%s\"%s\" --boot -x0 %s "
11491144
"-c max_connections=%d "
1150-
"-c shared_buffers=%dkB "
1145+
"-c shared_buffers=%d "
11511146
"-c max_fsm_pages=%d "
11521147
"template1 < \"%s\" > \"%s\" 2>&1%s",
11531148
SYSTEMQUOTE,backend_exec,boot_options,
@@ -1182,7 +1177,7 @@ test_config_settings(void)
11821177
snprintf(cmd,sizeof(cmd),
11831178
"%s\"%s\" --boot -x0 %s "
11841179
"-c max_connections=%d "
1185-
"-c shared_buffers=%dkB "
1180+
"-c shared_buffers=%d "
11861181
"-c max_fsm_pages=%d "
11871182
"template1 < \"%s\" > \"%s\" 2>&1%s",
11881183
SYSTEMQUOTE,backend_exec,boot_options,
@@ -1195,10 +1190,10 @@ test_config_settings(void)
11951190
n_buffers=test_buffs;
11961191
n_fsm_pages=FSM_FOR_BUFS(n_buffers);
11971192

1198-
if (n_buffers %1024==0)
1199-
printf("%dMB/%d\n",n_buffers /1024,n_fsm_pages);
1193+
if ((n_buffers* (BLCKSZ/1024)) %1024==0)
1194+
printf("%dMB/%d\n",(n_buffers* (BLCKSZ/1024)) /1024,n_fsm_pages);
12001195
else
1201-
printf("%dkB/%d\n",n_buffers,n_fsm_pages);
1196+
printf("%dkB/%d\n",n_buffers* (BLCKSZ/1024),n_fsm_pages);
12021197
}
12031198

12041199
/*
@@ -1221,10 +1216,12 @@ setup_config(void)
12211216
snprintf(repltok,sizeof(repltok),"max_connections = %d",n_connections);
12221217
conflines=replace_token(conflines,"#max_connections = 100",repltok);
12231218

1224-
if (n_buffers %1024==0)
1225-
snprintf(repltok,sizeof(repltok),"shared_buffers = %dMB",n_buffers /1024);
1219+
if ((n_buffers* (BLCKSZ/1024)) %1024==0)
1220+
snprintf(repltok,sizeof(repltok),"shared_buffers = %dMB",
1221+
(n_buffers* (BLCKSZ/1024)) /1024);
12261222
else
1227-
snprintf(repltok,sizeof(repltok),"shared_buffers = %dkB",n_buffers);
1223+
snprintf(repltok,sizeof(repltok),"shared_buffers = %dkB",
1224+
n_buffers* (BLCKSZ/1024));
12281225
conflines=replace_token(conflines,"#shared_buffers = 32MB",repltok);
12291226

12301227
snprintf(repltok,sizeof(repltok),"max_fsm_pages = %d",n_fsm_pages);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp