diff -Nru postgresql-common-168/debian/changelog postgresql-common-169git1/debian/changelog --- postgresql-common-168/debian/changelog 2015-05-21 09:28:51.000000000 +0000 +++ postgresql-common-169git1/debian/changelog 2015-06-06 10:16:23.000000000 +0000 @@ -1,3 +1,28 @@ +postgresql-common (169git1) wily; urgency=medium + + Upload current git head to fix autopkgtest regression. + + [ Christoph Berg ] + * t/025_logging.t: Improve syslog detection in the test environment. + * pg_upgradecluster, t/030_errors.t: Unbreak after we changed the old=new + error message. + * PgCommon.pm: make read_cluster_conf_file read postgresql.auto.conf as well + (Closes: #787154) + + -- Martin Pitt Sat, 06 Jun 2015 12:16:06 +0200 + +postgresql-common (169) unstable; urgency=medium + + * t/022_recovery.t: New recovery tests to catch regression in 9.4.2 and + 9.1.16. + * pg_upgradecluster: Set default dynamic_shared_memory_type = mmap. + (Closes: #784005) + * pg_upgradecluster: Complain if --link is used without --method=upgrade. + * pg_upgradecluster: Better error message when old and new version are + equal. + + -- Christoph Berg Thu, 04 Jun 2015 12:09:53 +0200 + postgresql-common (168) unstable; urgency=medium [ Martin Pitt ] diff -Nru postgresql-common-168/PgCommon.pm postgresql-common-169git1/PgCommon.pm --- postgresql-common-168/PgCommon.pm 2015-05-06 09:14:25.000000000 +0000 +++ postgresql-common-169git1/PgCommon.pm 2015-06-06 10:14:48.000000000 +0000 @@ -171,9 +171,20 @@ # Arguments: # Returns: hash (empty if the file does not exist) sub read_cluster_conf_file { - my $fname = "$confroot/$_[0]/$_[1]/$_[2]"; - -e $fname or $fname = "$common_confdir/$_[2]"; - return read_conf_file $fname; + my $fname = "$confroot/$_[0]/$_[1]/$_[2]"; + -e $fname or $fname = "$common_confdir/$_[2]"; + my %conf = read_conf_file $fname; + + if ($_[0] >= 9.4 and $_[2] eq 'postgresql.conf') { # merge settings changed by ALTER SYSTEM + # data_directory cannot be changed by ALTER SYSTEM + my $data_directory = $conf{data_directory} || "/var/lib/postgresql/$_[0]/$_[1]"; + my %auto_conf = read_conf_file "$data_directory/postgresql.auto.conf"; + foreach my $guc (keys %auto_conf) { + $conf{$guc} = $auto_conf{$guc}; + } + } + + return %conf; } # Return parameter from a PostgreSQL configuration file, or undef if the parameter diff -Nru postgresql-common-168/pg_upgradecluster postgresql-common-169git1/pg_upgradecluster --- postgresql-common-168/pg_upgradecluster 2015-05-06 09:14:25.000000000 +0000 +++ postgresql-common-169git1/pg_upgradecluster 2015-06-06 10:14:48.000000000 +0000 @@ -100,12 +100,12 @@ if ($c{'stats_block_level'} || $c{'stats_row_level'}) { deprecate \%c, 'stats_block_level', 'deprecated in favor of track_counts'; deprecate \%c, 'stats_row_level', 'deprecated in favor of track_counts'; - set 'track_counts', (config_bool $c{'stats_block_level'} || config_bool $c{'stats_row_level'}) ? 'yes' : 'no'; + set 'track_counts', (config_bool $c{'stats_block_level'} || config_bool $c{'stats_row_level'}) ? 'on' : 'off'; } # archive_command now has to be enabled explicitly if ($c{'archive_command'}) { - set 'archive_mode', 'yes'; + set 'archive_mode', 'on'; } } @@ -164,6 +164,18 @@ if ($newversion >= '9.4') { deprecate \%c, 'krb_srvname', 'native krb5 authentication deprecated in favor of GSSAPI'; + # d_s_m_t defaults to 'posix', but that has various problems. Pick a safer variant here + unless ($c{dynamic_shared_memory_type}) { + set 'dynamic_shared_memory_type', 'mmap'; + } + } + + if ($newversion >= '9.5') { + if ($c{checkpoint_segments}) { + my $max_wal_size = 16*$c{checkpoint_segments} . 'MB'; + rename_ \%c, 'checkpoint_segments', 'max_wal_size'; + set 'max_wal_size', $max_wal_size; + } } } @@ -233,7 +245,8 @@ # command line arguments -$newversion = get_newest_version; +my $newest_version = get_newest_version; +$newversion = $newest_version; my $method = 'dump'; my $link = 0; @@ -255,6 +268,7 @@ ) or exit 1; $method eq 'dump' or $method eq 'upgrade' or error 'method must be "dump" or "upgrade"'; +$link and $method eq 'dump' and error 'cannot use --link with --method=dump'; # untaint ($newversion) = $newversion =~ /^(\d+\.\d+)$/; @@ -279,14 +293,14 @@ my $datadir; ($datadir) = $ARGV[2] =~ /(.*)/ if defined $ARGV[2]; -error "Cannot upgrade from $version to $newversion. " . - "You should invoke pg_upgradecluster on a cluster with an old version." - if ($version eq $newversion and $cluster eq $newcluster); - error 'specified cluster does not exist' unless cluster_exists $version, $cluster; %info = cluster_info ($version, $cluster); error 'cluster is disabled' if $info{'start'} eq 'disabled'; +error "cluster $version/$cluster is already on version $newversion. " . + "(The newest version installed on this system is $newest_version.)" + if ($version eq $newversion and $cluster eq $newcluster); + if (cluster_exists $newversion, $newcluster) { error "target cluster $newversion/$newcluster already exists"; } diff -Nru postgresql-common-168/t/022_recovery.t postgresql-common-169git1/t/022_recovery.t --- postgresql-common-168/t/022_recovery.t 1970-01-01 00:00:00.000000000 +0000 +++ postgresql-common-169git1/t/022_recovery.t 2015-06-06 10:14:48.000000000 +0000 @@ -0,0 +1,53 @@ +# We create a cluster, stop it ungracefully, and check if recovery works. + +use strict; + +use POSIX qw/dup2/; +use Time::HiRes qw/usleep/; + +use lib 't'; +use TestLib; +use PgCommon; + +use Test::More tests => 19 * ($#MAJORS+1); + +sub check_major { + my $v = $_[0]; + note "Running tests for $v"; + + # create cluster + ok ((system "pg_createcluster $v main --start >/dev/null") == 0, + "pg_createcluster $v main"); + + # try an immediate shutdown and restart + ok ((system "pg_ctlcluster $v main stop -m i") == 0, + "pg_ctlcluster $v main stop -m i"); + ok ((system "pg_ctlcluster $v main start") == 0, + "pg_ctlcluster $v main start"); + ok ((exec_as 'postgres', "psql -c ''") == 0, + "psql"); + + # try again with an write-protected file + ok ((system "pg_ctlcluster $v main stop -m i") == 0, + "pg_ctlcluster $v main stop -m i"); + open F, ">/var/lib/postgresql/$v/main/foo"; + print F "moo\n"; + close F; + ok ((chmod 0444, "/var/lib/postgresql/$v/main/foo"), + "create write-protected file in data directory"); + ok ((system "pg_ctlcluster $v main start") == 0, + "pg_ctlcluster $v main start"); + ok ((exec_as 'postgres', "psql -c ''") == 0, + "psql"); + + ok ((system "pg_dropcluster $v main --stop") == 0, + 'pg_dropcluster removes cluster'); + + check_clean; +} + +foreach (@MAJORS) { + check_major $_; +} + +# vim: filetype=perl diff -Nru postgresql-common-168/t/025_logging.t postgresql-common-169git1/t/025_logging.t --- postgresql-common-168/t/025_logging.t 2015-05-06 09:14:25.000000000 +0000 +++ postgresql-common-169git1/t/025_logging.t 2015-06-06 10:14:48.000000000 +0000 @@ -8,6 +8,8 @@ use Test::More tests => 57 * ($#MAJORS+1); +my $syslog_works = 0; + sub check_logging ($$) { my ($text, $msg) = @_; @@ -38,7 +40,7 @@ is_program_out 'postgres', "psql -Atc \"show log_destination\"", 0, "syslog\n", 'log_destination is syslog'; check_logging qr($v main 5432 online postgres $pgdata syslog), "pg_lscluster reports syslog"; SKIP: { - skip "/var/log/syslog not readable", 2 unless (-r '/var/log/syslog'); + skip "/var/log/syslog not available", 2 unless ($syslog_works); like_program_out 0, "grep 'postgres.*parameter \"log_destination\" changed to \"syslog\"' /var/log/syslog", 0, qr/log_destination/, 'error appears in /var/log/syslog'; } @@ -60,7 +62,7 @@ like_program_out 'postgres', "psql -qc \"moo$$\"", 1, qr/syntax error.*moo$$/, 'log an error'; like_program_out 'postgres', "grep moo$$ $pgdata/pg_log/*.log", 0, qr/syntax error.*moo$$/, 'error appears in pg_log/*.log'; SKIP: { - skip "/var/log/syslog not readable", 2 unless (-r '/var/log/syslog'); + skip "/var/log/syslog not available", 2 unless ($syslog_works); like_program_out 0, "grep 'postgres.*moo$$' /var/log/syslog", 0, qr/moo$$/, 'error appears in /var/log/syslog'; } like_program_out 'postgres', "grep moo$$ $pgdata/pg_log/*.csv", 0, qr/syntax error.*moo$$/, 'error appears in pg_log/*.csv'; @@ -71,6 +73,14 @@ check_clean; } +system "logger -t '$0' 'test$$'"; +if (system ("grep -q 'test$$' /var/log/syslog") == 0) { + note 'Logging to /var/log/syslog works'; + $syslog_works = 1; +} else { + note 'Logging to /var/log/syslog does not work, skipping some syslog tests'; +} + foreach (@MAJORS) { check_major $_; } diff -Nru postgresql-common-168/t/030_errors.t postgresql-common-169git1/t/030_errors.t --- postgresql-common-168/t/030_errors.t 2015-05-06 09:14:25.000000000 +0000 +++ postgresql-common-169git1/t/030_errors.t 2015-06-06 10:14:48.000000000 +0000 @@ -29,7 +29,7 @@ my $outref; my $result = exec_as 0, $_[0], $outref; is $result, 1, "'$_[0]' fails"; - like $$outref, qr/(invalid version|does not exist|cannot upgrade)/i, "$_[0] gives error message about nonexisting cluster"; + like $$outref, qr/(invalid version|does not exist)/i, "$_[0] gives error message about nonexisting cluster"; unlike $$outref, qr/invalid symbolic link/i, "$_[0] does not print 'invalid symbolic link' gibberish"; } diff -Nru postgresql-common-168/t/060_obsolete_confparams.t postgresql-common-169git1/t/060_obsolete_confparams.t --- postgresql-common-168/t/060_obsolete_confparams.t 2015-05-06 09:14:25.000000000 +0000 +++ postgresql-common-169git1/t/060_obsolete_confparams.t 2015-06-06 10:14:48.000000000 +0000 @@ -1347,10 +1347,221 @@ #include = 'special.conf' "; +$fullconf{'9.4'} = "external_pid_file = '(none)' +listen_addresses = 'localhost' +port = 5437 +max_connections = 100 +superuser_reserved_connections = 3 +unix_socket_directories = '/var/run/postgresql' +unix_socket_group = '' +unix_socket_permissions = 0777 +bonjour = off +bonjour_name = '' +authentication_timeout = 1min +ssl = true +ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' +ssl_prefer_server_ciphers = on +ssl_ecdh_curve = 'prime256v1' +ssl_renegotiation_limit = 512MB +ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem' +ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key' +ssl_ca_file = '' +ssl_crl_file = '' +password_encryption = on +db_user_namespace = off +krb_server_keyfile = '' +krb_caseins_users = off +tcp_keepalives_idle = 0 +tcp_keepalives_interval = 0 +tcp_keepalives_count = 0 +shared_buffers = 128MB +huge_pages = try +temp_buffers = 8MB +max_prepared_transactions = 0 +work_mem = 4MB +maintenance_work_mem = 64MB +autovacuum_work_mem = -1 +max_stack_depth = 2MB +dynamic_shared_memory_type = posix +temp_file_limit = -1 +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_maxpages = 100 +bgwriter_lru_multiplier = 2.0 +effective_io_concurrency = 1 +max_worker_processes = 8 +wal_level = minimal +fsync = on +synchronous_commit = on +wal_sync_method = fsync +full_page_writes = on +wal_log_hints = off +wal_buffers = -1 +wal_writer_delay = 200ms +commit_delay = 0 +commit_siblings = 5 +checkpoint_segments = 3 +checkpoint_timeout = 5min +checkpoint_completion_target = 0.5 +checkpoint_warning = 30s +archive_mode = off +archive_command = '' +archive_timeout = 0 +max_wal_senders = 0 +wal_keep_segments = 0 +wal_sender_timeout = 60s +max_replication_slots = 0 +synchronous_standby_names = '' +vacuum_defer_cleanup_age = 0 +hot_standby = off +max_standby_archive_delay = 30s +max_standby_streaming_delay = 30s +wal_receiver_status_interval = 10s +hot_standby_feedback = off +wal_receiver_timeout = 60s +enable_bitmapscan = on +enable_hashagg = on +enable_hashjoin = on +enable_indexscan = on +enable_indexonlyscan = on +enable_material = 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 = 4GB +geqo = on +geqo_threshold = 12 +geqo_effort = 5 +geqo_pool_size = 0 +geqo_generations = 0 +geqo_selection_bias = 2.0 +geqo_seed = 0.0 +default_statistics_target = 100 +constraint_exclusion = partition +cursor_tuple_fraction = 0.1 +from_collapse_limit = 8 +join_collapse_limit = 8 +log_destination = 'stderr' +logging_collector = off +log_directory = 'pg_log' +log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' +log_file_mode = 0600 +log_truncate_on_rotation = off +log_rotation_age = 1d +log_rotation_size = 10MB +syslog_facility = 'LOCAL0' +syslog_ident = 'postgres' +event_source = 'PostgreSQL' +client_min_messages = notice +log_min_messages = warning +log_min_error_statement = error +log_min_duration_statement = -1 +debug_print_parse = off +debug_print_rewritten = off +debug_print_plan = off +debug_pretty_print = on +log_checkpoints = off +log_connections = off +log_disconnections = off +log_duration = off +log_error_verbosity = default +log_hostname = off +log_line_prefix = '%t [%p-%l] %q%u@%d ' +log_lock_waits = off +log_statement = 'none' +log_temp_files = -1 +log_timezone = 'CET' +track_activities = on +track_counts = on +track_io_timing = off +track_functions = none +track_activity_query_size = 1024 +update_process_title = on +stats_temp_directory = 'pg_stat_tmp' +log_parser_stats = off +log_planner_stats = off +log_executor_stats = off +log_statement_stats = off +autovacuum = on +log_autovacuum_min_duration = -1 +autovacuum_max_workers = 3 +autovacuum_naptime = 1min +autovacuum_vacuum_threshold = 50 +autovacuum_analyze_threshold = 50 +autovacuum_vacuum_scale_factor = 0.2 +autovacuum_analyze_scale_factor = 0.1 +autovacuum_freeze_max_age = 200000000 +autovacuum_multixact_freeze_max_age = 400000000 +autovacuum_vacuum_cost_delay = 20ms +autovacuum_vacuum_cost_limit = -1 +search_path = '\"\$user\",public' +default_tablespace = '' +temp_tablespaces = '' +check_function_bodies = on +default_transaction_isolation = 'read committed' +default_transaction_read_only = off +default_transaction_deferrable = off +session_replication_role = 'origin' +statement_timeout = 0 +lock_timeout = 0 +vacuum_freeze_min_age = 50000000 +vacuum_freeze_table_age = 150000000 +vacuum_multixact_freeze_min_age = 5000000 +vacuum_multixact_freeze_table_age = 150000000 +bytea_output = 'hex' +xmlbinary = 'base64' +xmloption = 'content' +datestyle = 'iso, dmy' +intervalstyle = 'postgres' +timezone = 'CET' +timezone_abbreviations = 'Default' +extra_float_digits = 0 +client_encoding = sql_ascii +lc_messages = 'C' +lc_monetary = 'C' +lc_numeric = 'C' +lc_time = 'C' +default_text_search_config = 'pg_catalog.german' +dynamic_library_path = '\$libdir' +local_preload_libraries = '' +session_preload_libraries = '' +deadlock_timeout = 1s +max_locks_per_transaction = 64 +max_pred_locks_per_transaction = 64 +array_nulls = on +backslash_quote = safe_encoding +default_with_oids = off +escape_string_warning = on +lo_compat_privileges = off +quote_all_identifiers = off +sql_inheritance = on +standard_conforming_strings = on +synchronize_seqscans = on +transform_null_equals = off +exit_on_error = off +restart_after_crash = on +#include_dir = 'conf.d' +include_if_exists = 'exists.conf' +#include = 'special.conf' +"; + # %fullconf generated using # sed -e 's/^#//' -e 's/[ \t]*#.*//g' /etc/postgresql/9.3/foo/postgresql.conf | grep '^[a-z]' # ... plus quoting of " and $ -# remove/comment data_directory, hba_file, ident_file, external_pid_file +# remove/comment data_directory, hba_file, ident_file, external_pid_file, include_dir, include # lc_* should be 'C' # Test one particular upgrade (old version, new version)