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

Bug Report: Flavor is required in GTID position for incremental restore-to-position value #15592

Closed
mattlord opened this issue Mar 28, 2024 · 1 comment · Fixed by #15599
Closed
Assignees

Comments

@mattlord
Copy link
Contributor

mattlord commented Mar 28, 2024

Overview of the Issue

We intended to remove the need to specify the flavor in #13474

The function added there DecodePositionDefaultFlavor(), however, is not used in the call path for the RPC, which ends up here:

if request.RestoreToPos != "" {
pos, err := replication.DecodePosition(request.RestoreToPos)
if err != nil {
return vterrors.Wrapf(err, "restore failed: unable to decode --restore-to-pos: %s", request.RestoreToPos)
}
params.RestoreToPos = pos
}

Reproduction Steps

git checkout main && make build

pushd examples/local

./101_initial_cluster.sh

# Generate full backup
vtctldclient BackupShard commerce/0

# Generate a couple of empty incremental backups as there were no writes
# since the full backup.
vtctldclient BackupShard --incremental-from-pos=auto commerce/0
sleep 1
vtctldclient BackupShard --incremental-from-pos=auto commerce/0

# Generate some writes and thus GTIDs.
mysql < ../common/insert_commerce_data.sql

# Save the position we expect to restore to.
RESTORE_POS=${$(mysql 'commerce:0' -sN -e "select @@global.gtid_executed")//\\n/}

# Generate a usable non-empty incremental backup.
vtctldclient BackupShard --incremental-from-pos=auto commerce/0

# Generate one more GTID after the backup.
mysql commerce -e "insert into customer (email) values ('mlord@planetscale.com')"

# Restore the replica to our PIT.
TABLET_ALIAS="$(vtctldclient GetTablets --keyspace commerce --tablet-type replica --shard '0' | awk '{print $1}')"
echo "Restoring tablet ${TABLET_ALIAS} to position ${RESTORE_POS}"
vtctldclient RestoreFromBackup --restore-to-pos "${RESTORE_POS}" "${TABLET_ALIAS}"

sleep 5
echo -e "\nAttempting restore using position with the Flavor added\n"

# Restore using adjusted POS with Flavor.
RESTORE_POS="MySQL56/${RESTORE_POS}"
echo "Restoring tablet ${TABLET_ALIAS} to position ${RESTORE_POS}"
vtctldclient RestoreFromBackup --restore-to-pos "${RESTORE_POS}" "${TABLET_ALIAS}"

./401_teardown.sh

popd

Binary Version

vtgate version Version: 20.0.0-SNAPSHOT (Git revision 308f1fc5f0feac229f817bb30ef3b6fd0fe1fca9 branch 'main') built on Thu Mar 28 13:07:27 EDT 2024 by matt@pslord.local using go1.22.1 darwin/arm64

Operating System and Environment details

N/A

Log Fragments

No response

@mattlord mattlord added Type: Bug Needs Triage This issue needs to be correctly labelled and triaged and removed Needs Triage This issue needs to be correctly labelled and triaged labels Mar 28, 2024
@shlomi-noach
Copy link
Contributor

Solved in #15599

@mattlord mattlord removed their assignment Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants