ClusterLabs / ClusterLabs/resource-agents

mysql: Doesn't work as multi-state resource with Percona 5.6

Open
#590 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
519
Forks
608
Avg merge
6d 1h
Merged PRs (30d)
7

Description

The reason is that several variables with `read_only` in their name now exist. The mysql RA checks for `read_only` like this:

```
read_only_state=`$MYSQL $MYSQL_OPTIONS_REPL \
-e "SHOW VARIABLES" | grep read_only | awk '{print $2}'`
```

But it returns too many results:

```
by-db-1-b:~# mysql -e 'show variables' | grep read_only
innodb_read_only OFF
read_only OFF
super_read_only OFF
tx_read_only OFF
by-db-1-b:~# mysql -e 'show variables' | grep read_only | awk '{print $2}'
OFF
OFF
OFF
OFF
```

The result is that it never considers a server a slave, and therefore Pacemaker stops the slave resource to avoid too many masters.

The fix is just to match the entire variable:

```
--- /usr/lib/ocf/resource.d/heartbeat/mysql 2015-03-26 11:34:56.000000000 +0000
+++ mysql 2015-03-27 01:43:55.000000000 +0000
@@ -324,7 +324,7 @@
local read_only_state

read_only_state=`$MYSQL $MYSQL_OPTIONS_REPL \
- -e "SHOW VARIABLES" | grep read_only | awk '{print $2}'`
+ -e "SHOW VARIABLES" | awk '/^read_only\t/ { print $2 }'`

if [ "$read_only_state" = "ON" ]; then
return 0
```

Also, a minor cosmetic error in the same file:

```
@@ -740,7 +740,7 @@
rc=$?

if [ $rc -ne 0 ]; then
- ocf_exit_reason "Failed to select from $test_table";
+ ocf_exit_reason "Failed to select from $OCF_RESKEY_test_table";
return $OCF_ERR_GENERIC;
fi
fi
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the MySQL resource agent at /usr/lib/ocf/resource.d/heartbeat/mysql, focusing on the read-only state check and the error message around test_table. Verify that the read-only lookup selects only the exact variable and that the failure message uses the configured test-table value; the issue provides no test file or test command.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, shell
Domain
database, devops
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.