-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[RFC] Tablet startup in super_read_only
mode
#12180
Comments
rsajwani
changed the title
Tablet Startup in Read-Only-Mode
[RFC] Tablet Startup in Read-Only-Mode
Jan 28, 2023
3 tasks
|
rsajwani
changed the title
[RFC] Tablet Startup in Read-Only-Mode
[RFC] Tablet Startup in Jan 30, 2023
super_read-only
Mode
rsajwani
changed the title
[RFC] Tablet Startup in
[RFC] Tablet Startup in Jan 30, 2023
super_read-only
Modesuper_read_only
Mode
I have done some correction.. Will continue to work on it .. Above code changes are pseudo code, we will be following the convention where primary will have call to |
3 tasks
rsajwani
changed the title
[RFC] Tablet Startup in
[RFC] Tablet startup in Feb 3, 2023
super_read_only
Modesuper_read_only
mode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview of the Issue
TL;DR
We want replicas DB to be in
super_read_only
mode (i-esuper-read-only
set to true) all the time. Only primary DB can accept writes (i-esuper_read_only
set to false). This will make sure that nobody can modify replica from anywhere, anytime.Motivation
As of today all replicas comes up in
read_only
mode, however this doesn't prevent user's likeroot
andvt_dba
who haveSUPER
privileges to change the database anytime anywhere. We want to leverage GLOBALsuper_read_only
configuration in order to protect against errant GTIDs. This will make sure that apart from primary no other component or offline system can mutate DB resulting in errant GTIDs that are then lying in wait to cause later failures, as you can see in #9312 and #10094Furthermore not all the uses-cases are ensuring that we end up replica in read-only mode. During ERS there are cases where we don't set the
read-only
. Withsuper_read_only
change we will make sure that we cover those cases as well.History
In the past we have run into situation where ERS turns primary results in errantGTIDs. The reason turns out to be cases where offline processes or operators might have mutated replica schema and it make them potential for errant GTIDs. Here are some of the issues which indicated that we ran into situations like this in production systems.
#10363
#10094
#9312
#10448
Possible Approaches
We had tried few times to implement this
super_read_only
change but we ran into different ranges of issue mainly due to de-centralized logic of setting replica to read/write mode andwithDDL
all across code base. I am listing here few changes done in the past forsuper_read_only
, but later on due to regression they have be reverted.#11706
#10094
#9312
#10448
With schema initialization changes #11520, we believe it will be much easier now to implement
super_read_only
change.Proposed Solution
This change should be build on top of #11520, where instead of using
withddl
we use declarative approach. Using declarative approach has helped us condense all our schema changes to one place. This provide us an opportunity to applysuper_read_only
changes to our DB.Every MySql instance will bootstrap in
super_read_only
mode. Only during init_db we switchsuper_read_only
OFF
temporarily in order to perform some mutations like creating necessary users and permission. During Reparenting we will changesuper_read_only
values for primary and replica as require. Here is the quick summary of reparenting operations.All together there are few operations which are called across reparenting. I am summarizing how they are going to change
super_read_only
status. This will help to understand individual reparenting operationsPRS
,ERS
&ExternallyReparenting
.PromoteReplica --> Sets
super_read_only
toOFF
for given Replica TabletDemotePrimary --> Sets
super_read_only
toON
for given Primary TabletPRS
ERS
ExternallyReparentShard
I am listing here major changes which is needed for this RFC.
super-read-only
mode.super_read_only
off temporarily in order to perform some mutations like creating necessary users and permission.super_read_only
, so we will have a separate init_db.sql file for unit tests.ON
read/write we will turn offread_only
. All places where we have to switchOFF
read/write we will turn onsuper_read_only
The text was updated successfully, but these errors were encountered: