42
42
* Portions Copyright (c) 1994, Regents of the University of California
43
43
* Portions taken from FreeBSD.
44
44
*
45
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.101 2005/12/09 15:51:14 petere Exp $
45
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.102 2005/12/27 23:54:01 adunstan Exp $
46
46
*
47
47
*-------------------------------------------------------------------------
48
48
*/
@@ -120,6 +120,7 @@ static int output_errno = 0;
120
120
/* defaults */
121
121
static int n_connections = 10 ;
122
122
static int n_buffers = 50 ;
123
+ static int n_fsm_pages = 20000 ;
123
124
124
125
/*
125
126
* Warning messages for authentication methods
@@ -1083,6 +1084,13 @@ set_null_conf(void)
1083
1084
}
1084
1085
}
1085
1086
1087
+ /*
1088
+ * max_fsm_pages setting used in both the shared_buffers and max_connections
1089
+ * tests.
1090
+ */
1091
+
1092
+ #define TEST_FSM (x ) ( (x) > 1000 ? 50 * (x) : 20000 )
1093
+
1086
1094
/*
1087
1095
* check how many connections we can sustain
1088
1096
*/
@@ -1100,12 +1108,17 @@ test_connections(void)
1100
1108
1101
1109
for (i = 0 ; i < len ; i ++ )
1102
1110
{
1111
+ int test_buffs = conns [i ] * 5 ;
1112
+ int test_max_fsm = TEST_FSM (test_buffs );
1113
+
1103
1114
snprintf (cmd , sizeof (cmd ),
1104
1115
"%s\"%s\" -boot -x0 %s "
1116
+ "-c max_fsm_pages=%d "
1105
1117
"-c shared_buffers=%d -c max_connections=%d template1 "
1106
1118
"< \"%s\" > \"%s\" 2>&1%s" ,
1107
1119
SYSTEMQUOTE , backend_exec , boot_options ,
1108
- conns [i ] * 5 , conns [i ],
1120
+ test_max_fsm ,
1121
+ test_buffs , conns [i ],
1109
1122
DEVNULL , DEVNULL , SYSTEMQUOTE );
1110
1123
status = system (cmd );
1111
1124
if (status == 0 )
@@ -1125,22 +1138,30 @@ static void
1125
1138
test_buffers (void )
1126
1139
{
1127
1140
char cmd [MAXPGPATH ];
1128
- static const int bufs [] = {1000 , 900 , 800 , 700 , 600 , 500 ,
1129
- 400 , 300 , 200 , 100 , 50 };
1141
+ static const int bufs [] = {
1142
+ 4000 , 3500 , 3000 , 2500 , 2000 , 1500 ,
1143
+ 1000 , 900 , 800 , 700 , 600 , 500 ,
1144
+ 400 , 300 , 200 , 100 , 50
1145
+ };
1130
1146
static const int len = sizeof (bufs ) / sizeof (int );
1131
1147
int i ,
1132
- status ;
1148
+ status ,
1149
+ test_max_fsm_pages ;
1133
1150
1134
- printf (_ ("selecting default shared_buffers ... " ));
1151
+ printf (_ ("selecting default shared_buffers/max_fsm_pages ... " ));
1135
1152
fflush (stdout );
1136
1153
1137
1154
for (i = 0 ; i < len ; i ++ )
1138
1155
{
1156
+ test_max_fsm_pages = TEST_FSM (bufs [i ]);
1157
+
1139
1158
snprintf (cmd , sizeof (cmd ),
1140
1159
"%s\"%s\" -boot -x0 %s "
1160
+ "-c max_fsm_pages=%d "
1141
1161
"-c shared_buffers=%d -c max_connections=%d template1 "
1142
1162
"< \"%s\" > \"%s\" 2>&1%s" ,
1143
1163
SYSTEMQUOTE , backend_exec , boot_options ,
1164
+ test_max_fsm_pages ,
1144
1165
bufs [i ], n_connections ,
1145
1166
DEVNULL , DEVNULL , SYSTEMQUOTE );
1146
1167
status = system (cmd );
@@ -1150,8 +1171,9 @@ test_buffers(void)
1150
1171
if (i >= len )
1151
1172
i = len - 1 ;
1152
1173
n_buffers = bufs [i ];
1174
+ n_fsm_pages = test_max_fsm_pages ;
1153
1175
1154
- printf ("%d\n" , n_buffers );
1176
+ printf ("%d/%d \n" , n_buffers , n_fsm_pages );
1155
1177
}
1156
1178
1157
1179
/*
@@ -1177,6 +1199,9 @@ setup_config(void)
1177
1199
snprintf (repltok , sizeof (repltok ), "shared_buffers = %d" , n_buffers );
1178
1200
conflines = replace_token (conflines , "#shared_buffers = 1000" , repltok );
1179
1201
1202
+ snprintf (repltok , sizeof (repltok ), "max_fsm_pages = %d" , n_fsm_pages );
1203
+ conflines = replace_token (conflines , "#max_fsm_pages = 20000" , repltok );
1204
+
1180
1205
#if DEF_PGPORT != 5432
1181
1206
snprintf (repltok , sizeof (repltok ), "#port = %d" , DEF_PGPORT );
1182
1207
conflines = replace_token (conflines , "#port = 5432" , repltok );
0 commit comments