Merge lp:~stub/charms/trusty/postgresql/bug-1415490-max_prepared_transactions into lp:charms/trusty/postgresql

Proposed by Stuart Bishop
Status: Merged
Merged at revision: 118
Proposed branch: lp:~stub/charms/trusty/postgresql/bug-1415490-max_prepared_transactions
Merge into: lp:charms/trusty/postgresql
Diff against target: 665 lines (+105/-87)
7 files modified
Makefile (+3/-1)
config.yaml (+72/-64)
hooks/helpers.py (+2/-4)
hooks/hooks.py (+14/-15)
hooks/test_hooks.py (+0/-1)
templates/postgresql.conf.tmpl (+13/-0)
test.py (+1/-2)
To merge this branch: bzr merge lp:~stub/charms/trusty/postgresql/bug-1415490-max_prepared_transactions
Reviewer Review Type Date Requested Status
Barry Price Approve
Review Queue (community) automated testing Needs Fixing
charmers Pending
Review via email: mp+250611@code.launchpad.net

Description of the change

Add some tunables needed for Launchpad and Landscape deployments.

Also remove a config item that has done nothing for ages, and remove beta
comments about the no-longer beta PostgreSQL 9.4.

To post a comment you must log in.
120. By Stuart Bishop

Fix unittests

Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-11056-results

review: Needs Fixing (automated testing)
121. By Stuart Bishop

delint

Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-11057-results

review: Needs Fixing (automated testing)
122. By Stuart Bishop

delint

Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-11059-results

review: Needs Fixing (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-11094-results

review: Needs Fixing (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

This items has failed automated testing! Results available here http://reports.vapour.ws/charm-tests/charm-bundle-test-11099-results

review: Needs Fixing (automated testing)
123. By Stuart Bishop

Checkpoint tuning options

Revision history for this message
Barry Price (barryprice) wrote :

Looks good to me, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2014-10-24 06:31:15 +0000
+++ Makefile 2015-03-12 10:18:52 +0000
@@ -34,6 +34,7 @@
34 trial test.PG91Tests34 trial test.PG91Tests
35 trial test.PG92Tests35 trial test.PG92Tests
36 trial test.PG93Tests36 trial test.PG93Tests
37 trial test.PG94Tests
3738
38integration_test_91:39integration_test_91:
39 @echo "PostgreSQL 9.1 integration tests, ${SERIES}"40 @echo "PostgreSQL 9.1 integration tests, ${SERIES}"
@@ -48,13 +49,14 @@
48 trial test.PG93Tests49 trial test.PG93Tests
4950
50integration_test_94:51integration_test_94:
51 @echo "PostgreSQL 9.4 (beta) integration tests, ${SERIES}"52 @echo "PostgreSQL 9.4 integration tests, ${SERIES}"
52 trial test.PG94Tests53 trial test.PG94Tests
5354
54lint:55lint:
55 @echo "Lint check (flake8)"56 @echo "Lint check (flake8)"
56 @flake8 -v \57 @flake8 -v \
57 --exclude hooks/charmhelpers,hooks/_trial_temp \58 --exclude hooks/charmhelpers,hooks/_trial_temp \
59 --ignore=E402 \
58 hooks testing tests test.py60 hooks testing tests test.py
5961
60sync:62sync:
6163
=== modified file 'config.yaml'
--- config.yaml 2015-02-11 21:05:42 +0000
+++ config.yaml 2015-03-12 10:18:52 +0000
@@ -2,7 +2,7 @@
2 admin_addresses:2 admin_addresses:
3 default: ""3 default: ""
4 type: string4 type: string
5 description: |5 description: >
6 A comma-separated list of IP Addresses (or single IP) admin tools like 6 A comma-separated list of IP Addresses (or single IP) admin tools like
7 pgAdmin3 will connect from, this is most useful for developers running 7 pgAdmin3 will connect from, this is most useful for developers running
8 juju in local mode who need to connect tools like pgAdmin to a postgres. 8 juju in local mode who need to connect tools like pgAdmin to a postgres.
@@ -12,14 +12,14 @@
12 locale:12 locale:
13 default: "C"13 default: "C"
14 type: string14 type: string
15 description: |15 description: >
16 Locale of service, defining language, default collation order,16 Locale of service, defining language, default collation order,
17 and default formatting of numbers, currency, dates & times. Can only be17 and default formatting of numbers, currency, dates & times. Can only be
18 set when deploying the first unit of a service.18 set when deploying the first unit of a service.
19 encoding:19 encoding:
20 default: "UTF-8"20 default: "UTF-8"
21 type: string21 type: string
22 description: |22 description: >
23 Default encoding used to store text in this service. Can only be23 Default encoding used to store text in this service. Can only be
24 set when deploying the first unit of a service.24 set when deploying the first unit of a service.
25 extra-packages:25 extra-packages:
@@ -29,23 +29,12 @@
29 dumpfile_location:29 dumpfile_location:
30 default: "None"30 default: "None"
31 type: string31 type: string
32 description: |32 description: >
33 Path to a dumpfile to load into DB when service is initiated.33 Path to a dumpfile to load into DB when service is initiated.
34 config_change_command:
35 default: "reload"
36 type: string
37 description: |
38 The command to run whenever config has changed. Accepted values
39 are "reload" or "restart" - any other value will mean neither is
40 executed after a config change (which may be desired, if you're
41 running a production server and would rather handle these out of
42 band). Note that postgresql will still need to be reloaded
43 whenever authentication and access details are updated, so
44 disabling either doesn't mean PostgreSQL will never be reloaded.
45 version:34 version:
46 default: null35 default: null
47 type: string36 type: string
48 description: |37 description: >
49 Version of PostgreSQL that we want to install. Supported versions38 Version of PostgreSQL that we want to install. Supported versions
50 are "9.1", "9.2", "9.3". The default version for the deployed Ubuntu39 are "9.1", "9.2", "9.3". The default version for the deployed Ubuntu
51 release is used when the version is not specified.40 release is used when the version is not specified.
@@ -65,6 +54,13 @@
65 default: 10054 default: 100
66 type: int55 type: int
67 description: Maximum number of connections to allow to the PG database56 description: Maximum number of connections to allow to the PG database
57 max_prepared_transactions:
58 default: 0
59 type: int
60 description: >
61 Maximum number of prepared two phase commit transactions, waiting
62 to be committed. Defaults to 0. as using two phase commit without
63 a process to monitor and resolve lost transactions is dangerous.
68 ssl:64 ssl:
69 default: "True"65 default: "True"
70 type: string66 type: string
@@ -72,7 +68,7 @@
72 log_min_duration_statement:68 log_min_duration_statement:
73 default: -169 default: -1
74 type: int70 type: int
75 description: |71 description: >
76 -1 is disabled, 0 logs all statements72 -1 is disabled, 0 logs all statements
77 and their durations, > 0 logs only73 and their durations, > 0 logs only
78 statements running at least this number74 statements running at least this number
@@ -92,7 +88,7 @@
92 log_temp_files:88 log_temp_files:
93 default: "-1"89 default: "-1"
94 type: string90 type: string
95 description: |91 description: >
96 Log creation of temporary files larger than the threshold.92 Log creation of temporary files larger than the threshold.
97 -1 disables the feature, 0 logs all temporary files, or specify93 -1 disables the feature, 0 logs all temporary files, or specify
98 the threshold size with an optional unit (eg. "512KB", default94 the threshold size with an optional unit (eg. "512KB", default
@@ -131,13 +127,13 @@
131 autovacuum:127 autovacuum:
132 default: True128 default: True
133 type: boolean129 type: boolean
134 description: |130 description: >
135 Autovacuum should almost always be running. If you want to turn this131 Autovacuum should almost always be running. If you want to turn this
136 off, you are probably following out of date documentation.132 off, you are probably following out of date documentation.
137 log_autovacuum_min_duration:133 log_autovacuum_min_duration:
138 default: -1134 default: -1
139 type: int135 type: int
140 description: |136 description: >
141 -1 disables, 0 logs all actions and their durations, > 0 logs only137 -1 disables, 0 logs all actions and their durations, > 0 logs only
142 actions running at least this number of milliseconds.138 actions running at least this number of milliseconds.
143 autovacuum_analyze_threshold:139 autovacuum_analyze_threshold:
@@ -155,13 +151,13 @@
155 autovacuum_vacuum_cost_delay:151 autovacuum_vacuum_cost_delay:
156 default: "20ms"152 default: "20ms"
157 type: string153 type: string
158 description: |154 description: >
159 Default vacuum cost delay for autovacuum, in milliseconds;155 Default vacuum cost delay for autovacuum, in milliseconds;
160 -1 means use vacuum_cost_delay156 -1 means use vacuum_cost_delay
161 search_path:157 search_path:
162 default: "\"$user\",public"158 default: "\"$user\",public"
163 type: string159 type: string
164 description: |160 description: >
165 Comma separated list of schema names for161 Comma separated list of schema names for
166 the default SQL search path.162 the default SQL search path.
167 standard_conforming_strings:163 standard_conforming_strings:
@@ -171,22 +167,21 @@
171 hot_standby:167 hot_standby:
172 default: False168 default: False
173 type: boolean169 type: boolean
174 description: |170 description: >
175 DEPRECATED.
176 Hot standby or warm standby. When True, queries can be run against171 Hot standby or warm standby. When True, queries can be run against
177 the database when in recovery or standby mode (ie. replicated).172 the database when in recovery or standby mode (ie. replicated).
178 Overridden when service contains multiple units.173 Overridden when service contains multiple units.
179 hot_standby_feedback:174 hot_standby_feedback:
180 default: False175 default: False
181 type: boolean176 type: boolean
182 description: |177 description: >
183 Hot standby feedback, informing a master about in progress178 Hot standby feedback, informing a master about in progress
184 transactions on a streaming hot standby and allowing the master to179 transactions on a streaming hot standby and allowing the master to
185 defer cleanup and avoid query cancelations on the hot standby.180 defer cleanup and avoid query cancelations on the hot standby.
186 wal_level:181 wal_level:
187 default: minimal182 default: minimal
188 type: string183 type: string
189 description: |184 description: >
190 'minimal', 'archive' or 'hot_standby'. Defines how much information185 'minimal', 'archive' or 'hot_standby'. Defines how much information
191 is written to the WAL. Set to 'minimal' for stand alone databases186 is written to the WAL. Set to 'minimal' for stand alone databases
192 and 'hot_standby' for replicated setups. Overridden by juju when187 and 'hot_standby' for replicated setups. Overridden by juju when
@@ -194,7 +189,7 @@
194 max_wal_senders:189 max_wal_senders:
195 default: 0190 default: 0
196 type: int191 type: int
197 description: |192 description: >
198 Maximum number of hot standbys that can connect using193 Maximum number of hot standbys that can connect using
199 streaming replication. Set this to the expected maximum number of194 streaming replication. Set this to the expected maximum number of
200 hot standby units to avoid unnecessary blocking and database restarts.195 hot standby units to avoid unnecessary blocking and database restarts.
@@ -202,7 +197,7 @@
202 wal_keep_segments:197 wal_keep_segments:
203 default: 0198 default: 0
204 type: int199 type: int
205 description: |200 description: >
206 Number of old WAL files to keep, providing a larger buffer for201 Number of old WAL files to keep, providing a larger buffer for
207 streaming hot standbys to catch up from when lagged. Each WAL file202 streaming hot standbys to catch up from when lagged. Each WAL file
208 is 16MB in size. The WAL files are the buffer of how far a203 is 16MB in size. The WAL files are the buffer of how far a
@@ -212,7 +207,7 @@
212 replicated_wal_keep_segments:207 replicated_wal_keep_segments:
213 default: 5000208 default: 5000
214 type: int209 type: int
215 description: |210 description: >
216 Value of wal_keep_segments used when this service is replicated.211 Value of wal_keep_segments used when this service is replicated.
217 This setting only exists to provide a sane default when replication212 This setting only exists to provide a sane default when replication
218 is requested (so it doesn't fail) and nobody bothered to change the213 is requested (so it doesn't fail) and nobody bothered to change the
@@ -220,7 +215,7 @@
220 archive_mode:215 archive_mode:
221 default: False216 default: False
222 type: boolean217 type: boolean
223 description: |218 description: >
224 Enable archiving of WAL files using the command specified by219 Enable archiving of WAL files using the command specified by
225 archive_command. If archive_mode is enabled and archive_command not220 archive_command. If archive_mode is enabled and archive_command not
226 set, then archiving is deferred until archive_command is set and the221 set, then archiving is deferred until archive_command is set and the
@@ -228,25 +223,25 @@
228 archive_command:223 archive_command:
229 default: ""224 default: ""
230 type: string225 type: string
231 description: |226 description: >
232 Command used to archive WAL files when archive_mode is set and227 Command used to archive WAL files when archive_mode is set and
233 wal_level > minimal.228 wal_level > minimal.
234 work_mem:229 work_mem:
235 default: "1MB"230 default: "1MB"
236 type: string231 type: string
237 description: |232 description: >
238 Working Memory.233 Working Memory.
239 Ignored unless 'performance_tuning' is set to 'manual'.234 Ignored unless 'performance_tuning' is set to 'manual'.
240 maintenance_work_mem:235 maintenance_work_mem:
241 default: "1MB"236 default: "1MB"
242 type: string237 type: string
243 description: |238 description: >
244 Maintenance working memory.239 Maintenance working memory.
245 Ignored unless 'performance_tuning' is set to 'manual'.240 Ignored unless 'performance_tuning' is set to 'manual'.
246 performance_tuning:241 performance_tuning:
247 default: "Mixed"242 default: "Mixed"
248 type: string243 type: string
249 description: |244 description: >
250 Possible values here are "manual", "DW" (data warehouse),245 Possible values here are "manual", "DW" (data warehouse),
251 "OLTP" (online transaction processing), "Web" (web application),246 "OLTP" (online transaction processing), "Web" (web application),
252 "Desktop" or "Mixed". When this is set to a value other than247 "Desktop" or "Mixed". When this is set to a value other than
@@ -267,14 +262,14 @@
267 shared_buffers:262 shared_buffers:
268 default: ""263 default: ""
269 type: string264 type: string
270 description: |265 description: >
271 The amount of memory the database server uses for shared memory266 The amount of memory the database server uses for shared memory
272 buffers. This string should be of the format '###MB'.267 buffers. This string should be of the format '###MB'.
273 Ignored unless 'performance_tuning' is set to 'manual'.268 Ignored unless 'performance_tuning' is set to 'manual'.
274 effective_cache_size:269 effective_cache_size:
275 default: ""270 default: ""
276 type: string271 type: string
277 description: |272 description: >
278 Effective cache size is an estimate of how much memory is available for273 Effective cache size is an estimate of how much memory is available for
279 disk caching within the database. (50% to 75% of system memory). This274 disk caching within the database. (50% to 75% of system memory). This
280 string should be of the format '###MB'. Ignored unless275 string should be of the format '###MB'. Ignored unless
@@ -282,52 +277,65 @@
282 default_statistics_target:277 default_statistics_target:
283 default: -1278 default: -1
284 type: int279 type: int
285 description: |280 description: >
286 Sets the default statistics target for table columns without a281 Sets the default statistics target for table columns without a
287 column-specific target set via ALTER TABLE SET STATISTICS.282 column-specific target set via ALTER TABLE SET STATISTICS.
288 Leave unchanged to use the server default, which in recent283 Leave unchanged to use the server default, which in recent
289 releases is 100. Ignored unless 'performance_tuning' is 'manual'.284 releases is 100. Ignored unless 'performance_tuning' is 'manual'.
290 Larger values increase the time needed to do ANALYZE, but285 Larger values increase the time needed to do ANALYZE, but
291 might improve the quality of the planner's estimates.286 might improve the quality of the planner's estimates.
287 collapse_limit:
288 default: -1
289 type: int
290 description: >
291 Sets the from_collapse_limit and join_collapse_limit query planner
292 options, controlling the maximum number of tables that can be joined
293 before the turns off the table collapse query optimization.
292 temp_buffers:294 temp_buffers:
293 default: "1MB"295 default: "1MB"
294 type: string296 type: string
295 description: |297 description: >
296 The maximum number of temporary buffers used by each database session.298 The maximum number of temporary buffers used by each database session.
297 wal_buffers:299 wal_buffers:
298 default: "-1"300 default: "-1"
299 type: string301 type: string
300 description: |302 description: >
301 min 32kB, -1 sets based on shared_buffers (change requires restart).303 min 32kB, -1 sets based on shared_buffers (change requires restart).
302 Ignored unless 'performance_tuning' is set to 'manual'.304 Ignored unless 'performance_tuning' is set to 'manual'.
303 checkpoint_segments:305 checkpoint_segments:
304 default: 3306 default: 10
305 type: int307 type: int
306 description: |308 description: >
307 in logfile segments, min 1, 16MB each.309 in logfile segments, min 1, 16MB each.
308 Ignored unless 'performance_tuning' is set to 'manual'.310 Ignored unless 'performance_tuning' is set to 'manual'.
311 checkpoint_completion_target:
312 default: 0.9
313 type: float
314 description: >
315 checkpoint target duration time, as a fraction of checkpoint_timeout.
316 Range [0.0, 1.0].
309 checkpoint_timeout:317 checkpoint_timeout:
310 default: ""318 default: ""
311 type: string319 type: string
312 description: |320 description: >
313 Maximum time between automatic WAL checkpoints. range '30s-1h'.321 Maximum time between automatic WAL checkpoints. range '30s-1h'.
314 If left empty, the default postgresql value will be used.322 If left empty, the default postgresql value will be used.
315 fsync:323 fsync:
316 type: boolean324 type: boolean
317 default: True325 default: True
318 description: |326 description: >
319 Turns forced synchronization on/off. If fsync is turned off, database327 Turns forced synchronization on/off. If fsync is turned off, database
320 failures are likely to involve database corruption and require328 failures are likely to involve database corruption and require
321 recreating the unit329 recreating the unit
322 synchronous_commit:330 synchronous_commit:
323 type: boolean331 type: boolean
324 default: True332 default: True
325 description: |333 description: >
326 Immediate fsync after commit.334 Immediate fsync after commit.
327 full_page_writes:335 full_page_writes:
328 type: boolean336 type: boolean
329 default: True337 default: True
330 description: |338 description: >
331 Recover from partial page writes.339 Recover from partial page writes.
332 random_page_cost:340 random_page_cost:
333 default: 4.0341 default: 4.0
@@ -336,7 +344,7 @@
336 extra_pg_auth:344 extra_pg_auth:
337 type: string345 type: string
338 default: ""346 default: ""
339 description: |347 description: >
340 A comma separated extra pg_hba.conf auth rules.348 A comma separated extra pg_hba.conf auth rules.
341 This will be written to the pg_hba.conf file, one line per rule.349 This will be written to the pg_hba.conf file, one line per rule.
342 Note that this should not be needed as db relations already create350 Note that this should not be needed as db relations already create
@@ -348,7 +356,7 @@
348 manual_replication:356 manual_replication:
349 type: boolean357 type: boolean
350 default: False358 default: False
351 description: |359 description: >
352 Enable or disable charm managed replication. When manual_replication360 Enable or disable charm managed replication. When manual_replication
353 is True, the operator is responsible for maintaining recovery.conf361 is True, the operator is responsible for maintaining recovery.conf
354 and performing any necessary database mirroring. The charm will362 and performing any necessary database mirroring. The charm will
@@ -372,7 +380,7 @@
372 nagios_context:380 nagios_context:
373 default: "juju"381 default: "juju"
374 type: string382 type: string
375 description: |383 description: >
376 Used by the nrpe-external-master subordinate charm.384 Used by the nrpe-external-master subordinate charm.
377 A string that will be prepended to instance name to set the host name385 A string that will be prepended to instance name to set the host name
378 in nagios. So for instance the hostname would be something like:386 in nagios. So for instance the hostname would be something like:
@@ -382,14 +390,14 @@
382 nagios_additional_servicegroups:390 nagios_additional_servicegroups:
383 default: ""391 default: ""
384 type: string392 type: string
385 description: |393 description: >
386 Used by the nrpe-external-master subordinate charm.394 Used by the nrpe-external-master subordinate charm.
387 A comma-separated list of servicegroups to include along with395 A comma-separated list of servicegroups to include along with
388 nagios_context when generating nagios service check configs.396 nagios_context when generating nagios service check configs.
389 This is useful for nagios installations where servicegroups397 This is useful for nagios installations where servicegroups
390 are used to apply special treatment to particular checks.398 are used to apply special treatment to particular checks.
391 pgdg:399 pgdg:
392 description: |400 description: >
393 Enable the PostgreSQL Global Development Group APT repository401 Enable the PostgreSQL Global Development Group APT repository
394 (https://wiki.postgresql.org/wiki/Apt). This package source provides402 (https://wiki.postgresql.org/wiki/Apt). This package source provides
395 official PostgreSQL packages for Ubuntu LTS releases beyond those403 official PostgreSQL packages for Ubuntu LTS releases beyond those
@@ -397,13 +405,13 @@
397 type: boolean405 type: boolean
398 default: false406 default: false
399 install_sources:407 install_sources:
400 description: |408 description: >
401 List of extra package sources, per charm-helpers standard.409 List of extra package sources, per charm-helpers standard.
402 YAML format.410 YAML format.
403 type: string411 type: string
404 default: null412 default: null
405 install_keys:413 install_keys:
406 description: |414 description: >
407 List of signing keys for install_sources package sources, per415 List of signing keys for install_sources package sources, per
408 charmhelpers standard. YAML format.416 charmhelpers standard. YAML format.
409 type: string417 type: string
@@ -411,12 +419,12 @@
411 extra_archives:419 extra_archives:
412 default: ""420 default: ""
413 type: string421 type: string
414 description: |422 description: >
415 DEPRECATED & IGNORED. Use install_sources and install_keys. 423 DEPRECATED & IGNORED. Use install_sources and install_keys.
416 advisory_lock_restart_key:424 advisory_lock_restart_key:
417 default: 765425 default: 765
418 type: int426 type: int
419 description: |427 description: >
420 An advisory lock key used internally by the charm. You do not need428 An advisory lock key used internally by the charm. You do not need
421 to change it unless it happens to conflict with an advisory lock key429 to change it unless it happens to conflict with an advisory lock key
422 being used by your applications.430 being used by your applications.
@@ -424,7 +432,7 @@
424 swiftwal_container_prefix:432 swiftwal_container_prefix:
425 type: string433 type: string
426 default: null434 default: null
427 description: |435 description: >
428 EXPERIMENTAL.436 EXPERIMENTAL.
429 Swift container prefix for SwiftWAL to use. Must be set if any437 Swift container prefix for SwiftWAL to use. Must be set if any
430 SwiftWAL features are enabled. This will become a simple438 SwiftWAL features are enabled. This will become a simple
@@ -433,13 +441,13 @@
433 swiftwal_backup_schedule:441 swiftwal_backup_schedule:
434 type: string442 type: string
435 default: null443 default: null
436 description: |444 description: >
437 EXPERIMENTAL.445 EXPERIMENTAL.
438 Cron-formatted schedule for SwiftWAL database backups.446 Cron-formatted schedule for SwiftWAL database backups.
439 swiftwal_backup_retention:447 swiftwal_backup_retention:
440 type: int448 type: int
441 default: 2449 default: 2
442 description: |450 description: >
443 EXPERIMENTAL.451 EXPERIMENTAL.
444 Number of recent base backups to retain. You need enough space in452 Number of recent base backups to retain. You need enough space in
445 Swift for this many backups plus one more, as an old backup will only453 Swift for this many backups plus one more, as an old backup will only
@@ -447,7 +455,7 @@
447 swiftwal_log_shipping:455 swiftwal_log_shipping:
448 type: boolean456 type: boolean
449 default: false457 default: false
450 description: |458 description: >
451 EXPERIMENTAL.459 EXPERIMENTAL.
452 Archive WAL files into Swift. If swiftwal_backup_schedule is set,460 Archive WAL files into Swift. If swiftwal_backup_schedule is set,
453 allows point-in-time recovery and WAL files are removed461 allows point-in-time recovery and WAL files are removed
@@ -474,7 +482,7 @@
474 wal_e_backup_schedule:482 wal_e_backup_schedule:
475 type: string483 type: string
476 default: "13 0 * * *"484 default: "13 0 * * *"
477 description: |485 description: >
478 EXPERIMENTAL.486 EXPERIMENTAL.
479 Cron-formatted schedule for WAL-E database backups. If487 Cron-formatted schedule for WAL-E database backups. If
480 wal_e_backup_schedule is unset, WAL files will never be removed from488 wal_e_backup_schedule is unset, WAL files will never be removed from
@@ -482,7 +490,7 @@
482 wal_e_backup_retention:490 wal_e_backup_retention:
483 type: int491 type: int
484 default: 2492 default: 2
485 description: |493 description: >
486 EXPERIMENTAL.494 EXPERIMENTAL.
487 Number of recent base backups and WAL files to retain.495 Number of recent base backups and WAL files to retain.
488 You need enough space for this many backups plus one more, as496 You need enough space for this many backups plus one more, as
@@ -491,7 +499,7 @@
491 streaming_replication:499 streaming_replication:
492 type: boolean500 type: boolean
493 default: true501 default: true
494 description: |502 description: >
495 Enable streaming replication. Normally, streaming replication is503 Enable streaming replication. Normally, streaming replication is
496 always used, and any log shipping configured is used as a fallback.504 always used, and any log shipping configured is used as a fallback.
497 Turning this off without configuring log shipping is an error.505 Turning this off without configuring log shipping is an error.
@@ -530,7 +538,7 @@
530 package_status:538 package_status:
531 default: "install"539 default: "install"
532 type: string540 type: string
533 description: |541 description: >
534 The status of service-affecting packages will be set to this542 The status of service-affecting packages will be set to this
535 value in the dpkg database. Useful valid values are "install"543 value in the dpkg database. Useful valid values are "install"
536 and "hold".544 and "hold".
@@ -538,13 +546,13 @@
538 metrics_target:546 metrics_target:
539 default: ""547 default: ""
540 type: string548 type: string
541 description: |549 description: >
542 Destination for statsd-format metrics, format "host:port". If550 Destination for statsd-format metrics, format "host:port". If
543 not present and valid, metrics disabled.551 not present and valid, metrics disabled.
544 metrics_prefix:552 metrics_prefix:
545 default: "dev.$UNIT.postgresql"553 default: "dev.$UNIT.postgresql"
546 type: string554 type: string
547 description: |555 description: >
548 Prefix for metrics. Special value $UNIT can be used to include the556 Prefix for metrics. Special value $UNIT can be used to include the
549 name of the unit in the prefix.557 name of the unit in the prefix.
550 metrics_sample_interval:558 metrics_sample_interval:
551559
=== modified file 'hooks/helpers.py'
--- hooks/helpers.py 2012-10-01 14:10:14 +0000
+++ hooks/helpers.py 2015-03-12 10:18:52 +0000
@@ -17,8 +17,7 @@
17 'wait_for_machine',17 'wait_for_machine',
18 'wait_for_page_contents',18 'wait_for_page_contents',
19 'wait_for_relation',19 'wait_for_relation',
20 'wait_for_unit',20 'wait_for_unit']
21 ]
2221
23from contextlib import contextmanager22from contextlib import contextmanager
24import json23import json
@@ -26,8 +25,7 @@
26from shelltoolbox import (25from shelltoolbox import (
27 command,26 command,
28 run,27 run,
29 script_name,28 script_name)
30 )
31import os29import os
32import tempfile30import tempfile
33import time31import time
3432
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2015-03-08 23:51:59 +0000
+++ hooks/hooks.py 2015-03-12 10:18:52 +0000
@@ -22,8 +22,7 @@
22from charmhelpers import fetch22from charmhelpers import fetch
23from charmhelpers.core import hookenv, host23from charmhelpers.core import hookenv, host
24from charmhelpers.core.hookenv import (24from charmhelpers.core.hookenv import (
25 CRITICAL, ERROR, WARNING, INFO, DEBUG,25 CRITICAL, ERROR, WARNING, INFO, DEBUG)
26 )
2726
28try:27try:
29 import psycopg228 import psycopg2
@@ -212,8 +211,8 @@
212 log("ERROR: {}".format(p.returncode), ERROR)211 log("ERROR: {}".format(p.returncode), ERROR)
213 sys.exit(p.returncode)212 sys.exit(p.returncode)
214213
215 raise subprocess.CalledProcessError(214 raise subprocess.CalledProcessError(p.returncode, command,
216 p.returncode, command, '\n'.join(lines))215 '\n'.join(lines))
217216
218217
219def postgresql_is_running():218def postgresql_is_running():
@@ -447,7 +446,7 @@
447 open(template_file).read()).render(config_data)446 open(template_file).read()).render(config_data)
448 host.write_file(447 host.write_file(
449 config_file, pg_config,448 config_file, pg_config,
450 owner="postgres", group="postgres", perms=0600)449 owner="postgres", group="postgres", perms=0600)
451450
452 # Create or update files included from postgresql.conf.451 # Create or update files included from postgresql.conf.
453 configure_log_destination(os.path.dirname(config_file))452 configure_log_destination(os.path.dirname(config_file))
@@ -963,7 +962,7 @@
963 CRITICAL)962 CRITICAL)
964963
965 valid_workloads = [964 valid_workloads = [
966 'dw', 'oltp', 'web', 'mixed', 'desktop', 'manual', 'auto']965 'dw', 'oltp', 'web', 'mixed', 'desktop', 'manual', 'auto']
967 requested_workload = config_data['performance_tuning'].lower()966 requested_workload = config_data['performance_tuning'].lower()
968 if requested_workload not in valid_workloads:967 if requested_workload not in valid_workloads:
969 valid = False968 valid = False
@@ -2148,9 +2147,10 @@
21482147
2149 # Build the set of client relations that both the master and this2148 # Build the set of client relations that both the master and this
2150 # unit have joined.2149 # unit have joined.
2151 active_client_relations = set(2150 possible_client_relations = set(hookenv.relation_ids('db') +
2152 hookenv.relation_ids('db') + hookenv.relation_ids('db-admin')2151 hookenv.relation_ids('db-admin'))
2153 ).intersection(set(client_relations.split()))2152 active_client_relations = possible_client_relations.intersection(
2153 set(client_relations.split()))
21542154
2155 for client_relation in active_client_relations:2155 for client_relation in active_client_relations:
2156 # We need to pull the credentials from the master unit's2156 # We need to pull the credentials from the master unit's
@@ -2513,16 +2513,15 @@
2513 if len(relations) == 1 and 'nagios_hostname' in relations[0]:2513 if len(relations) == 1 and 'nagios_hostname' in relations[0]:
2514 nagios_hostname = relations[0]['nagios_hostname']2514 nagios_hostname = relations[0]['nagios_hostname']
2515 log("update_nrpe_checks: Obtained nagios_hostname ({}) "2515 log("update_nrpe_checks: Obtained nagios_hostname ({}) "
2516 "from nrpe-external-master relation.".format(2516 "from nrpe-external-master relation.".format(nagios_hostname))
2517 nagios_hostname))
2518 else:2517 else:
2519 unit = hookenv.local_unit()2518 unit = hookenv.local_unit()
2520 unit_name = unit.replace('/', '-')2519 unit_name = unit.replace('/', '-')
2521 nagios_hostname = "%s-%s" % (config_data['nagios_context'], unit_name)2520 nagios_hostname = "%s-%s" % (config_data['nagios_context'], unit_name)
2522 log("update_nrpe_checks: Deduced nagios_hostname ({}) from charm config "2521 log("update_nrpe_checks: Deduced nagios_hostname ({}) from charm "
2523 "(nagios_hostname not found in nrpe-external-master relation, or "2522 "config (nagios_hostname not found in nrpe-external-master "
2524 "wrong number of relations found)".format(2523 "relation, or wrong number of relations "
2525 nagios_hostname))2524 "found)".format(nagios_hostname))
25262525
2527 nrpe_service_file = \2526 nrpe_service_file = \
2528 '/var/lib/nagios/export/service__{}_check_pgsql.cfg'.format(2527 '/var/lib/nagios/export/service__{}_check_pgsql.cfg'.format(
25292528
=== modified file 'hooks/test_hooks.py'
--- hooks/test_hooks.py 2015-03-09 10:30:33 +0000
+++ hooks/test_hooks.py 2015-03-12 10:18:52 +0000
@@ -68,7 +68,6 @@
68 "encoding": "UTF-8",68 "encoding": "UTF-8",
69 "extra_packages": "",69 "extra_packages": "",
70 "dumpfile_location": "None",70 "dumpfile_location": "None",
71 "config_change_command": "reload",
72 "version": "9.1",71 "version": "9.1",
73 "cluster_name": "main",72 "cluster_name": "main",
74 "listen_ip": "*",73 "listen_ip": "*",
7574
=== modified file 'templates/postgresql.conf.tmpl'
--- templates/postgresql.conf.tmpl 2015-02-11 21:05:42 +0000
+++ templates/postgresql.conf.tmpl 2015-03-12 10:18:52 +0000
@@ -41,6 +41,9 @@
41max_connections = {{max_connections}}41max_connections = {{max_connections}}
42{% endif -%}42{% endif -%}
4343
44# Broken under all versions of Ubuntu, per Bug #1018307
45ssl_renegotiation_limit=0
46
4447
45#------------------------------------------------------------------------------48#------------------------------------------------------------------------------
46# RESOURCE USAGE (except WAL)49# RESOURCE USAGE (except WAL)
@@ -58,6 +61,9 @@
58{% if maintenance_work_mem != "" -%}61{% if maintenance_work_mem != "" -%}
59maintenance_work_mem = {{maintenance_work_mem}}62maintenance_work_mem = {{maintenance_work_mem}}
60{% endif -%}63{% endif -%}
64{% if max_prepared_transactions != "" -%}
65max_prepared_transactions = {{max_prepared_transactions}}
66{% endif -%}
6167
6268
63#------------------------------------------------------------------------------69#------------------------------------------------------------------------------
@@ -70,6 +76,9 @@
70{% if checkpoint_segments != "" -%}76{% if checkpoint_segments != "" -%}
71checkpoint_segments = {{checkpoint_segments}}77checkpoint_segments = {{checkpoint_segments}}
72{% endif -%}78{% endif -%}
79{% if checkpoint_completion_target != "" -%}
80checkpoint_completion_target = {{checkpoint_completion_target}}
81{% endif -%}
73{% if checkpoint_timeout != "" -%}82{% if checkpoint_timeout != "" -%}
74checkpoint_timeout = {{checkpoint_timeout}}83checkpoint_timeout = {{checkpoint_timeout}}
75{% endif -%}84{% endif -%}
@@ -97,6 +106,10 @@
97{% if default_statistics_target != -1 -%}106{% if default_statistics_target != -1 -%}
98default_statistics_target = {{default_statistics_target}}107default_statistics_target = {{default_statistics_target}}
99{% endif -%}108{% endif -%}
109{% if collapse_limit != -1 -%}
110from_collapse_limit = {{collapse_limit}}
111join_collapse_limit = {{collapse_limit}}
112{% endif -%}
100113
101114
102#------------------------------------------------------------------------------115#------------------------------------------------------------------------------
103116
=== modified file 'test.py'
--- test.py 2014-12-04 17:49:22 +0000
+++ test.py 2015-03-12 10:18:52 +0000
@@ -948,8 +948,7 @@
948class PG94Tests(948class PG94Tests(
949 PostgreSQLCharmBaseTestCase,949 PostgreSQLCharmBaseTestCase,
950 testtools.TestCase, fixtures.TestWithFixtures):950 testtools.TestCase, fixtures.TestWithFixtures):
951 # 9.4 is still in beta, with packages only available in the PGDG951 # 9.4 is released, but packages are only available in the PGDG archive.
952 # archive.
953 VERSION = '9.4'952 VERSION = '9.4'
954 PGDG = True953 PGDG = True
955954

Subscribers

People subscribed via source and target branches

to all changes: