wesql / wescale

WeScale is a Modern MySQL proxy that supports read-write-split, read-after-write-consistency, load balancing and OnlineDDL.
https://wesql.io
Apache License 2.0
199 stars 8 forks source link

[Enhancement Request] Enable to distinguish rdonly and replica type when using mysql probe #562

Open newborn22 opened 1 week ago

newborn22 commented 1 week ago

Background

The MySQL probe component cannot distinguish between the rdonly and replica roles. In the current WeScale-MySQL cluster, there will be no rdonly type vttablets.

The reason is that in MySQL, both the replica and rdonly roles set the read_only system variable to 1.

Proposal

The rdonly role can be set either through flag parameters when the vttablet starts, or through external API calls after the vttablet has started. In the role detection module, if the current case is identified as a Wescale-MySQL cluster and the vttablet role type is rdonly, the type of the vttablet will no longer be obtained from the MySQL probe.

This approach means that once a vttablet is assigned the rdonly role, its type can only be changed through external API calls. Considering the purpose of the rdonly role, this approach seems reasonable.