Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring replication lag actions + Simulator (combined) #4144

Merged
merged 23 commits into from
Apr 21, 2023

Conversation

rahim-kanji
Copy link
Collaborator

@rahim-kanji rahim-kanji commented Mar 5, 2023

Added simulator for Replication Lag

Refactoring replication lag actions PR

  • Introduced support for handling of bulk servers
  • Commented mysql_servers_wrlock as this method does not use admin tables.

renecannao and others added 20 commits May 17, 2021 00:35
This commit introduces a first simulator for read_only monitoring

ProxySQL itself will simulate hundreds of backends across hundreds of
hostgroups, all configured in hundreds of clusters, and return read_only
values for each of the simulated backend.
The read_only value can be configured in table READONLY_STATUS available in
the SQLite3Server module.

If a backend isn't configured in table READONLY_STATUS , its default read_only
value is 1.

It is possible to simulate a lot of simultaneous failover running queries like
the following:

UPDATE READONLY_STATUS SET read_only=1;
CREATE TABLE t1 AS SELECT hostname FROM READONLY_STATUS ORDER BY RANDOM() LIMIT 50;
UPDATE READONLY_STATUS SET read_only=0 WHERE hostname IN (SELECT hostname FROM t1);
DROP TABLE t1;
…'ProxySQL_Admin::save_mysql_servers_runtime_to_database'
…ervers' and 'mysql_replication_hostgroups' from 'enable_readonly_testing'
This commit optimizes the read-only actions method by removing the dependency on proxysql admin tables. Instead, a separate mapping container is maintained, which records the state of the HGM servers. This avoids the need to call the commit method on every change, which improves performance.
The changes in this commit also ensure that the mapping container is properly updated when servers are added, removed or modified.
# Conflicts:
#	lib/MySQL_Monitor.cpp
…into v2.x_refactor_read_only_action_with_simulator
…nto v2.x_refactor_read_only_action_with_simulator
* Introduced support for handling of bulk servers
* Commented mysql_servers_wrlock as this method does not use admin tables.
@mirostauder
Copy link
Collaborator

retest this please

@rahim-kanji rahim-kanji changed the title Replication Lag Simulator Refactoring replication lag actions with Simulator (combined) Mar 9, 2023
@rahim-kanji rahim-kanji changed the title Refactoring replication lag actions with Simulator (combined) Refactoring replication lag actions + Simulator (combined) Mar 9, 2023
@rahim-kanji rahim-kanji marked this pull request as ready for review March 15, 2023 09:09
Copy link
Collaborator

@JavierJF JavierJF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looking great. Minor enhancements shared with PR #4127 suggested. Thanks!

lib/MySQL_HostGroups_Manager.cpp Outdated Show resolved Hide resolved
lib/MySQL_HostGroups_Manager.cpp Outdated Show resolved Hide resolved
@renecannao
Copy link
Contributor

retest this please

@renecannao renecannao merged commit 9eea17a into v2.x Apr 21, 2023
@renecannao renecannao deleted the v2.x-replication_lag_simulator branch August 29, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants