File: 060_obsolete_confparams.t

package info (click to toggle)
postgresql-common 94lenny1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 624 kB
  • ctags: 97
  • sloc: perl: 2,268; sh: 220; makefile: 14
file content (592 lines) | stat: -rw-r--r-- 15,530 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# Test upgrading from the oldest version to all majors with all possible
# configuration parameters set. This checks that they are correctly
# transitioned.

use strict; 

use lib 't';
use TestLib;

use Test::More tests => ($#MAJORS == 0) ? 1 : (23 + $#MAJORS * 9);

if ($#MAJORS == 0) {
    pass 'only one major version installed, skipping upgrade tests';
    exit 0;
}

# postgresql.conf configuration file with all available options turned on
my %fullconf;
$fullconf{'7.4'} = "tcpip_socket = true
max_connections = 100
superuser_reserved_connections = 2
port = 5432
unix_socket_directory = '/var/run/postgresql'
unix_socket_group = ''
unix_socket_permissions = 0777
virtual_host = ''
rendezvous_name = ''
authentication_timeout = 60
ssl = false
password_encryption = true
krb_server_keyfile = ''
db_user_namespace = false
shared_buffers = 1000
sort_mem = 1024
vacuum_mem = 8192
max_fsm_pages = 20000
max_fsm_relations = 1000
max_files_per_process = 1000
preload_libraries = ''
fsync = true
wal_sync_method = fsync
wal_buffers = 8
checkpoint_segments = 3
checkpoint_timeout = 300
checkpoint_warning = 30
commit_delay = 0
commit_siblings = 5
enable_hashagg = true
enable_hashjoin = true
enable_indexscan = true
enable_mergejoin = true
enable_nestloop = true
enable_seqscan = true
enable_sort = true
enable_tidscan = true
effective_cache_size = 1000
random_page_cost = 4
cpu_tuple_cost = 0.01
cpu_index_tuple_cost = 0.001
cpu_operator_cost = 0.0025
geqo = true
geqo_threshold = 11
geqo_effort = 1
geqo_generations = 0
geqo_pool_size = 0
geqo_selection_bias = 2.0
default_statistics_target = 10
from_collapse_limit = 8
join_collapse_limit = 8
syslog = 0
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
client_min_messages = notice
log_min_messages = notice
log_error_verbosity = default
log_min_error_statement = panic
log_min_duration_statement = -1
silent_mode = false
debug_print_parse = false
debug_print_rewritten = false
debug_print_plan = false
debug_pretty_print = false
log_connections = true
log_duration = false
log_pid = true
log_statement = true
log_timestamp = true
log_hostname = true
log_source_port = true
log_parser_stats = false
log_planner_stats = false
log_executor_stats = false
stats_start_collector = true
stats_command_string = false
stats_block_level = false
stats_row_level = true
stats_reset_on_server_start = true
search_path = '\$user,public'
default_transaction_isolation = 'read committed'
default_transaction_read_only = false
statement_timeout = 0
datestyle = 'ISO,European'
australian_timezones = false
extra_float_digits = 0
dynamic_library_path = '/usr/share/postgresql:/usr/lib/postgresql'
max_expr_depth = 10000
deadlock_timeout = 1000
max_locks_per_transaction = 64
add_missing_from = true
regex_flavor = advanced
sql_inheritance = true
transform_null_equals = false
";

$fullconf{'8.0'} = "port = 5432
max_connections = 100
superuser_reserved_connections = 2
unix_socket_directory = '/var/run/postgresql'
unix_socket_group = ''
unix_socket_permissions = 0777	
rendezvous_name = ''		
authentication_timeout = 60	
ssl = false
password_encryption = true
krb_server_keyfile = ''
db_user_namespace = false
shared_buffers = 1000		
work_mem = 1024		
maintenance_work_mem = 16384	
max_stack_depth = 2048		
max_fsm_pages = 20000		
max_fsm_relations = 1000	
max_files_per_process = 1000	
preload_libraries = ''
vacuum_cost_delay = 0		
vacuum_cost_page_hit = 1	
vacuum_cost_page_miss = 10	
vacuum_cost_page_dirty = 20	
vacuum_cost_limit = 200	
bgwriter_delay = 200		
bgwriter_percent = 1		
bgwriter_maxpages = 100	
fsync = true			
wal_sync_method = fsync	
wal_buffers = 8		
commit_delay = 0		
commit_siblings = 5		
checkpoint_segments = 3	
checkpoint_timeout = 300	
checkpoint_warning = 30	
archive_command = ''		
enable_hashagg = true
enable_hashjoin = true
enable_indexscan = true
enable_mergejoin = true
enable_nestloop = true
enable_seqscan = true
enable_sort = true
enable_tidscan = true
effective_cache_size = 1000	
random_page_cost = 4		
cpu_tuple_cost = 0.01		
cpu_index_tuple_cost = 0.001	
cpu_operator_cost = 0.0025	
geqo = true
geqo_threshold = 12
geqo_effort = 5		
geqo_pool_size = 0		
geqo_generations = 0		
geqo_selection_bias = 2.0	
from_collapse_limit = 8
join_collapse_limit = 8	
log_destination = 'stderr'	
redirect_stderr = true    
log_directory = '.'   
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' 
log_truncate_on_rotation = false  
log_rotation_age = 1440    
log_rotation_size = 10240  
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
client_min_messages = notice	
log_min_messages = notice	
log_error_verbosity = default	
log_min_error_statement = panic 
log_min_duration_statement = -1 
silent_mode = false		 
debug_print_parse = false
debug_print_rewritten = false
debug_print_plan = false
debug_pretty_print = false
log_connections = false
log_disconnections = false
log_duration = false
log_line_prefix = ''		
log_statement = 'none'		
log_hostname = false
log_parser_stats = false
log_planner_stats = false
log_executor_stats = false
log_statement_stats = false
stats_start_collector = true
stats_command_string = false
stats_block_level = false
stats_row_level = true
stats_reset_on_server_start = true
search_path = '\$user,public'	
default_tablespace = ''	
check_function_bodies = true
default_transaction_isolation = 'read committed'
default_transaction_read_only = true
statement_timeout = 0		
datestyle = 'iso, mdy'
timezone = unknown		
australian_timezones = false
extra_float_digits = 0		
client_encoding = sql_ascii	
lc_messages = 'ru_RU.UTF-8'		
lc_monetary = 'ru_RU.UTF-8'		
lc_numeric = 'ru_RU.UTF-8'		
lc_time = 'ru_RU.UTF-8'			
explain_pretty_print = true
dynamic_library_path = '\$libdir'
deadlock_timeout = 1000	
max_locks_per_transaction = 64	
add_missing_from = true
regex_flavor = advanced	
sql_inheritance = true
default_with_oids = true
transform_null_equals = false
";

$fullconf{'8.1'} = "port = 5432
max_connections = 100
superuser_reserved_connections = 2
unix_socket_directory = ''
unix_socket_group = ''
unix_socket_permissions = 0777
bonjour_name = ''
authentication_timeout = 60
ssl = off
password_encryption = on
db_user_namespace = off
krb_server_keyfile = ''
krb_srvname = 'postgres'
krb_server_hostname = ''
krb_caseins_users = off
tcp_keepalives_idle = 0
tcp_keepalives_interval = 0
tcp_keepalives_count = 0
shared_buffers = 1000
temp_buffers = 1000
max_prepared_transactions = 5
work_mem = 1024
maintenance_work_mem = 16384
max_stack_depth = 2048
max_fsm_pages = 20000
max_fsm_relations = 1000
max_files_per_process = 1000
preload_libraries = ''
vacuum_cost_delay = 0
vacuum_cost_page_hit = 1
vacuum_cost_page_miss = 10
vacuum_cost_page_dirty = 20
vacuum_cost_limit = 200
bgwriter_delay = 200
bgwriter_lru_percent = 1.0
bgwriter_lru_maxpages = 5
bgwriter_all_percent = 0.333
bgwriter_all_maxpages = 5
fsync = on
wal_sync_method = fsync
full_page_writes = on
wal_buffers = 8
commit_delay = 0
commit_siblings = 5
checkpoint_segments = 3
checkpoint_timeout = 300
checkpoint_warning = 30
archive_command = ''
enable_bitmapscan = on
enable_hashagg = on
enable_hashjoin = on
enable_indexscan = on
enable_mergejoin = on
enable_nestloop = on
enable_seqscan = on
enable_sort = on
enable_tidscan = on
effective_cache_size = 1000
random_page_cost = 4
cpu_tuple_cost = 0.01
cpu_index_tuple_cost = 0.001
cpu_operator_cost = 0.0025
geqo = on
geqo_threshold = 12
geqo_effort = 5
geqo_pool_size = 0
geqo_generations = 0
geqo_selection_bias = 2.0
default_statistics_target = 10
constraint_exclusion = off
from_collapse_limit = 8
join_collapse_limit = 8
log_destination = 'stderr'
redirect_stderr = on
log_directory = '.'
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_truncate_on_rotation = off
log_rotation_age = 1440
log_rotation_size = 10240
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
client_min_messages = notice
log_min_messages = notice
log_error_verbosity = default
log_min_error_statement = panic
log_min_duration_statement = -1
silent_mode = off
debug_print_parse = off
debug_print_rewritten = off
debug_print_plan = off
debug_pretty_print = off
log_connections = off
log_disconnections = off
log_duration = off
log_line_prefix = ''
log_statement = 'none'
log_hostname = off
log_parser_stats = off
log_planner_stats = off
log_executor_stats = off
log_statement_stats = off
stats_start_collector = on
stats_command_string = off
stats_block_level = off
stats_row_level = off
stats_reset_on_server_start = off
autovacuum = off
autovacuum_naptime = 60
autovacuum_vacuum_threshold = 1000
autovacuum_analyze_threshold = 500
autovacuum_vacuum_scale_factor = 0.4
autovacuum_analyze_scale_factor = 0.2
autovacuum_vacuum_cost_delay = -1
autovacuum_vacuum_cost_limit = -1
search_path = '\$user,public'
default_tablespace = ''
check_function_bodies = on
default_transaction_isolation = 'read committed'
default_transaction_read_only = on
statement_timeout = 0
datestyle = 'iso, mdy'
timezone = unknown
australian_timezones = on
extra_float_digits = 0
client_encoding = sql_ascii
lc_messages = 'C'
lc_monetary = 'C'
lc_numeric = 'C'
lc_time = 'C'
explain_pretty_print = on
dynamic_library_path = '\$libdir'
deadlock_timeout = 1000
max_locks_per_transaction = 64
add_missing_from = off
backslash_quote = safe_encoding
default_with_oids = off
escape_string_warning = off
regex_flavor = advanced
sql_inheritance = on
transform_null_equals = off
custom_variable_classes = 'foo'
";

$fullconf{'8.2'} = "external_pid_file = '(none)'
listen_addresses = 'localhost'
port = 5432
max_connections = 100
superuser_reserved_connections = 3
unix_socket_directory = ''
unix_socket_group = ''
unix_socket_permissions = 0777
bonjour_name = ''
authentication_timeout = 1min
ssl = off
password_encryption = on
db_user_namespace = off
krb_server_keyfile = ''
krb_srvname = 'postgres'
krb_server_hostname = ''
krb_caseins_users = off
tcp_keepalives_idle = 0
tcp_keepalives_interval = 0
tcp_keepalives_count = 0
shared_buffers = 1000
temp_buffers = 8MB
max_prepared_transactions = 5
work_mem = 1MB
maintenance_work_mem = 16MB
max_stack_depth = 2MB
max_fsm_pages = 1638400
max_fsm_relations = 1000
max_files_per_process = 1000
shared_preload_libraries = ''
vacuum_cost_delay = 0
vacuum_cost_page_hit = 1
vacuum_cost_page_miss = 10
vacuum_cost_page_dirty = 20
vacuum_cost_limit = 200
bgwriter_delay = 200ms
bgwriter_lru_percent = 1.0
bgwriter_lru_maxpages = 5
bgwriter_all_percent = 0.333
bgwriter_all_maxpages = 5
fsync = on
wal_sync_method = fsync
full_page_writes = on
wal_buffers = 64kB
commit_delay = 0
commit_siblings = 5
checkpoint_segments = 3
checkpoint_timeout = 5min
checkpoint_warning = 30s
archive_command = ''
archive_timeout = 0
enable_bitmapscan = on
enable_hashagg = on
enable_hashjoin = on
enable_indexscan = on
enable_mergejoin = on
enable_nestloop = on
enable_seqscan = on
enable_sort = on
enable_tidscan = on
seq_page_cost = 1.0
random_page_cost = 4.0
cpu_tuple_cost = 0.01
cpu_index_tuple_cost = 0.005
cpu_operator_cost = 0.0025
effective_cache_size = 128MB
geqo = on
geqo_threshold = 12
geqo_effort = 5
geqo_pool_size = 0
geqo_generations = 0
geqo_selection_bias = 2.0
default_statistics_target = 10
constraint_exclusion = off
from_collapse_limit = 8
join_collapse_limit = 8
log_destination = 'stderr'
redirect_stderr = on
log_directory = '.'
log_filename = 'postgresql-%Y-%m-%d_%H%M'
log_truncate_on_rotation = off
log_rotation_age = 1d
log_rotation_size = 10MB
syslog_facility = 'LOCAL0'
syslog_ident = 'postgres'
client_min_messages = notice
log_min_messages = notice
log_error_verbosity = default
log_min_error_statement = error
log_min_duration_statement = -1
silent_mode = off
debug_print_parse = off
debug_print_rewritten = off
debug_print_plan = off
debug_pretty_print = off
log_connections = off
log_disconnections = off
log_duration = off
log_line_prefix = ''
log_statement = 'none'
log_hostname = off
stats_command_string = on
update_process_title = on
stats_start_collector = on
stats_block_level = off
stats_row_level = off
stats_reset_on_server_start = off
log_parser_stats = off
log_planner_stats = off
log_executor_stats = off
log_statement_stats = off
autovacuum = off
autovacuum_naptime = 1min
autovacuum_vacuum_threshold = 500
autovacuum_analyze_threshold = 250
autovacuum_vacuum_scale_factor = 0.2
autovacuum_analyze_scale_factor = 0.1
autovacuum_freeze_max_age = 200000000
autovacuum_vacuum_cost_delay = -1
autovacuum_vacuum_cost_limit = -1
search_path = '\"\$user\",public'
default_tablespace = ''
check_function_bodies = on
default_transaction_isolation = 'read committed'
default_transaction_read_only = on
statement_timeout = 0
vacuum_freeze_min_age = 100000000
datestyle = 'iso, mdy'
timezone = unknown
timezone_abbreviations = 'Default'
extra_float_digits = 0
client_encoding = sql_ascii
lc_messages = 'C'
lc_monetary = 'C'
lc_numeric = 'C'
lc_time = 'C'
explain_pretty_print = on
dynamic_library_path = '\$libdir'
local_preload_libraries = ''
deadlock_timeout = 1s
max_locks_per_transaction = 64
add_missing_from = off
array_nulls = on
backslash_quote = safe_encoding
default_with_oids = off
escape_string_warning = on
standard_conforming_strings = off
regex_flavor = advanced
sql_inheritance = on
transform_null_equals = off
custom_variable_classes = 'foo'
";

# Test one particular upgrade (old version, new version)
sub do_upgrade {
    my $cur = $_[0];
    my $new = $_[1];

    # Write configuration file and start
    my $datadir = PgCommon::cluster_data_directory $cur, 'main';
    open F, ">/etc/postgresql/$cur/main/postgresql.conf" or 
        die "could not open /etc/postgresql/$cur/main/postgresql.conf";
    die "\$fullconf{$cur} is not defined" unless exists $fullconf{$cur};
    print F $fullconf{$cur};
    close F;
    # restore data directory, we just scribbled over it
    if ($cur ge '8.0') {
        PgCommon::set_conf_value $cur, 'main', 'postgresql.conf', 'data_directory', $datadir;
    }

    is ((exec_as 'postgres', "pg_ctlcluster $cur main start"), 0,
        'pg_ctlcluster start');
    like_program_out 'postgres', 'pg_lsclusters -h', 0, qr/$cur.*online/, 
        "Old $cur cluster is online";
        
    # Upgrade cluster
    like_program_out 0, "pg_upgradecluster -v $new $cur main", 0, qr/^Success/im;
    like_program_out 'postgres', 'pg_lsclusters -h', 0, qr/$new.*online/,
        "New $new cluster is online";

    is ((system "pg_dropcluster $cur main"), 0, "pg_dropcluster $cur main");

    is ((exec_as 'postgres', "pg_ctlcluster $new main stop 2>/dev/null"), 0,
        "Stopping new $new pg_ctlcluster");
}

# create cluster for oldest version
is ((system "pg_createcluster $MAJORS[0] main >/dev/null"), 0, "pg_createcluster $MAJORS[0] main");

# Loop over all but the latest major version
my @testversions = sort @MAJORS;
while ($#testversions) {
    my $cur = shift @testversions;
    my $new = $testversions[0];
    do_upgrade $cur, $new;
}

# remove latest cluster and directory
is ((system "pg_dropcluster $testversions[0] main"), 0, 'Dropping remaining cluster');

# now test a direct upgrade from oldest to newest, to also catch parameters
# which changed several times, like syslog -> redirect_stderr ->
# logging_collector
if ($#MAJORS > 1) {
    is ((system "pg_createcluster $MAJORS[0] main >/dev/null"), 0, "pg_createcluster $MAJORS[0] main");
    do_upgrade $MAJORS[0], $MAJORS[-1];
    is ((system "pg_dropcluster $testversions[0] main"), 0, 'Dropping remaining cluster');
} else {
    pass 'only two available versions, skipping tests...';
    for (my $i = 0; $i < 10; ++$i) {
        pass '...';
    }
}

check_clean;

# vim: filetype=perl