The MySQL Development team is proud to announce a new version of the MySQL Shell which includes the following features:
- Addition of a reporting framework:
- API to register custom reports.
- Shell command to display a specific report (\show).
- Shell command to monitor a specific report (\watch).
The following enhancements were also introduced:
- Improved printing of SQL results in JSON format.
- Improved InnoDB Cluster support by enhancing the Admin API as follows:
- Adding options to define the number of rejoining attempts allowed for expelled members.
- Improving the content of the cluster status output to include MySQL version of members.
- Support automatic handling of Group Replication protocol versions
- Improved the Upgrade Checker utility with the addition of checks for variables on the configuration files.
Shell Reporting Framework
Monitoring is one of the main activities of a DBA and having the ability to define custom reports is one of the main tools to achieve it. On this release a couple of shell commands have been added to enable monitoring through the usage of user-defined reports:
- The \show shell command enables displaying a previously registered report.
- The \watch shell command enables displaying a report using a refresh interval.
A shell report is defined as a function that receives a session and some arguments and options. This function is registered into the shell reporting framework through the following function:
# Function that will generate the report
def show_processes(session, args, options):
# report body
# Registration of the function into the shell reporting framework
shell.register_report("proc", "list", show_processes,
"brief":"Lists the processes on the target server.",
"brief": "Use this option to list processes over specific commands."}]
Once this report_function is registered, the report is made available through the \show and \watch shell commands and can be invoked despite the active shell mode:
For more information about this topic look at the Reporting section of the MySQL Shell User Guide.
The \sql shell command has been used to switch to SQL mode and allow direct execution of SQL statements using the global session.
On this release, it’s behavior has been improved to receive an optional parameter which is processed as an SQL statement. When the SQL statement is provided, no switch to the SQL mode will be performed, instead, the SQL statement will be executed using the global session and its result will be displayed right away.
When the \sql shell command is executed without any additional parameter, it will switch to SQL mode as before.
Result Printing Improvements
When querying Document Store Collection results were printed as a single JSON document containing:
- Warning Information
- The returned JSON Documents
This has been properly integrated in a way that warnings and statistics are now handled following the same standards as for table results.
Each returned document from a collection is now printed as a separate JSON Document.
For details about the MySQL Shell please take a look at the MySQL Shell User Guide.
For additional details about features introduced by this version and the full list of fixed bugs take a look at the Release Notes.
Specific details about the changes in InnoDB Cluster Support can be found at the MySQL InnoDB Cluster – What’s new in the 8.0.16 release blog post.
Don’t forget to download it and give it a try, your feedback is very welcome!
You can reach us at #shell channel in https://mysqlcommunity.slack.com/