{"id":18806728,"url":"https://github.com/lefred/mysql-plugin-flush_rewriter","last_synced_at":"2025-07-28T05:04:45.437Z","repository":{"id":228757885,"uuid":"748544248","full_name":"lefred/mysql-plugin-flush_rewriter","owner":"lefred","description":"MySQL Rewrite Plugin to force FLUSH statements to be LOCAL","archived":false,"fork":false,"pushed_at":"2024-03-20T09:57:32.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-22T01:09:29.071Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lefred.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-26T08:05:24.000Z","updated_at":"2024-01-30T12:46:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"5b3ae115-7b9e-4dc6-93be-a2e2e760b7af","html_url":"https://github.com/lefred/mysql-plugin-flush_rewriter","commit_stats":null,"previous_names":["lefred/mysql-plugin-flush_rewriter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lefred/mysql-plugin-flush_rewriter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmysql-plugin-flush_rewriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmysql-plugin-flush_rewriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmysql-plugin-flush_rewriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmysql-plugin-flush_rewriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lefred","download_url":"https://codeload.github.com/lefred/mysql-plugin-flush_rewriter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefred%2Fmysql-plugin-flush_rewriter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267464522,"owners_count":24091505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T22:49:24.957Z","updated_at":"2025-07-28T05:04:45.414Z","avatar_url":"https://github.com/lefred.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mysql-plugin-flush_rewriter\n\nA MySQL Plugin to rewrite all `FLUSH` statements as `FLUSH LOCAL` to avoid those\ncommands to be sent to replicas.\n\nSending `FLUSH` commands to replicas can be an issue, but for old DBAs like me,\nthe `LOCAL` keyword is not something we often use.\n\nSee https://lefred.be/content/as-a-dba-develop-a-critical-mind-when-receiving-advice/ \n\n```\n MySQL \u003e install plugin flush_rewriter SONAME 'flush_rewriter.so';\n Query OK, 0 rows affected (0.0099 sec)\n \n MySQL \u003e SELECT PLUGIN_NAME, PLUGIN_STATUS, PLUGIN_TYPE \n         FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'flush%';\n+----------------+---------------+-------------+\n| PLUGIN_NAME    | PLUGIN_STATUS | PLUGIN_TYPE |\n+----------------+---------------+-------------+\n| flush_rewriter | ACTIVE        | AUDIT       |\n+----------------+---------------+-------------+\n1 row in set (0.0016 sec)\n\n MySQL \u003e show global variables like 'flush_rewriter%';\n+----------------------------+-------+\n| Variable_name              | Value |\n+----------------------------+-------+\n| flush_rewriter_force_local | OFF   |\n+----------------------------+-------+\n1 row in set (0.0041 sec)\n\n MySQL \u003e flush status;\nQuery OK, 0 rows affected (0.0081 sec)\n\n MySQL \u003e set global flush_rewriter_force_local=1;\nQuery OK, 0 rows affected (0.0004 sec)\n\n MySQL \u003e show global variables like 'flush_rewriter%';\n+----------------------------+-------+\n| Variable_name              | Value |\n+----------------------------+-------+\n| flush_rewriter_force_local | ON    |\n+----------------------------+-------+\n1 row in set (0.0041 sec)\n\n MySQL \u003e flush status;\nQuery OK, 0 rows affected, 1 warning (0.0007 sec)\nNote (code 1105): Query 'flush status' rewritten to 'FLUSH LOCAL status' by a query rewrite plugin\n\n MySQL \u003e flush NO_WRITE_TO_BINLOG status;\nQuery OK, 0 rows affected (0.0005 sec)\n\n MySQL \u003e flush /*fred*/ status;\nQuery OK, 0 rows affected, 1 warning (0.0003 sec)\nNote (code 1105): Query 'flush /*fred*/ status' rewritten to 'FLUSH LOCAL /*fred*/ status' by a query rewrite plugin\n```\n\n## Limitations\n\nThe plugin doesn't rewrite correctly the command when the statement starts with a comment:\n\n```\n MySQL \u003e /* fred */ flush status;\nQuery OK, 0 rows affected (0.0018 sec)\n```\n\n## Instrumentation\n\nThe plugin's memory consumption is intrumented in Performance_Schema:\n\n```\n MySQL \u003e SELECT * FROM performance_schema.memory_summary_global_by_event_name \n         where event_name like '%flush_rewriter'\\G\n*************************** 1. row ***************************\n                  EVENT_NAME: memory/rewriter/flush_rewriter\n                 COUNT_ALLOC: 2\n                  COUNT_FREE: 2\n   SUM_NUMBER_OF_BYTES_ALLOC: 111\n    SUM_NUMBER_OF_BYTES_FREE: 111\n              LOW_COUNT_USED: 0\n          CURRENT_COUNT_USED: 0\n             HIGH_COUNT_USED: 1\n    LOW_NUMBER_OF_BYTES_USED: 0\nCURRENT_NUMBER_OF_BYTES_USED: 0\n   HIGH_NUMBER_OF_BYTES_USED: 60\n1 row in set (0.0064 sec)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefred%2Fmysql-plugin-flush_rewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flefred%2Fmysql-plugin-flush_rewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefred%2Fmysql-plugin-flush_rewriter/lists"}