SingleStore DB

Upgrade to SingleStore DB 7.5

Caution

As of MemSQL 7.0, more disk space is required than with MemSQL 6.x for columnstore tables and the new replication mechanism, and introduces additional metadata for columnstore tables to improve performance for concurrent updates/deletes and selective filtering. Specifically:

  • An auto-incr value for every row has been introduced, which is persisted in blobs and requires approximately 8 bytes per columnstore row.

  • Database logs are now pre-allocated as of MemSQL 7.0:

    • Each system database requires an additional 32MB of disk space for pre-allocated log space. This equates to an additional 96MB per node.

    • Each reference (ref) database requires two pre-allocated log files. The size of each log file is 64MB, for a total of 128MB of disk space per ref database per node. See the Sync Variables List for more information on changing the ref database log file size via the log_file_size_ref_dbs global variable.

    • Each partition now requires two pre-allocated log files. The size of each log file is 256MB, for a total of 512MB of disk space for pre-allocated log space. See the Sync Variables List for more information on changing the partition log file size via the log_file_size_partitions global variable.

    • Logs will require (snapshot_trigger_size * snapshots_to_keep) of space over time (approximately), or about 4GB per partition using the default values of these variables. Customers are recommended to have twice this amount of disk space available for long-term log storage. See the Sync Variables List for more information on snapshot_trigger_size and snapshots_to_keep.

    • WARNING: Changing the log file size will not affect existing databases. Reducing the size of existing log files or allocating new ones will have random and severe performance impacts on your workload when new log files need to be allocated.

  • If any host in the cluster is near or at disk capacity, please increase available storage before upgrading to SingleStore DB 7.5. Similarly, a newly deployed SingleStore DB 7.5 cluster will consume more disk space than a MemSQL 6.8 cluster running the same workload.

This topic describes how to upgrade SingleStore DB to 7.5. Please read the following information thoroughly before upgrading to SingleStore DB 7.5.

After you have finished upgrading, please see the Post-Upgrade Considerations section for additional information on behavioral changes that you should be aware of.

Important notes about upgrading

If upgrading from a version of MemSQL earlier than 7.0, please note the following.

Upgrade duration and behavior

Anticipate a longer upgrade time for each node. At the end of the upgrade process, anticipate a multi-minute delay while final checks are run that ensure the upgrade completed successfully and the cluster is ready for operation. If you connect to the cluster while these post-upgrade checks are running, you will receive an error that the upgrade is still in progress.

Compound keys

In compound keys with the UNIQUE constraint, if the type of the first column of the key is specified as NOT NULL, that resulted in non-standard UNIQUE constraint behavior for any NULL-able columns in that same compound key. This behavior has been changed as of MemSQL 7.0 to treat all columns the same, independent of position in the key, conforming to the SQL standard.

Delete performance

MemSQL 7.0 introduced row-level locking for columnstore update/delete so it can handle more concurrent queries, but for certain scenario it may cause performance degradation (delete on wide table with json column). Set COLUMNSTORE_TABLE_LOCK_THRESHOLD to bypass row-level locking and obtain the previous behavior.

Leaf nodes

In MemSQL 6.x, a leaf node can restart, come back online, and its databases can be queried when the Master Aggregator is offline. As of MemSQL 7.0, a leaf node can restart and recover its databases, but it won’t bring them online unless the Master Aggregator is online. In all versions of SingleStore DB, leaf nodes can safely be restarted when the Master Aggregator is online.

Plancache

Plans in the plancache are dependent upon the specific SingleStore DB patch version, so when you upgrade to a new SingleStore DB version, all previously compiled plans will be invalidated. This means that any queries run against the upgraded cluster will force a one-time plan compilation, which results in slower query times the first time those queries are run. After the plans have been recompiled, they will be stored again in the plancache and query latency will return to nominal values.

Replication

Replication is now synchronous as of MemSQL 7.0 by default. Fail-overs in SingleStore DB 7.5 will not occur unless a replica is in sync with its master. While you will never lose data on fail-overs, you could lose availability if your replicas are out of sync and a node goes down. Refer to Replication and Durability Concepts and Replay Configuration and Error Handling for more information.Replay Configuration and Error Handling

SCHEMA_BINDING for Views

As of MemSQL 7.0, SCHEMA_BINDING for views is off by default. Prior to MemSQL 7.0, SCHEMA_BINDING for views was on by default. As a result, an error will no longer be issued when deleting a table under a view.

Note that this behavior only applies to views that are created after upgrading, and does not apply to views that were created prior to upgrading.

Snapshots

As of MemSQL 7.0, the default value of snapshot_trigger_size has been increased from 256MB to 2GB. This will not be updated automatically on upgrade, and it is recommended that customers make this change post-upgrade to reduce snapshot disk I/O.

Sync variables

As of MemSQL 7.0, a large percentage of system variables have been changed to sync variables. This allows variables to be set on the Master Aggregator, which will then persist and be replicated to the other nodes in the cluster. This obviates the need to manually set these variables in a .cnf file. Use SHOW _SYNC VARIABLES to see the current set of sync variables.

As a consequence of this, when a variable has been changed to a sync variable and has different values on two nodes (for example, a sync variable on Node X has been set to value A, and this sync variable on Node Y has been set to value B), the upgrade will issue a warning, and these variables must be reconciled before they can become sync variables.

To do so, manually update the .cnf file and, using the above example, set the value of the sync variable to either A or B on both nodes. Next, run UPGRADE VARIABLES on the Master Aggregator to enable all the new sync variables. Refer to Engine Variables and update-config for more information.

Non-Sync Variables

convert_nonunique_hash_to_skiplist is set to TRUE by default in SingleStore DB 7.5. This means that any non-unique hash index will be recovered as a skiplist index, any newly created table will also have its non-unique hash indexes created as skiplists. For more information about this engine variable see the Non-Sync Variables List.

Verify your cluster is ready for upgrade

Warning

Only clusters that are running MemSQL/SingleStore DB 7.0 and later can upgrade directly to SingleStore DB 7.5.

If upgrading from MemSQL/SingleStore DB 7.0 and later with DR clusters, we recommend that you upgrade your DR secondary cluster(s) one at a time, and then upgrade your primary cluster last so that replication will continue to work after each upgrade.

To upgrade from MemSQL 6.7 or 6.8, we recommend a two-step upgrade process:

  1. Depending on the version of MemSQL your cluster is running, upgrade to SingleStore DB 7.0, 7.1, or 7.3.

  2. Use this guide to upgrade to SingleStore DB 7.5

To upgrade from MemSQL 6.0 or earlier, we recommend a three-step upgrade process:

  1. Upgrade to MemSQL 6.8

  2. Upgrade to SingleStore DB 7.0, 7.1, or 7.3.

  3. Use this guide to upgrade to SingleStore DB 7.5

Prior to upgrading your cluster, it is recommended that you take a backup as a standard precautionary measure. See Back Up and Restore Data.

In addition, from the master aggregator, run the following commands:

SHOW LEAVES;
SHOW AGGREGATORS;
SHOW CLUSTER STATUS;
EXPLAIN RESTORE REDUNDANCY;
EXPLAIN REBALANCE PARTITIONS;

With the output of these commands, confirm that the following are true:

  • All leaves are online

  • All aggregators are online

  • There are no partitions with Orphan role

  • No Rebalance or restore redundancy is necessary

After you have backed up your data and verified your cluster is ready, you are ready to upgrade your cluster to the latest version of SingleStore DB using either the SingleStore DB management tools.

Upgrade versions and methods

The tables below depicts which versions of SingleStore DB can be upgraded to SingleStore DB 7.5 and the method by which the cluster can be upgraded.

  • Offline upgrade: Your SingleStore DB cluster will be shut down and restarted over the course of the upgrade

  • Online upgrade: Your SingleStore DB cluster will not be shut down over the course of the upgrade

Upgrade via SingleStore DB Toolbox

Upgrade from

Offline upgrade

Online upgrade

7.0

From 7.0.16+

Step 1: Upgrade SingleStore Tools

To upgrade to SingleStore DB 7.5, you must have singlestoredb-toolbox 1.11.3 or later installed prior to the SingleStore DB upgrade process. It is recommended that you use the latest version of singlestoredb-toolbox when upgrading your cluster.

Run the install command to either install singlestoredb-toolbox if it is not already installed, or upgrade an existing version of singlestoredb-toolbox to the latest version of the package.

RHEL/CentOS

sudo yum install singlestoredb-toolbox -y

Debian

sudo apt install singlestoredb-toolbox -y
Upgrade without Internet access

If your cluster does not have internet access, use one of the following buttons to download either the latest RPM or Debian singlestoredb-toolbox package to a location accessible by your cluster:

singlestoredb-toolbox (.rpm)

singlestoredb-toolbox (.deb)

Then, run the install command for the installed package manager and specify the path to the package.

RHEL/CentOS

sudo yum install /path/to/singlestoredb-toolbox.rpm -y

Debian

sudo apt install /path/to/singlestoredb-toolbox.deb -y

Now you are ready to upgrade SingleStore DB.

Step 2: Upgrade SingleStore DB

The simplest and preferred upgrade option is an offline cluster upgrade. It is the least error-prone and easiest to execute; however, it requires downtime as all of the nodes in the cluster will be upgraded at the same time, shutting down the entire cluster for the duration of the upgrade.

If the cluster is running with High Availability, you also have the option to perform an incremental online cluster upgrade, which maintains cluster availability throughout the upgrade process. See the instructions in the Online upgrade section for more details.

Option 1: Offline upgrade

Note: Using this method to upgrade to SingleStore DB 7.5 is referred to as an offline upgrade as your SingleStore DB cluster will be shut down and restarted over the course of the upgrade. Do not shut down your cluster prior to starting the upgrade. If the cluster or individual nodes are offline when the upgrade is started, the upgrade will fail.

Execute the following command to start an offline upgrade.

  1. Confirm that the cluster can be upgraded. The cluster will not be upgraded when running this command.

    sdb-deploy upgrade --precheck-only
    
  2. Upgrade your cluster.

    Note: sdb-deploy upgrade will perform a snapshot of all databases prior to upgrade.

    sdb-deploy upgrade --version 7.5
    

If you do not specify a patch version, your cluster will be upgraded to the latest patch version of SingleStore DB 7.5.

During the upgrade process, you will be prompted to enable synchronous replication on your existing databases, or to leave those databases using the previous asynchronous replication behavior.

Synchronous replication is enabled by default on all new 7.5 databases and provides an extra layer of resiliency in clusters with high availability enabled.

Note: You cannot downgrade from your current version.

If your cluster does not have internet access, use one of the following buttons to download either the latest RPM or Debian singlestoredb-server package to a location accessible by your cluster:

singlestoredb-server (.rpm)

singlestoredb-server (.deb)

The singlestoredb-server package contains both the SingleStore DB binary and the low-level management tool, memsqlctl.

Run the sdb-deploy upgrade command and reference the appropriate package in the --file-path argument. Running upgrade (as opposed to simply upgrading the package via the package manager) will perform an offline restart of all the nodes to make sure the cluster is using the new version.

RHEL/CentOS

sdb-deploy upgrade --file-path /path/to/singlestoredb-server.rpm

Debian

sdb-deploy upgrade --file-path /path/to/singlestoredb-server.deb

Refer to sdb-deploy upgrade for more information.

Once you have finished upgrading all of your nodes, see Post-upgrade considerations for any changes between versions that may impact your cluster.

Option 2: Online upgrade

This upgrade method is referred to as an online upgrade as your SingleStore DB cluster will not be shut down over the course of the upgrade. Nodes will be restarted in a specific sequence to ensure that DML-based workloads will still function. Do not shut down your cluster prior to starting the upgrade. If the cluster or individual nodes are offline when the upgrade is started, the upgrade will fail.

Notice

An online upgrade may fail if a long-running workload that writes to the database is running on the target cluster. We recommend performing an online upgrade only after these workloads have completed.

Toolbox 1.11.7 and later provide the option to retry a failed online upgrade. Should the online upgrade ultimately fail, an offline upgrade will be attempted. Note that the cluster will be shut down and restarted over the course of an offline upgrade.

Execute the following command to start an online upgrade.

  1. Confirm that the cluster can be upgraded. The cluster will not be upgraded when running this command.

    sdb-deploy upgrade --precheck-only
    
  2. Upgrade your cluster.

    Note: sdb-deploy upgrade will perform a snapshot of all databases prior to upgrade.

    sdb-deploy upgrade --online --version 7.5
    

By specifying --version, your cluster will be upgraded to the latest patch version of SingleStore DB 7.5.

During the upgrade process, you will be prompted to enable synchronous replication on your existing databases. While asynchronous replication can still be chosen, the data replication mechanism as of MemSQL 7.0 has been enhanced to the point where synchronous replication is now the recommended choice.

Note: You cannot downgrade from your current version.

If your cluster does not have internet access, use one of the following buttons to download either the latest RPM or Debian singlestoredb-server package to a location accessible by your cluster:

singlestoredb-server (.rpm)

singlestoredb-server (.deb)

The singlestoredb-server package contains both the SingleStore DB binary and the low-level management tool, memsqlctl.

Run the sdb-deploy upgrade --online command and reference the appropriate package in the --file-path argument. Running upgrade (as opposed to simply upgrading the package via the package manager) will perform an offline restart of all the nodes to make sure the cluster is using the new version.

RHEL/CentOS

sdb-deploy upgrade --online --file-path /path/to/singlestoredb-server.rpm

Debian

sdb-deploy upgrade --online --file-path /path/to/singlestoredb-server.deb

Refer to sdb-deploy upgrade for more information.

Once you have finished upgrading all of your nodes, see Post-upgrade considerations for any changes between versions that may impact your cluster.

Post-upgrade considerations

When upgrading to SingleStore DB 7.5, you should be aware of the following changes to system behavior or default configuration settings. The behavior of a cluster upgraded from an earlier version to SingleStore DB 7.5 may differ compared to a newly installed cluster on SingleStore DB 7.5 as described below. Most of the changes fall into two categories:

  • In some versions, the default value for a configuration variable was changed compared to previous versions, but clusters upgraded from earlier versions retain their previous setting, both if it was set to a specific value or if it was not explicitly set and hence using the previous default. In some of these cases, it is recommended to update your configuration to the new default if you were previously using the old default, after appropriate testing.

  • Some new features are automatically enabled by default on newly installed MemSQL 7.5 clusters but not automatically enabled on clusters upgraded from an earlier version to 7.5. In some of these cases, it is recommended to enable the new features, after appropriate testing.

Upgrades to 7.5
  • To reduce your Total Cost of Ownership (TCO), you may be able store data in Universal Storage instead of rowstores. This is because rowstores store their data in RAM, which can be costly. Universal Storage now supports upserts, which were previously only supported in rowstores.

  • You may want to run the command REBALANCE ALL DATABASES. This command rebalances each database in the cluster, in alphabetical order of the database name. When a rebalance runs on a database d, it first considers the placement of the partitions of the other databases in the cluster before rebalancing the partitions of d.

  • You may want to set the cardinality_estimation_levelengine variable to '7.5'; this setting uses sampling and histograms together (when both are available), to improve selectivity estimation. (The default setting is '7.1').

  • Changing the value of the data_conversion_compatibility_level engine variable can change the behavior of expressions in computed columns. Refer to the Data Type Conversion section of Data Types for more information.

  • sp_query_dynamic_param should be turned off if an application breaks post-upgrade due to a change in type conversion behavior. See the Example: Changes in Type Conversion Behavior for more information.

  • Upgrading the cluster, with json_extract_string_collation set to auto (default setting), changes the collation settings for JSON_EXTRACT_STRING from json to server. Refer to In-Depth Variable Definitions for information on json_extract_string_collation settings.