MySQL Blog Archive
For the latest blogs go to blogs.oracle.com/mysql
MySQL Shell 8.0.17 - What's New?

The MySQL Development team is proud to announce a new version of the MySQL Shell in which the following new features can be highlighted:

  • MySQL Shell Plugins
  • Parallel table import
  • In InnoDB Cluster:
    • Automatic instance provisioning through cloning
    • Automatic server version compatibility handling
    • Simplification of internal recovery accounts

The following enhancements were also introduced:

  • On the X DevAPI area:
    • Support for array indexes in collections
    • Support for overlaps operator in expressions
  • Uniform SQL execution API in classic and X protocol
  • Support for connection attributes
  • New utility functions:
    • shell.unparseUri(…)
    • shell.dumpRows(…)
  • Support for –verbose output
  • Upgrade Checker: Addition of checks for variables on the configuration files

MySQL Shell Plugins

The MySQL Shell now supports user extensions through MySQL Shell Plugins, which includes User Defined Reports (Introduced in 8.0.16) as well as the new Extension Objects introduced in 8.0.17.

The shell global object exposes the following functions which can be used to register new reports, extension objects and functions into extension objects which address specific use cases required by the user:

  • shell.registerReport(name, type, report[, description])
  • shell.createExtensionObject()
  • shell.addExtensionObjectMember(object, name, member[,definition])
  • shell.registerGlobal(name, object[, definition])

Plugins can be written in either JavaScript or Python and used from either of these scripting modes; including Python plugins from JavaScript and vice-versa. Plugins are automatically loaded and can add user defined functions callable from global objects, besides reports that can be displayed from the \show and \watch commands.

MySQL Shell Plugin Demo
MySQL Shell Plugin Demo

Stay tuned,  a series of blog posts will be published to guide you through the new MySQL Shell Plugins, including:

  • MySQL Shell Plugins – Introduction: which is a step by step guide for creating a basic plugin which includes both a custom report and an extension object.
  • MySQL Shell Plugins – Data Validation: which guides you through the different data validation options when registering functions into an extension object.
  • MySQL Shell Plugins – Plugin Groups: which explains how to organize your plugins in a way that they are contained in a single global object.
  • MySQL Shell Plugins – A Python Approach: which explains how to combine python modules with the MySQL Shell Plugins to create complex plugins.

Parallel Data Import

A new high-performance utility for importing dump files into MySQL tables has been added:

  • util.importTable(filename[, options])

This utility parallelizes the LOAD DATA LOCAL INFILE statement, allowing large dump files to be loaded using multiple threads. It will analyze the file and determine ranges that split it in chunks that are fed to a pool of threads, with their own client connections.

The utility can be tuned in different ways to obtain the best performance and supports different dump file formats. The configurable options include:

  • Number of threads to be used on the operation.
  • Selection of the predefined format in which the data is structured (dialect):
    • Comma Separated Values
    • Tab Separated Values
    • JSON
  • Additional options to modify the selected base format: fieldsTerminatedBy, fieldsOptionallyEnclosed, linesTerminatedBy.
  • Data transmission limits: maxRatebytesPerChunk.
  • Additional row operations: skipRows, replaceDuplicates.
  • Selection of the target table: schema, table, columns.
Import Table Utility

Stay tuned, additional blog posts will be released explaining the details of the parallel data import utility.

Standard SQL Execution

Up to 8.0.16 the Shell had different mechanisms for SQL execution using the session object depending on the protocol used to connect to the server (X protocol or MySQL protocol):

  • For X session: session.sql(statement)[.bind(value, values)][.execute()]
  • For classic session: session.runSql(query[, args])

This made impossible to write Shell scripts that were protocol independent when they required SQL execution.

To address this problem, in 8.0.17 the X protocol session class has been extended on the Shell to also support the runSql function exactly as defined in classic session, so the following code is now valid independently of the protocol for the global session:

Admin API Features

The AdminAPI has been improved to provide automatic provisioning for new instances joining the cluster, this is, the new instance will clone the data from a donor and get up to speed into the cluster without any further intervention from the user.

Several compatibility checks have been added into the Admin API to detect and properly report when servers with different versions are used on the same cluster.

A new extended option has been added for the  cluster.status([options]) function to extend the information it returns.

For additional information about the enhancemends on the Admin API and the InnoDB Cluster 8.0.17 refer to MySQL InnoDB Cluster – What’s new in the 8.0.17 release.

Resources

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.17 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/