-
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
[release-17.0] Upgrade-Downgrade Fix: Schema-initialization stuck on semi-sync ACKs while upgrading #13411
Merged
GuptaManan100
merged 6 commits into
vitessio:release-17.0
from
planetscale:fix-sidecard-stuck-semi-sync-17
Jul 5, 2023
+347
−433
Merged
[release-17.0] Upgrade-Downgrade Fix: Schema-initialization stuck on semi-sync ACKs while upgrading #13411
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f1be5fb
feat: augment backup upgrade-downgrade test to not remove the entire …
GuptaManan100 325381d
feat: do not set disable-active-reparents on the vttablets
GuptaManan100 8473746
test: use PRS instead of ISP
GuptaManan100 177b069
feat: fix the problem by running PromoteReplica in parallel with SetR…
GuptaManan100 460d617
feat: fix the manual next release upgrade-downgrade test too
GuptaManan100 7270b9d
feat: fix typing errors in comments
GuptaManan100 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2023 The Vitess Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# this script brings up new tablets for the two new shards that we will | ||
# be creating in the customer keyspace and copies the schema | ||
|
||
source ../common/env.sh | ||
|
||
# Restart the replica tablets so that they come up with new vttablet versions | ||
for i in 101 102; do | ||
echo "Shutting down tablet zone1-$i" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/vttablet-down.sh | ||
echo "Shutting down mysql zone1-$i" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-down.sh | ||
echo "Removing tablet directory zone1-$i" | ||
vtctlclient DeleteTablet -- --allow_primary=true zone1-$i | ||
rm -Rf $VTDATAROOT/vt_0000000$i | ||
echo "Starting tablet zone1-$i again" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-up.sh | ||
CELL=zone1 KEYSPACE=commerce TABLET_UID=$i ../common/scripts/vttablet-up.sh | ||
done | ||
|
||
for i in 201 202; do | ||
echo "Shutting down tablet zone1-$i" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/vttablet-down.sh | ||
echo "Shutting down mysql zone1-$i" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-down.sh | ||
echo "Removing tablet directory zone1-$i" | ||
vtctlclient DeleteTablet -- --allow_primary=true zone1-$i | ||
rm -Rf $VTDATAROOT/vt_0000000$i | ||
echo "Starting tablet zone1-$i again" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-up.sh | ||
SHARD=-80 CELL=zone1 KEYSPACE=customer TABLET_UID=$i ../common/scripts/vttablet-up.sh | ||
done | ||
|
||
for i in 301 302; do | ||
echo "Shutting down tablet zone1-$i" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/vttablet-down.sh | ||
echo "Shutting down mysql zone1-$i" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-down.sh | ||
echo "Removing tablet directory zone1-$i" | ||
vtctlclient DeleteTablet -- --allow_primary=true zone1-$i | ||
rm -Rf $VTDATAROOT/vt_0000000$i | ||
echo "Starting tablet zone1-$i again" | ||
CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-up.sh | ||
SHARD=80- CELL=zone1 KEYSPACE=customer TABLET_UID=$i ../common/scripts/vttablet-up.sh | ||
done | ||
|
||
# Wait for all the replica tablets to be in the serving state before reparenting to them. | ||
totalTime=600 | ||
for i in 101 201 301; do | ||
while [ $totalTime -gt 0 ]; do | ||
status=$(curl "http://$hostname:15$i/debug/status_details") | ||
echo "$status" | grep "REPLICA: Serving" && break | ||
totalTime=$((totalTime-1)) | ||
sleep 0.1 | ||
done | ||
done | ||
|
||
# Check that all the replica tablets have reached REPLICA: Serving state | ||
for i in 101 201 301; do | ||
status=$(curl "http://$hostname:15$i/debug/status_details") | ||
echo "$status" | grep "REPLICA: Serving" && continue | ||
echo "tablet-$i did not reach REPLICA: Serving state. Exiting due to failure." | ||
exit 1 | ||
done | ||
|
||
# Promote the replica tablets to primary | ||
vtctldclient PlannedReparentShard commerce/0 --new-primary "zone1-101" | ||
vtctldclient PlannedReparentShard customer/-80 --new-primary "zone1-201" | ||
vtctldclient PlannedReparentShard customer/80- --new-primary "zone1-301" | ||
|
||
# Restart the old primary tablets so that they are on the latest version of vttablet too. | ||
echo "Restarting tablet zone1-100" | ||
CELL=zone1 TABLET_UID=100 ../common/scripts/vttablet-down.sh | ||
CELL=zone1 KEYSPACE=commerce TABLET_UID=100 ../common/scripts/vttablet-up.sh | ||
|
||
echo "Restarting tablet zone1-200" | ||
CELL=zone1 TABLET_UID=200 ../common/scripts/vttablet-down.sh | ||
SHARD=-80 CELL=zone1 KEYSPACE=customer TABLET_UID=200 ../common/scripts/vttablet-up.sh | ||
|
||
echo "Restarting tablet zone1-300" | ||
CELL=zone1 TABLET_UID=300 ../common/scripts/vttablet-down.sh | ||
SHARD=80- CELL=zone1 KEYSPACE=customer TABLET_UID=300 ../common/scripts/vttablet-up.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be kinda neat if
PromoteReplica
was a no-op if the tablet was already type:PRIMARY since it would simplify the logic here a bit (however, that would make the actual server-side implementation more involved, and possibly too much, so 🤷 )There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PromoteReplica
is already idempotent. We can call it over and over and it won't be wrong per se, but we still only want to call it when required.Also, I wanted to reduce the change to the
PRS
flow as much as possible and only make the small change of runningPromoteReplica
in parallel instead of sequentially.