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
1=== modified file 'config.yaml'
2--- config.yaml 2014-02-04 21:48:28 +0000
3+++ config.yaml 2014-04-11 16:52:52 +0000
4@@ -20,7 +20,7 @@
5 type: string
6 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
7 query-cache-size:
8- default: -1
9+ default: 0
10 type: int
11 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.
12 max-connections:
13
14=== modified file 'hooks/config-changed'
15--- hooks/config-changed 2014-02-15 21:37:45 +0000
16+++ hooks/config-changed 2014-04-11 16:52:52 +0000
17@@ -112,11 +112,17 @@
18
19 check_call(['juju-log','-l','INFO','dataset size in bytes: %d' % dataset_bytes])
20
21-if configs['query-cache-size'] == -1 and configs['query-cache-type'] in ['ON','DEMAND']:
22- qcache_bytes = (dataset_bytes * 0.20)
23- qcache_bytes = int(qcache_bytes - (qcache_bytes % PAGE_SIZE))
24- configs['query-cache-size'] = qcache_bytes
25- dataset_bytes -= qcache_bytes
26+query_cache_size = configs.get('query-cache-size', 0)
27+
28+QUERY_CACHE_SIZE_FACTOR = (dataset_bytes * 0.20)
29+
30+if query_cache_size <= 0:
31+ if configs['query-cache-type'] in ('ON','DEMAND', ):
32+ query_cache_size = int(QUERY_CACHE_SIZE_FACTOR - (QUERY_CACHE_SIZE_FACTOR % PAGE_SIZE))
33+ else:
34+ query_cache_size = 0
35+
36+configs['query-cache-size'] = query_cache_size
37
38 # 5.5 allows the words, but not 5.1
39 if configs['query-cache-type'] == 'ON':
40@@ -127,7 +133,8 @@
41 configs['query-cache-type']=0
42
43 preferred_engines=configs['preferred-storage-engine'].split(',')
44-chunk_size = int(dataset_bytes / len(preferred_engines))
45+
46+chunk_size = int((dataset_bytes - query_cache_size)/len(preferred_engines))
47 configs['innodb-flush-log-at-trx-commit']=1
48 configs['sync-binlog']=1
49 if 'InnoDB' in preferred_engines:
50@@ -171,7 +178,7 @@
51 # You can copy this to one of:
52 # - "/etc/mysql/my.cnf" to set global options,
53 # - "~/.my.cnf" to set user-specific options.
54-#
55+#
56 # One can use all long options that the program supports.
57 # Run program with --help to get a list of available options and with
58 # --print-defaults to see which it would actually understand and use.
59@@ -326,7 +333,7 @@
60
61 need_restart = False
62 for target,content in targets.iteritems():
63- tdir = os.path.dirname(target)
64+ tdir = os.path.dirname(target)
65 if len(content) == 0 and os.path.exists(target):
66 os.unlink(target)
67 need_restart = True

Subscribers

People subscribed via source and target branches