Merge lp:~bellini666/charms/precise/postgresql/extra_options into lp:charms/postgresql

Proposed by Thiago Bellini
Status: Merged
Merged at revision: 96
Proposed branch: lp:~bellini666/charms/precise/postgresql/extra_options
Merge into: lp:charms/postgresql
Diff against target: 56 lines (+35/-0)
2 files modified
config.yaml (+23/-0)
templates/postgresql.conf.tmpl (+12/-0)
To merge this branch: bzr merge lp:~bellini666/charms/precise/postgresql/extra_options
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+219057@code.launchpad.net

Description of the change

Some extra options we set on one of our postgresql clusters.

Those are useful to tune the cluster performance a bit.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Thanks for this.

I think that, apart from checkpoint_timeout, the new options should be 'type: boolean' with a default matching the PostgreSQL default, the same as existing options like 'autovacuum' and 'log_checkpoints'. This will also let you remove the conditionals from the template.

I think that the fsync option should come with a warning, something along the lines of 'If fsync is turned off, database failures are likely to involve database corruption and require recreating the unit'. This is of course made clear in the PostgreSQL documentation, but I expect some juju users won't be reading that.

None of these options conflict with the recent landing of pgtune support, which is good.

I'm happy to land this branch with these changes, and they are simple enough that I can make the changes for you if you would rather.

review: Needs Fixing
Revision history for this message
Thiago Bellini (bellini666) wrote :

> Thanks for this.
>
> I think that, apart from checkpoint_timeout, the new options should be 'type:
> boolean' with a default matching the PostgreSQL default, the same as existing
> options like 'autovacuum' and 'log_checkpoints'. This will also let you remove
> the conditionals from the template.

Yes, I think it's better too. I didn't know that postgresql accepts true/false too. I though it should be on/off only.

But I'm still keeping the conditionals on the template to follow the convention there (all other options on the template, even boolean ones, are using the conditional)

>
> I think that the fsync option should come with a warning, something along the
> lines of 'If fsync is turned off, database failures are likely to involve
> database corruption and require recreating the unit'. This is of course made
> clear in the PostgreSQL documentation, but I expect some juju users won't be
> reading that.

haha np, done!

>
> None of these options conflict with the recent landing of pgtune support,
> which is good.
>
> I'm happy to land this branch with these changes, and they are simple enough
> that I can make the changes for you if you would rather.

I'm committing the changes right now. Thank you!

96. By Thiago Bellini

Allow to tune performance

Those options make it possible to tune the performance on postgresql.
Since they are empty, they will be left out of postgresql.conf unless
set by the user.

Revision history for this message
Stuart Bishop (stub) wrote :

All good. Landing.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-05-07 04:49:06 +0000
3+++ config.yaml 2014-05-13 21:06:27 +0000
4@@ -287,6 +287,29 @@
5 description: |
6 in logfile segments, min 1, 16MB each.
7 Ignored unless 'performance_tuning' is set to 'manual'.
8+ checkpoint_timeout:
9+ default: ""
10+ type: string
11+ description: |
12+ Maximum time between automatic WAL checkpoints. range '30s-1h'.
13+ If left empty, the default postgresql value will be used.
14+ fsync:
15+ type: boolean
16+ default: True
17+ description: |
18+ Turns forced synchronization on/off. If fsync is turned off, database
19+ failures are likely to involve database corruption and require
20+ recreating the unit
21+ synchronous_commit:
22+ type: boolean
23+ default: True
24+ description: |
25+ Immediate fsync after commit.
26+ full_page_writes:
27+ type: boolean
28+ default: True
29+ description: |
30+ Recover from partial page writes.
31 random_page_cost:
32 default: 4.0
33 type: float
34
35=== modified file 'templates/postgresql.conf.tmpl'
36--- templates/postgresql.conf.tmpl 2014-02-13 11:50:00 +0000
37+++ templates/postgresql.conf.tmpl 2014-05-13 21:06:27 +0000
38@@ -70,6 +70,18 @@
39 {% if checkpoint_segments != "" -%}
40 checkpoint_segments = {{checkpoint_segments}}
41 {% endif -%}
42+{% if checkpoint_timeout != "" -%}
43+checkpoint_timeout = {{checkpoint_timeout}}
44+{% endif -%}
45+{% if fsync != "" -%}
46+fsync = {{fsync}}
47+{% endif -%}
48+{% if synchronous_commit != "" -%}
49+synchronous_commit = {{synchronous_commit}}
50+{% endif -%}
51+{% if full_page_writes != "" -%}
52+full_page_writes = {{full_page_writes}}
53+{% endif -%}
54
55
56 #------------------------------------------------------------------------------

Subscribers

People subscribed via source and target branches