Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 14d6c9f

Browse files
committed
Remove the nexus between trial_buffs and trial_conns, and don't test shared buffers lower than or equal to a value we already know is good, but use that value instead. This will make it easier to adjust the trial values and/or formulae in future if necessary.
1 parent bb1bba8 commit 14d6c9f

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/bin/initdb/initdb.c

Lines changed: 14 additions & 8 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.103 2005/12/31 23:50:59 tgl Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.104 2006/01/02 16:45:12 adunstan Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -1099,10 +1099,8 @@ test_config_settings(void)
10991099
* max_connections value, and the max_fsm_pages setting to be used for
11001100
* a given shared_buffers value. The arrays show the settings to try.
11011101
*
1102-
* Make sure the trial_bufs[] list includes the MIN_BUFS_FOR_CONNS()
1103-
* value for each trial_conns[] entry, else we may end up setting
1104-
* shared_buffers lower than it could be.
11051102
*/
1103+
11061104
#define MIN_BUFS_FOR_CONNS(nconns) ((nconns) * 10)
11071105
#define FSM_FOR_BUFS(nbuffers) ((nbuffers) > 1000 ? 50 * (nbuffers) : 20000)
11081106

@@ -1122,7 +1120,9 @@ test_config_settings(void)
11221120
status,
11231121
test_conns,
11241122
test_buffs,
1125-
test_max_fsm;
1123+
test_max_fsm,
1124+
ok_buffers = 0;
1125+
11261126

11271127
printf(_("selecting default max_connections ... "));
11281128
fflush(stdout);
@@ -1144,7 +1144,10 @@ test_config_settings(void)
11441144
DEVNULL, DEVNULL, SYSTEMQUOTE);
11451145
status = system(cmd);
11461146
if (status == 0)
1147+
{
1148+
ok_buffers = test_buffs;
11471149
break;
1150+
}
11481151
}
11491152
if (i >= connslen)
11501153
i = connslen - 1;
@@ -1158,6 +1161,11 @@ test_config_settings(void)
11581161
for (i = 0; i < bufslen; i++)
11591162
{
11601163
test_buffs = trial_bufs[i];
1164+
if (test_buffs <= ok_buffers)
1165+
{
1166+
test_buffs = ok_buffers;
1167+
break;
1168+
}
11611169
test_max_fsm = FSM_FOR_BUFS(test_buffs);
11621170

11631171
snprintf(cmd, sizeof(cmd),
@@ -1173,9 +1181,7 @@ test_config_settings(void)
11731181
if (status == 0)
11741182
break;
11751183
}
1176-
if (i >= bufslen)
1177-
i = bufslen - 1;
1178-
n_buffers = trial_bufs[i];
1184+
n_buffers = test_buffs;
11791185
n_fsm_pages = FSM_FOR_BUFS(n_buffers);
11801186

11811187
printf("%d/%d\n", n_buffers, n_fsm_pages);

0 commit comments

Comments
 (0)