Title: Read MariaDB read_only as a number on 11.8 (S-019-13, S-019-15) by shipmill-romamo[bot] · Pull Request #460 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Read MariaDB read_only as a number on 11.8 (S-019-13, S-019-15) by shipmill-romamo[bot] · Pull Request #460 · cloudfall-dev/cloudfall
X Title: Read MariaDB read_only as a number on 11.8 (S-019-13, S-019-15) by shipmill-romamo[bot] · Pull Request #460 · cloudfall-dev/cloudfall
Description: Summary On a real MariaDB 11.8.9 pair (#441's proving run), the role's CONCAT_WS state query read read_only as ON, not 1, while every check compares with '1'. That broke two things: "Turn writes off on a server that becomes a replica" ran and reported changed on every converge of a healthy replica, so a second converge was not changed=0 (S-019-13) a declared source that was read-only read as writable, so a planned switch answered wait-promotion and never took the "read-only and applied" branch (S-019-15) The fix: cloudfall_mariadb_replication_state_query still reads @@global.read_only as the server gives it: 1/0 on the older series, ON/OFF as seen on 11.8.9. It does not use + 0. No real 11.8 server has shown what read_only reads as in arithmetic. MariaDB's 11.8 source still defines it as a boolean, and its docs say it becomes an enum from 12.0. If a server ever stores it as a name string, 'ON' + 0 reads as 0: a read-only server read as writable, with no way for the parser to notice a new filter, cloudfall_mariadb_replication_state, parses the query's line for both this server and its peer, in place of the dict(fields | zip(...)) in replication_check.yml: it reads readOnly as 1 for 1, ON, NO_LOCK and NO_LOCK_NO_ADMIN (and their index, 2 and 3, should a server give it as a number), and as 0 for 0 and OFF it fails on any other value or on a line with the wrong number of fields replication_plan normalises the same way, so a state that reaches it another way can't slip through the '1' comparisons in replication.yml, replication_check.yml and the filter stay as they are cloudfall_mariadb_replication_state_fields is gone from the role's defaults: the field order now lives in the filter that reads it the peer state's and the peer link's conditions read cloudfall_mariadb_peer_reachable | bool. ansible-lint takes the unrendered task var as truthy and then can't find a role filter. | bool gives it a value it can read, and changes nothing at run time I checked the other server variables the role reads through CONCAT_WS: the state query's other fields (server_id, the GTID positions, the database count) are numbers or strings on every series owner_password.yml reads JSON_VALUE fields of mysql.global_priv, not server variables MASTER_GTID_WAIT returns a number None of them changed form in 11.8. Outside this role, cloudfall_inspect/tasks/mariadb.yml reads SELECT @@global.read_only and accepts only 0/1. On 11.8 it would report the server as unavailable; that is #468. Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_mariadb/defaults/main.yml, engine/ansible/roles/cloudfall_mariadb/tasks/replication_check.yml, engine/ansible/roles/cloudfall_mariadb/filter_plugins/mariadb_replication.py, engine/tests/mariadb_pair.py, engine/tests/test_s019_mariadb_replication_role.py, changelog.d/450-mariadb-read-only-on.md Order: Make the stand-in report read_only as ON in a CONCAT_WS the way 11.8.9 does, and run the S-019-13 second converge and the S-019-15 role swap against it (failing first) Parse both servers' state through one filter that normalises readOnly to 1/0 and fails fast on anything else Keep the query reading @@global.read_only as is, never + 0 Proof: engine/tests/test_s019_mariadb_replication_role.py (S-019-13, S-019-15 on an 11.8-like and an older stand-in, the normaliser's table, the role's own query against the stand-in), ruff, mypy, ansible-lint Test plan The stand-in (engine/tests/mariadb_pair.py) reports read_only as ON/OFF in 11.8 mode and 1/0 otherwise, as the older series do. It refuses read_only in arithmetic (such as + 0) instead of making up an answer test_the_state_query_reads_read_only_in_the_form_a_real_server_gave runs the role's own state query against the stand-in on both series. It fails if the query goes back to + 0 test_s019_13_a_second_converge_changes_nothing_and_does_not_seed_again and test_s019_15_a_role_swap_ends_within_two_converges_with_no_row_lost run on both forms. On the old code the 11.8 cases failed: the second converge changed the replica, and the swap never promoted. They pass now, and the swap also asserts the promotion took the "read-only and applied" branch New unit tests: the normaliser's table: 1, 0, ON, OFF, NO_LOCK, NO_LOCK_NO_ADMIN, 2, 3 an unknown value and a short line are errors replication_plan with a peer that says ON promotes, and one that says OFF refuses Rebased onto main after #458 and #462. The S-019 replication role tests for read_only, S-019-12, S-019-13, S-019-15, locked and lost: 28 passed uv run ruff check ., uv run mypy, uv run ansible-lint engine/ansible (with ANSIBLE_CONFIG=engine/ansible/ansible.cfg, as CI runs it) Full suite left to CI Not verified here: no real 11.8 server has run this change yet. The query reads the form the proving run saw (ON), and the filter also accepts 1, so either form reads correctly Fixes #450 🤖 Generated with Claude Code
Open Graph Description: Summary On a real MariaDB 11.8.9 pair (#441's proving run), the role's CONCAT_WS state query read read_only as ON, not 1, while every check compares with '1'. That broke two things:...
X Description: Summary On a real MariaDB 11.8.9 pair (#441's proving run), the role's CONCAT_WS state query read read_only as ON, not 1, while every check compares with '1'. That b...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/460
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:e943d198-bfed-05a4-8dbb-b0bee47cb5c8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9EAC:E6B97:E08ABD:134177B:6B05578C |
| html-safe-nonce | 336e8a4a0f35e4b0440f3271a6cbb8c5b8fb708c2c2a31d85d9191b985e6127f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUFDOkU2Qjk3OkUwOEFCRDoxMzQxNzdCOjZCMDU1NzhDIiwidmlzaXRvcl9pZCI6IjU1MzY3MDU0MDkzNDg2MjczMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2de89935cd7ca0d9bd85e9d357b72888cab6f10a78789aa4d0c2e3d84875960a |
| hovercard-subject-tag | pull_request:5347469302 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/460/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Summary On a real MariaDB 11.8.9 pair (#441's proving run), the role's CONCAT_WS state query read read_only as ON, not 1, while every check compares with '1'. That broke two things:... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10dff83edfd4f3617a7792a152d44991587b434c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width