-
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
Bug Report: vtorc ERS incorrectly flags replica as having errant GTIDs #16724
Comments
I'll leave this open until we resolve #16725 (comment) |
Assigned myself to look into the ERS logic and see what scenarios are broken. |
So the current logic (and in particular before #16725) is flawed, and I believe contrary to the correct logic.
I'm gonna work on improving the logic and add some more challenging testing scenarios. |
In order to remedy the situation of errant GTIDs and their detection, we have started by adding the capability of errant GTID detection in each vttablet so that if it finds that it has an errant GTID, then it doesn't even join the replication stream. These changes can be found in #16833. Once these changes are merged, the situations that we run into in ERS will be greatly reduced. The following situations would be left - Situations to Consider for Errant GTID DetectionFor this discussion we'll make the following assumptions for the topology - Case 1: We don't have any errant GTIDs.Within this case, we have a few subcases to consider - Case 1a: This is the first reparent. A replica is the most advanced.The UUIDs that we'll see in ERS are as follows -
One of the two replicas could be lagged, but we're guaranteed that atleast one semi-sync replica will have all the writes that the primary accepted. Correct Expectation: In this case, we should select Case 1b: This is not the first reparent. A replica is the most advanced.The UUIDs that we'll see in ERS are as follows -
Very similar case to the previous one, slightly more complex for errant GTID detection because we need to check that the GTIDs for all the tablets match on all UUIDs other than Correct Expectation: In this case, we should select Case 1c: This is not the first reparent. A rdonly is the most advanced.The UUIDs that we'll see in ERS are as follows -
This situation can happen if the primary dies while waiting for a semi-sync ACK for a certain write. That write might be present on the replica. Correct Expectation: In this case, we can select From this point, we go into more complicated cases - Case 2: Only 1 tablet is recent and all others are severely laggedWe could be in a situation where only 1 replica tablet is up to date with the primary that just crashed and all the other tablets are severely lagged. It could be because they came up from a backup because of errant GTIDs or just because they were replicating slowly. The UUIDs that we'll see in ERS are as follows -
Correct Expectation: We should be selecting Case 3: All replicas severely lagged (Primary tablet dies with
|
The current Errant GTID code is not sufficient especially for case 2 where it just marks the most advanced tablet as errant. So, we do need to refactor and fix it. The most correct way that takes care of all the cases would be to store the primary's GTID set when it promotes to the topo-server and use that for errant GTID detection in ERS, but that seems very space intensive and quite frankly an overkill. As a substitute to it, we propose a different solution that doesn't have any such storage overhead. Currenlyt, in ERS, we use the positions of the tablets and who they're replicating from as the 2 points of information for doing the errant GTID detection. We can augment this by also using the length of the reparent journal. Currently we are using the reparent_journal table as an append only log that can be used for debugging but isn't being used anywhere else. With the new information, we can use the algorithm as follows -
With this, let's see what our new proposed solution would do in all the above listed cases - |
Do you mean the number of rows in the table? |
Yes |
Overview of the Issue
When ERS is evaluating candidates for promotion, it checks whether any of the candidates has an errant GTID. The way this computation is done can lead to false positives when there are only two candidates. This can lead to ERS choosing to promote a replica that is not actually the most advanced.
Reproduction Steps
This is not easy to reproduce, but can probably be done as follows
Binary Version
Operating System and Environment details
Log Fragments
The text was updated successfully, but these errors were encountered: