Merge lp:~niedbalski/charms/precise/mysql/lp-1296736 into lp:charms/mysql

Proposed by Jorge Niedbalski
Status: Merged
Merged at revision: 119
Proposed branch: lp:~niedbalski/charms/precise/mysql/lp-1296736
Merge into: lp:charms/mysql
Diff against target: 67 lines (+16/-9)
2 files modified
config.yaml (+1/-1)
hooks/config-changed (+15/-8)
To merge this branch: bzr merge lp:~niedbalski/charms/precise/mysql/lp-1296736
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Review via email: mp+214844@code.launchpad.net

Description of the change

Fix for bug #1296736

To post a comment you must log in.
118. By Jorge Niedbalski

[config-changed] if not ON, DEMAND , then set the value = 0

Revision history for this message
Charles Butler (lazypower) wrote :

Jorge,

Thank you for this patch! I've reviewed and deployed the code. It looks good to me. Merging this in and closing out the bugs as fixed-release.

This will show up in the store in ~ 15 to 30 minutes post merging. If you have any questions/comments/concerns about the review contact us in #juju on irc.freenode.net or email the mailing list <email address hidden>

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2014-02-04 21:48:28 +0000
+++ config.yaml 2014-04-11 16:52:52 +0000
@@ -20,7 +20,7 @@
20 type: string20 type: string
21 description: Query cache is usually a good idea, but can hurt concurrency. Valid values are "OFF", "ON", or "DEMAND". http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_query_cache_type21 description: Query cache is usually a good idea, but can hurt concurrency. Valid values are "OFF", "ON", or "DEMAND". http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_query_cache_type
22 query-cache-size:22 query-cache-size:
23 default: -123 default: 0
24 type: int24 type: int
25 description: Override the computed version from dataset-size. Still works if query-cache-type is "OFF" since sessions can override the cache type setting on their own.25 description: Override the computed version from dataset-size. Still works if query-cache-type is "OFF" since sessions can override the cache type setting on their own.
26 max-connections:26 max-connections:
2727
=== modified file 'hooks/config-changed'
--- hooks/config-changed 2014-02-15 21:37:45 +0000
+++ hooks/config-changed 2014-04-11 16:52:52 +0000
@@ -112,11 +112,17 @@
112112
113check_call(['juju-log','-l','INFO','dataset size in bytes: %d' % dataset_bytes])113check_call(['juju-log','-l','INFO','dataset size in bytes: %d' % dataset_bytes])
114114
115if configs['query-cache-size'] == -1 and configs['query-cache-type'] in ['ON','DEMAND']:115query_cache_size = configs.get('query-cache-size', 0)
116 qcache_bytes = (dataset_bytes * 0.20)116
117 qcache_bytes = int(qcache_bytes - (qcache_bytes % PAGE_SIZE))117QUERY_CACHE_SIZE_FACTOR = (dataset_bytes * 0.20)
118 configs['query-cache-size'] = qcache_bytes118
119 dataset_bytes -= qcache_bytes119if query_cache_size <= 0:
120 if configs['query-cache-type'] in ('ON','DEMAND', ):
121 query_cache_size = int(QUERY_CACHE_SIZE_FACTOR - (QUERY_CACHE_SIZE_FACTOR % PAGE_SIZE))
122 else:
123 query_cache_size = 0
124
125configs['query-cache-size'] = query_cache_size
120126
121# 5.5 allows the words, but not 5.1127# 5.5 allows the words, but not 5.1
122if configs['query-cache-type'] == 'ON':128if configs['query-cache-type'] == 'ON':
@@ -127,7 +133,8 @@
127 configs['query-cache-type']=0133 configs['query-cache-type']=0
128134
129preferred_engines=configs['preferred-storage-engine'].split(',')135preferred_engines=configs['preferred-storage-engine'].split(',')
130chunk_size = int(dataset_bytes / len(preferred_engines))136
137chunk_size = int((dataset_bytes - query_cache_size)/len(preferred_engines))
131configs['innodb-flush-log-at-trx-commit']=1138configs['innodb-flush-log-at-trx-commit']=1
132configs['sync-binlog']=1139configs['sync-binlog']=1
133if 'InnoDB' in preferred_engines:140if 'InnoDB' in preferred_engines:
@@ -171,7 +178,7 @@
171# You can copy this to one of:178# You can copy this to one of:
172# - "/etc/mysql/my.cnf" to set global options,179# - "/etc/mysql/my.cnf" to set global options,
173# - "~/.my.cnf" to set user-specific options.180# - "~/.my.cnf" to set user-specific options.
174# 181#
175# One can use all long options that the program supports.182# One can use all long options that the program supports.
176# Run program with --help to get a list of available options and with183# Run program with --help to get a list of available options and with
177# --print-defaults to see which it would actually understand and use.184# --print-defaults to see which it would actually understand and use.
@@ -326,7 +333,7 @@
326333
327need_restart = False334need_restart = False
328for target,content in targets.iteritems():335for target,content in targets.iteritems():
329 tdir = os.path.dirname(target) 336 tdir = os.path.dirname(target)
330 if len(content) == 0 and os.path.exists(target):337 if len(content) == 0 and os.path.exists(target):
331 os.unlink(target)338 os.unlink(target)
332 need_restart = True339 need_restart = True

Subscribers

People subscribed via source and target branches