-
Notifications
You must be signed in to change notification settings - Fork 1
fix: replace \G with --vertical in replication templates (MySQL 9.5 macOS compat) #76
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,9 +29,9 @@ MASTER_RECS=$($MASTER -BN -e 'select count(*) from test.t1') | |||||||||||
|
|
||||||||||||
| master_status=master_status$$ | ||||||||||||
| slave_status=slave_status$$ | ||||||||||||
| $MASTER -e '{{.ShowMasterStatus}}\G' > $master_status | ||||||||||||
| master_binlog=$(grep 'File:' $master_status | awk '{print $2}' ) | ||||||||||||
| master_pos=$(grep 'Position:' $master_status | awk '{print $2}' ) | ||||||||||||
| $MASTER --vertical -e '{{.ShowMasterStatus}}' > $master_status | ||||||||||||
| master_binlog=$(grep -E '^\s*(File|Log_name):' $master_status | awk '{print $2}' ) | ||||||||||||
| master_pos=$(grep -E '^\s*Position:' $master_status | awk '{print $2}' ) | ||||||||||||
| echo "# {{.MasterLabel}} log: $master_binlog - Position: $master_pos - Rows: $MASTER_RECS" | ||||||||||||
| rm -f $master_status | ||||||||||||
|
|
||||||||||||
|
|
@@ -98,7 +98,13 @@ do | |||||||||||
| then | ||||||||||||
| sleep 3 | ||||||||||||
| else | ||||||||||||
| S_READY=$($SLAVE -BN -e "select {{.MasterPosWaitFunc}}('$master_binlog', $master_pos,60)") | ||||||||||||
| if [ -z "$master_binlog" ] || [ -z "$master_pos" ]; then | ||||||||||||
| echo "# WARNING: could not determine master binlog/position, using GTID wait" | ||||||||||||
| sleep 3 | ||||||||||||
| S_READY=0 | ||||||||||||
|
Comment on lines
+102
to
+104
|
||||||||||||
| echo "# WARNING: could not determine master binlog/position, using GTID wait" | |
| sleep 3 | |
| S_READY=0 | |
| echo "# ERROR: could not determine {{.MasterLabel}} binlog/position; cannot verify replication wait" | |
| exit 1 |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -164,7 +164,7 @@ then | |||||||||
| show_master_status_cmd="show binary log status" | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| $master_use_script -e "$show_master_status_cmd\G" > $master_status | ||||||||||
| $master_use_script --vertical -e "$show_master_status_cmd" > $master_status | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with the improvements made in |
||||||||||
| binlog_file=$(grep File < $master_status | awk '{print $2}') | ||||||||||
| binlog_pos=$(grep Position < $master_status | awk '{print $2}') | ||||||||||
|
Comment on lines
168
to
169
|
||||||||||
| binlog_file=$(grep File < $master_status | awk '{print $2}') | |
| binlog_pos=$(grep Position < $master_status | awk '{print $2}') | |
| binlog_file=$(grep -E '^[[:space:]]*(File|Log_name):' < $master_status | awk '{print $2}') | |
| binlog_pos=$(grep -E '^[[:space:]]*Position:' < $master_status | awk '{print $2}') |
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.
Use grep -E for consistency with other replication templates (e.g., check_slaves.gotxt and check_multi_source.gotxt). This also improves readability by avoiding the need for multiple backslash escapes for the alternation operator.
$SBDIR/use --vertical -e "$show_replica_cmd" | grep -E "(Running:|Master_Log_Pos|Source_Log_Pos|\<Master_Log_File|\<Source_Log_File|Retrieved|Executed|Auto_Position)"
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.
The regexes use
\s*withgrep -E, but\sis not portable in ERE (GNU/BSDgrep -Etreats it as a literals). If the intent is to allow leading whitespace in the--verticaloutput, this won’t work reliably; use[[:space:]]*(or remove the whitespace matcher if not needed).