diff --git a/client/mysql.cc b/client/mysql.cc index ff4ce8f46e0b5..3527aceea8bd2 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3622,7 +3622,6 @@ static int com_go(String *buffer, char *) timer= microsecond_interval_timer(); executing_query= 1; error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length()); - report_progress_end(); #ifdef HAVE_READLINE if (status.add_to_history) @@ -3660,6 +3659,7 @@ static int com_go(String *buffer, char *) goto end; } + report_progress_end(); if (verbose >= 3 || !opt_silent) end_timer(timer, time_buff); else @@ -4025,6 +4025,7 @@ print_table_data(MYSQL_RES *result) while ((cur= mysql_fetch_row(result))) { + report_progress_end(); if (interrupted_query) break; ulong *lengths= mysql_fetch_lengths(result); @@ -4197,6 +4198,7 @@ static void print_table_data_html(MYSQL_RES *result) } while ((cur = mysql_fetch_row(result))) { + report_progress_end(); if (interrupted_query) break; ulong *lengths=mysql_fetch_lengths(result); @@ -4233,6 +4235,7 @@ print_table_data_xml(MYSQL_RES *result) fields = mysql_fetch_fields(result); while ((cur = mysql_fetch_row(result))) { + report_progress_end(); if (interrupted_query) break; ulong *lengths=mysql_fetch_lengths(result); @@ -4277,6 +4280,7 @@ print_table_data_vertically(MYSQL_RES *result) mysql_field_seek(result,0); for (uint row_count=1; (cur= mysql_fetch_row(result)); row_count++) { + report_progress_end(); if (interrupted_query) break; mysql_field_seek(result,0); @@ -4478,6 +4482,7 @@ print_tab_data(MYSQL_RES *result) } while ((cur = mysql_fetch_row(result))) { + report_progress_end(); lengths=mysql_fetch_lengths(result); field= mysql_fetch_fields(result); if (opt_binhex && is_binary_field(&field[0])) diff --git a/mysql-test/main/mysql-interactive.result b/mysql-test/main/mysql-interactive.result index 0eb3a53cac754..d914aabae7bef 100644 --- a/mysql-test/main/mysql-interactive.result +++ b/mysql-test/main/mysql-interactive.result @@ -62,3 +62,64 @@ Query OK, 0 rows affected MariaDB [(none)]> exit Bye # End of 10.11 tests +# +# MDEV-38922 CLI incorrectly adds "stage done" on REPAIR TABLE output +# +CREATE TABLE t (c INT) ENGINE=InnoDB; +REPAIR TABLE t; +DROP TABLE t; +exit +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MariaDB connection id is X +Server version: Y +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +MariaDB [test]> CREATE TABLE t (c INT) ENGINE=InnoDB; +Query OK, 0 rows affected + +MariaDB [test]> REPAIR TABLE t; +Stage: 2 of 4 'Enabling keys' 0% of stage done +--------+--------+----------+----------+ +| Table | Op | Msg_type | Msg_text | ++--------+--------+----------+----------+ +| test.t | repair | status | OK | ++--------+--------+----------+----------+ +1 row in set + +MariaDB [test]> DROP TABLE t; +Query OK, 0 rows affected + +MariaDB [test]> exit +Bye +# +# MDEV-38922 CLI incorrectly adds "stage done" on REPAIR TABLE output on quick mode +# +CREATE TABLE t (c INT) ENGINE=InnoDB; +REPAIR TABLE t; +DROP TABLE t; +exit +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MariaDB connection id is X +Server version: Y +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +MariaDB [test]> CREATE TABLE t (c INT) ENGINE=InnoDB; +Query OK, 0 rows affected + +MariaDB [test]> REPAIR TABLE t; ++--------+--------+----------+----------+ +| Table | Op | Msg_type | Msg_text | ++--------+--------+----------+----------+ +Stage: 2 of 4 'Enabling keys' 0% of stage done | test.t | repair | status | OK | ++--------+--------+----------+----------+ +1 row in set + +MariaDB [test]> DROP TABLE t; +Query OK, 0 rows affected + +MariaDB [test]> exit +Bye +# End of 11.8 tests diff --git a/mysql-test/main/mysql-interactive.test b/mysql-test/main/mysql-interactive.test index 1c8fc6010f7d3..92d0ab1cdd0a4 100644 --- a/mysql-test/main/mysql-interactive.test +++ b/mysql-test/main/mysql-interactive.test @@ -1,10 +1,11 @@ +# this would need an instrumented ncurses library +source include/not_msan.inc; +source include/not_embedded.inc; +source include/not_windows.inc; +source include/have_innodb.inc; --echo # --echo # regression introduced by MDEV-14448 --echo # -source include/not_embedded.inc; -source include/not_windows.inc; -# this would need an instrumented ncurses library -source include/not_msan.inc; write_file $MYSQL_TMP_DIR/mysql_in; delimiter $ @@ -46,3 +47,45 @@ exec socat -t10 EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in; remove_file $MYSQL_TMP_DIR/mysql_in; --echo # End of 10.11 tests + +--echo # +--echo # MDEV-38922 CLI incorrectly adds "stage done" on REPAIR TABLE output +--echo # +write_file $MYSQL_TMP_DIR/mysql_in; +CREATE TABLE t (c INT) ENGINE=InnoDB; +REPAIR TABLE t; +DROP TABLE t; +exit +EOF +let TERM=dumb; +replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//; +error 0,127; +exec socat -t30 EXEC:"$MYSQL test",pty STDIO < $MYSQL_TMP_DIR/mysql_in; +if ($sys_errno == 127) +{ + remove_file $MYSQL_TMP_DIR/mysql_in; + skip no socat; +} +remove_file $MYSQL_TMP_DIR/mysql_in; + +--echo # +--echo # MDEV-38922 CLI incorrectly adds "stage done" on REPAIR TABLE output on quick mode +--echo # +write_file $MYSQL_TMP_DIR/mysql_in; +CREATE TABLE t (c INT) ENGINE=InnoDB; +REPAIR TABLE t; +DROP TABLE t; +exit +EOF +let TERM=dumb; +replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//; +error 0,127; +exec socat -t30 EXEC:"$MYSQL test -q --quick-max-column-width 6",pty STDIO < $MYSQL_TMP_DIR/mysql_in; +if ($sys_errno == 127) +{ + remove_file $MYSQL_TMP_DIR/mysql_in; + skip no socat; +} +remove_file $MYSQL_TMP_DIR/mysql_in; + +--echo # End of 11.8 tests