Skip to content

Commit e3dec0a

Browse files
[MISC] Bump mysql charm lib version (#563)
1 parent 082fcd9 commit e3dec0a

File tree

5 files changed

+16
-45
lines changed

5 files changed

+16
-45
lines changed

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ options:
1313
profile:
1414
description: |
1515
profile representing the scope of deployment, and used to be able to enable high-level
16-
high-level customisation of sysconfigs, resource checks/allocation, warning levels, etc.
16+
customisation of sysconfigs, resource checks/allocation, warning levels, etc.
1717
Allowed values are: “production” and “testing”.
1818
type: string
1919
default: production

lib/charms/mysql/v0/mysql.py

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def wait_until_mysql_connection(self) -> None:
134134
# Increment this major API version when introducing breaking changes
135135
LIBAPI = 0
136136

137-
LIBPATCH = 77
137+
LIBPATCH = 79
138138

139139
UNIT_TEARDOWN_LOCKNAME = "unit-teardown"
140140
UNIT_ADD_LOCKNAME = "unit-add"
@@ -1003,10 +1003,11 @@ def render_mysqld_configuration( # noqa: C901
10031003
"innodb_buffer_pool_size": str(innodb_buffer_pool_size),
10041004
"log_error_services": "log_filter_internal;log_sink_internal",
10051005
"log_error": f"{snap_common}/var/log/mysql/error.log",
1006-
"general_log": "ON",
1006+
"general_log": "OFF",
10071007
"general_log_file": f"{snap_common}/var/log/mysql/general.log",
1008-
"slow_query_log_file": f"{snap_common}/var/log/mysql/slowquery.log",
1008+
"slow_query_log_file": f"{snap_common}/var/log/mysql/slow.log",
10091009
"binlog_expire_logs_seconds": f"{binlog_retention_seconds}",
1010+
"loose-audit_log_filter": "OFF",
10101011
"loose-audit_log_policy": "LOGINS",
10111012
"loose-audit_log_file": f"{snap_common}/var/log/mysql/audit.log",
10121013
}
@@ -2281,28 +2282,6 @@ def set_cluster_primary(self, new_primary_address: str) -> None:
22812282
logger.exception("Failed to set cluster primary")
22822283
raise MySQLSetClusterPrimaryError(e.message)
22832284

2284-
def get_cluster_members_addresses(self) -> Optional[Iterable[str]]:
2285-
"""Get the addresses of the cluster's members."""
2286-
get_cluster_members_commands = (
2287-
f"shell.connect('{self.instance_def(self.server_config_user)}')",
2288-
f"cluster = dba.get_cluster('{self.cluster_name}')",
2289-
"members = ','.join((member['address'] for member in cluster.describe()['defaultReplicaSet']['topology']))",
2290-
"print(f'<MEMBERS>{members}</MEMBERS>')",
2291-
)
2292-
2293-
try:
2294-
output = self._run_mysqlsh_script("\n".join(get_cluster_members_commands))
2295-
except MySQLClientError as e:
2296-
logger.warning("Failed to get cluster members addresses", exc_info=e)
2297-
raise MySQLGetClusterMembersAddressesError(e.message)
2298-
2299-
matches = re.search(r"<MEMBERS>(.+)</MEMBERS>", output)
2300-
2301-
if not matches:
2302-
return None
2303-
2304-
return set(matches.group(1).split(","))
2305-
23062285
def verify_server_upgradable(self, instance: Optional[str] = None) -> None:
23072286
"""Wrapper for API check_for_server_upgrade."""
23082287
# use cluster admin user to enforce standard port usage
@@ -2446,14 +2425,6 @@ def is_cluster_replica(self, from_instance: Optional[str] = None) -> Optional[bo
24462425

24472426
return cs_status["clusters"][self.cluster_name.lower()]["clusterrole"] == "replica"
24482427

2449-
def cluster_set_cluster_count(self, from_instance: Optional[str] = None) -> int:
2450-
"""Get the number of clusters in the cluster set."""
2451-
cs_status = self.get_cluster_set_status(extended=0, from_instance=from_instance)
2452-
if not cs_status:
2453-
return 0
2454-
2455-
return len(cs_status["clusters"])
2456-
24572428
def get_cluster_set_name(self, from_instance: Optional[str] = None) -> Optional[str]:
24582429
"""Get cluster set name."""
24592430
cs_status = self.get_cluster_set_status(extended=0, from_instance=from_instance)

templates/logrotate.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ nocopytruncate
2929
olddir archive_general
3030
}
3131

32-
/var/log/mysql/slowquery.log {
33-
olddir archive_slowquery
32+
/var/log/mysql/slow.log {
33+
olddir archive_slow
3434
}
3535

3636
/var/log/mysql/audit.log {

tests/integration/high_availability/test_log_rotation.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ async def test_log_rotation(
4040
logger.info("Extending update-status-hook-interval to 60m")
4141
await ops_test.model.set_config({"update-status-hook-interval": "60m"})
4242

43-
# Exclude slowquery log files as slowquery logs are not enabled by default
44-
log_types = ["error", "general", "audit"]
45-
log_files = ["error.log", "general.log", "audit.log"]
43+
# Exclude slow log files as slow logs are not enabled by default
44+
log_types = ["error", "audit"]
45+
log_files = ["error.log", "audit.log"]
4646
archive_directories = [
4747
"archive_error",
48-
"archive_general",
49-
"archive_slowquery",
48+
"archive_slow",
5049
"archive_audit",
5150
]
5251

@@ -105,7 +104,7 @@ async def test_log_rotation(
105104
), f"❌ unexpected files/directories in log directory: {ls_output}"
106105

107106
logger.info("Ensuring log files were rotated")
108-
# Exclude checking slowquery log rotation as slowquery logs are disabled by default
107+
# Exclude checking slow log rotation as slow logs are disabled by default
109108
for log in set(log_types):
110109
file_contents = read_contents_from_file_in_unit(
111110
ops_test, unit, f"/var/log/mysql/{log}.log"

tests/unit/test_mysql_k8s_helpers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ def test_log_rotate_config(self, _container):
326326
" rotation\nhourly\nmaxage 7\nrotate 10800\n\n# Naming of rotated files should be in"
327327
" the format:\ndateext\ndateformat -%Y%m%d_%H%M\n\n# Settings to prevent"
328328
" misconfigurations and unwanted behaviours\nifempty\nmissingok\nnocompress\nnomail\n"
329-
"nosharedscripts\nnocopytruncate\n\n/var/log/mysql/error.log {\n olddir"
330-
" archive_error\n}\n\n/var/log/mysql/general.log {\n olddir archive_general\n}\n\n"
331-
"/var/log/mysql/slowquery.log {\n olddir archive_slowquery\n}\n\n"
329+
"nosharedscripts\nnocopytruncate\n\n"
330+
"/var/log/mysql/error.log {\n olddir archive_error\n}\n\n"
331+
"/var/log/mysql/general.log {\n olddir archive_general\n}\n\n"
332+
"/var/log/mysql/slow.log {\n olddir archive_slow\n}\n\n"
332333
"/var/log/mysql/audit.log {\n olddir archive_audit\n}"
333334
)
334335

0 commit comments

Comments
 (0)