Bug #118244 mysqlsh 8.4.5 failing util.checkForServerUpgrade() and util.help("checkForServerUpgrade")
Submitted: 21 May 19:47 Modified: 23 May 5:57
Reporter: Joe Creighton Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Shell Upgrade Checker Severity:S1 (Critical)
Version:8.4.5 OS:Linux
Assigned to: CPU Architecture:x86

[21 May 19:47] Joe Creighton
Description:
Running these commands in mysqlsh 8.0.41 succeeds; attempting to run them in mysqlsh 8.4.5 fails.  I thought it was due to carriage-return parsing but running "\status" works in both.  Interactive results below will be trimmed (...) for brevity; command line tests also included

How to repeat:
#
# working interactive test
#
$ mysql-8.0/shell/bin/mysqlsh --host=localhost --user=sa --port=3306
MySQL Shell 8.0.41
...
Your MySQL connection id is 2321
Server version: 8.0.41-commercial MySQL Enterprise Server - Commercial
...
 MySQL  localhost:3307 ssl  JS > \status
MySQL Shell version 8.0.41

Connection Id:                2321
Current schema:
Current user:                 sa@localhost
...
 MySQL  localhost:3307 ssl  JS > util.help("checkForServerUpgrade")
NAME                                                                                                           checkForServerUpgrade - Performs series of tests on specified MySQL                                                              server to check if the upgrade process will                                                              succeed.
...
 MySQL  localhost:3307 ssl  JS > util.checkForServerUpgrade()
The MySQL server at localhost:3307, version 8.0.41-commercial - MySQL
Enterprise Server - Commercial, will now be checked for compatibility issues
for upgrade to MySQL 8.0.41...
Util.checkForServerUpgrade: Detected MySQL Server version is 8.0.41. MySQL Shell cannot check MySQL server instances for upgrade if they are at a version the same as or higher than the MySQL Shell version. (ArgumentError)

#
# breaking interactive test
#
$ mysql-8.4/shell/bin/mysqlsh --host=localhost --user=sa --port=3306
MySQL Shell 8.4.5
...
Your MySQL connection id is 2316
Server version: 8.0.41-commercial MySQL Enterprise Server - Commercial
...
 MySQL  localhost:3307 ssl  SQL > \status
MySQL Shell version 8.4.5

Connection Id:                2316
Current schema:
Current user:                 sa@localhost
...
# normally, entering a new line executes the statement (like the above)
# but the parser isn't happy with either command and expects more:
 MySQL  localhost:3307 ssl  SQL > util.help("checkForServerUpgrade")                            
                               ->
                               -> util.checkForServerUpgrade()
                               -> ;
ERROR: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'util.help("checkForServerUpgrade")
#
# checking the previous command (up arrow) shows this:
#
 MySQL  localhost:3307 ssl  SQL > util.help("checkForServerUpgrade")  util.checkForServerUpgrade()  ;

#
# working command line test
#
$ mysql-8.0/shell/bin/mysqlsh --socket=/var/lib/mysql/mysql.sock --user=sa --host=localhost --port=3306 -e "util.checkForServerUpgrade()"
The MySQL server at localhost:3306, version 8.0.41-commercial - MySQL
Enterprise Server - Commercial, will now be checked for compatibility issues
for upgrade to MySQL 8.0.41...
Util.checkForServerUpgrade: Detected MySQL Server version is 8.0.41. MySQL Shell cannot check MySQL server instances for upgrade if they are at a version the same as or higher than the MySQL Shell version. (ArgumentError)
 at (command line):1

#
# broken command line test
#
$ mysql-8.4/shell/bin/mysqlsh --socket=/var/lib/mysql/mysql.sock --user=sa --host=localhost --port=3306 -e "util.checkForServerUpgrade()"
ERROR: 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'util.checkForServerUpgrade()' at line 1
[22 May 2:18] Tsubasa Tanaka
I seem you hit this incompatibility.

> MySQL Shell's default mode is changed from js (JavaScript) to sql in this release.

https://dev.mysql.com/doc/relnotes/mysql-shell/8.4/en/news-8-4-0.html

Could you try --js option?

```
mysql-8.4/shell/bin/mysqlsh --js --socket=/var/lib/mysql/mysql.sock --user=sa --host=localhost --port=3306 -e "util.checkForServerUpgrade()"
```

From MySQL user group in Japan
[22 May 13:54] Joe Creighton
Adding the --js option worked: I'm able to run the upgrade check normally.

My mistake was expanded by using the MySQL 8.0 documentation out of habit.  Checking the MySQL 8.4 documentation, it clearly states the change in a new note:
https://dev.mysql.com/doc/mysql-shell/8.4/en/mysql-shell-utilities-upgrade.html

Thanks very much for pointing me to this.
[23 May 5:57] MySQL Verification Team
Thank you for the feedback and update.