-
Notifications
You must be signed in to change notification settings - Fork 469
[do-not-merge] mysql ci debug #14468
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
base: main
Are you sure you want to change the base?
Conversation
Changes made to fix this error:
Got hints from BK logs:
|
🚀 Benchmarks reportTo see the full report comment with |
|
||
# Verify slave status | ||
echo "Verifying slave status..." | ||
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e "GRANT REPLICATION CLIENT ON *.* TO 'mydb_replica_user'@'%'; FLUSH PRIVILEGES;" |
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.
This is redundant as it is already there in grant-permissions.sql
. Also the placement is wrong as GRANTs should be done before starting the slave.
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e "STOP SLAVE; RESET SLAVE ALL;" 2>/dev/null || echo "Slave was not running" | ||
|
||
# Use here-doc to avoid command line escaping issues | ||
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" <<EOF | ||
CHANGE MASTER TO | ||
MASTER_HOST='$MYSQL_MASTER_HOST', | ||
MASTER_USER='mydb_replica_user', | ||
MASTER_PASSWORD='mydb_replica_pwd', | ||
MASTER_LOG_FILE='$CURRENT_LOG', | ||
MASTER_LOG_POS=$CURRENT_POS; | ||
EOF | ||
|
||
# Prepare the CHANGE MASTER TO command | ||
start_slave_stmt="CHANGE MASTER TO MASTER_HOST='$MYSQL_MASTER_HOST', MASTER_USER='mydb_replica_user', MASTER_PASSWORD='mydb_replica_pwd', MASTER_LOG_FILE='$CURRENT_LOG', MASTER_LOG_POS=$CURRENT_POS; START SLAVE;" | ||
if [ $? -eq 0 ]; then | ||
echo "CHANGE MASTER command executed successfully" | ||
|
||
# Display the command that will be executed | ||
echo "Running the following command to start replication: $start_slave_stmt" | ||
# Start the slave | ||
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e "START SLAVE;" | ||
|
||
# Run the CHANGE MASTER TO command | ||
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e "$start_slave_stmt" || { | ||
echo "Failed to start replication. Entering sleep mode for debugging." | ||
tail -f /dev/null # This will keep the container running indefinitely | ||
} | ||
if [ $? -eq 0 ]; then | ||
echo "Slave started successfully" | ||
else | ||
echo "Failed to start slave" | ||
exit 1 | ||
fi | ||
else | ||
echo "Failed to execute CHANGE MASTER command" | ||
exit 1 | ||
fi |
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.
Same thing but better error handling.
echo "Attempt $i: Checking master status..." | ||
MS_STATUS=$(mysql -h "$MYSQL_MASTER_HOST" -P 3306 -u root -p"$MYSQL_ROOT_PASSWORD" -e "SHOW MASTER STATUS;" 2>/dev/null || echo "FAILED") | ||
|
||
if [ "$MS_STATUS" = "FAILED" ]; then | ||
echo "Failed to connect to master, retrying..." | ||
sleep 2 | ||
continue | ||
fi | ||
|
||
echo "Master status response: $MS_STATUS" | ||
|
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.
Again better handling but with 2s delay before retrying.
GRANT REPLICATION SLAVE ON *.* TO 'mydb_replica_user'@'%'; | ||
GRANT REPLICATION CLIENT ON *.* TO 'mydb_replica_user'@'%'; |
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.
REPLICATION CLIENT - This allows the user to execute SHOW MASTER STATUS and SHOW SLAVE STATUS commands
GRANT REPLICATION SLAVE - This allows the user to connect as a replica (START SLAVE)
After I fixed, there was one more issue. The previous script was working as of now somehow but it had issues. Now it is much robust than before. |
|
💚 Build Succeeded
History
cc @shmsr |
CI passed 🎉 |
Proposed commit message
See title.
Checklist
changelog.yml
file.