Skip to main content
Version: 3.5 (unsupported)

Multi-Storage Transactions

ScalarDB transactions can span multiple storages or databases while maintaining ACID compliance by using a feature called multi-storage transactions.

This page explains how multi-storage transactions work and how to configure the feature in ScalarDB.

How multi-storage transactions work in ScalarDB

In ScalarDB, the multi-storage implementation holds multiple storage instances and has mapping from a table name or a namespace name to a proper storage instance. When an operation is executed, the multi-storage transactions feature chooses a proper storage instance from the specified table or namespace by using the table-storage or namespace-storage mapping and uses that storage instance.

How to configure ScalarDB to support multi-storage transactions

To enable multi-storage transactions, you need to specify consensus-commit as the value for scalar.db.transaction_manager, multi-storage as the value for, and configure your databases in the ScalarDB properties file.

The following is an example of configurations for multi-storage transactions:

# Consensus Commit is required to support multi-storage transactions.

# Multi-storage implementation is used for Consensus Commit.

# Define storage names by using a comma-separated format.
# In this case, "cassandra" and "mysql" are used.

# Define the "cassandra" storage.
# When setting storage properties, such as `storage`, `contact_points`, `username`, and `password`, for multi-storage transactions, the format is `scalar.db.multi_storage.storages.<STORAGE_NAME>.<PROPERTY_NAME>`.
# For example, to configure the `scalar.db.contact_points` property for Cassandra, specify `scalar.db.multi_storage.storages.cassandra.contact_point`.

# Define the "mysql" storage.
# When defining JDBC-specific configurations for multi-storage transactions, you can follow a similar format of `scalar.db.multi_storage.storages.<STORAGE_NAME>.<PROPERTY_NAME>`.
# For example, to configure the `scalar.db.jdbc.connection_pool.min_idle` property for MySQL, specify `scalar.db.multi_storage.storages.mysql.jdbc.connection_pool.min_idle`.
# Define the JDBC-specific configurations for the "mysql" storage.

# Define table mappings from a table name to a storage.
# The format is "<TABLE_NAME>:<STORAGE_NAME>,...".

# Define the default storage that's used if a specified table doesn't have any mapping.

For additional configurations, see ScalarDB Configurations.

Hands-on tutorial

For a hands-on tutorial, see Create a Sample Application That Supports Multi-Storage Transactions.