tencent cloud

All product documents
TencentDB for MySQL
Instructions
Last updated: 2024-07-22 12:50:43
Instructions
Last updated: 2024-07-22 12:50:43
TXRocks is a transactional storage engine developed by Tencent's TXSQL team based on RocksDB. It saves more storage space and has a lower write amplification.

Product Overview

By leveraging the LSM tree storage structure of RocksDB, the TXRocks transactional storage engine not only reduces wastes caused by InnoDB's half-full pages and fragments, but also uses the compact storage format. Therefore, it has a performance comparable to that of InnoDB but requires only a half or even smaller storage space. It is more suitable for businesses with a large data volume and high requirements for the transactional read/write performance.

Prerequisites

The database version must be MySQL 5.7 or 8.0 on a two-node architecture.

Purchasing TencentDB for MySQL Instance (with RocksDB Engine)

You can select RocksDB as the engine when purchasing an instance on the TencentDB for MySQL purchase page. For more information on other parameters, see Creating MySQL Instance.

Note:
RocksDB is a key-value storage engine, with efficient writing and high compression. Currently, only TencentDB for MySQL 5.7 and 8.0 instances can use the RocksDB engine.

Creating RocksDB Table

If RocksDB is selected as the default engine during instance creation, it will be the default engine used for table creation. You can run the following command to view the default engine:
show variables like '%default_storage_engine%';

If the default engine is RocksDB, you cannot specify a storage engine in table creation statements:

After a table is created, its data will be stored in RocksDB and can be used in the same way as in InnoDB.

Engine Feature Limits

TXRocks has certain limits on engine features as detailed below:
Category
Feature
TXRocks Limit
DDL
Online DDL
Not supported. For example, `ALTER TABLE ... ALOGRITHM=INSTANT` is not supported. Only the `COPY` algorithm is supported for partition management operations.
SQL
Foreign key
Not supported.
Partitioned table
Not supported.
Generated column
Not supported.
Explicit DEFAULT expression
Not supported. For example, `CREATE TABLE t1(c1 FLOAT DEFAULT(RAND()))ENGINE=ROCKSDB` will fail, with the error `'Specited storage engine' is not supported for default value expressions` reported.
Encrypted table
Not supported.
Index
Spatial index
The spatial index and spatial data types such as `GEOMETRY` and `POINT` are not supported.
Full-text index
Not supported.
Multi-valued index
Not supported.
Replication
Group replication
Not supported.
Binlog format
Only the `ROW` format is supported, while `STMT` and `MIXED` formats are not.
Clone plugin
Not supported.
Transportable tablespace
Not supported.
Transaction and lock
LOCK NOWAIT and SKIP LOCKED
Not supported.
Gap lock
Not supported.
Savepoint
Not supported.
Partial LOB field update
Not supported.
XA transaction
Not recommended.

Parameter Description

Note:
When creating a TencentDB for MySQL instance, you can select RocksDB as the default storage engine. You can also customize the parameter template to suit your needs by following the parameter descriptions below.

MySQL 5.7 parameter list

Parameter
Restart Required
Default Value
Value Range/Valid Values
Description
rocksdb_use_direct_io_for_flush_and_compaction
Yes
ON
ON/OFF
Whether to use DIO during compaction.
rocksdb_flush_log_at_trx_commit
No
1
0/1/2
Controls when to write logs to the disk.
It is similar to innodb_flush_log_at_trx_commit and indicates whether transactions need to be synced when being committed.
0: Transactions are not synced when being committed.
1: Transactions are synced when being committed.
2: Transactions are synced once every second.
rocksdb_lock_wait_timeout
No
1
1–1073741824
Lock wait timeout period in seconds.
rocksdb_deadlock_detect
No
ON
ON/OFF
Whether to enable deadlock detection. After it is enabled, all deadlock information will be recorded in mysqld error logs.
rocksdb_manual_wal_flush
Yes
ON
ON/OFF
If the total size of WAL files exceeds rocksdb_max_total_wal_size, RocksDB will forcibly flush the column family to the disk to ensure that the oldest WAL file can be deleted.

MySQL 8.0 parameter list

Parameter
Restart Required
Default Value
Value Range/Valid Values
Description
rocksdb_flush_log_at_trx_commit
No
1
0/1/2
Controls when to write logs to the disk.
It is similar to innodb_flush_log_at_trx_commit and indicates whether transactions need to be synced when being committed.
0: Transactions are not synced when being committed.
1: Transactions are synced when being committed.
2: Transactions are synced once every second.
rocksdb_lock_wait_timeout
No
1
1–1073741824
Lock wait timeout period in seconds.
rocksdb_merge_buf_size
No
524288(=512K)
100–18446744073709551615
Size of the merge-sort buffer used during secondary index creation.
rocksdb_merge_combine_read_size
No
8388608 (=8M)
524288(=512K)–18446744073709551615
Size of the memory used by k-way merge during secondary index creation.
rocksdb_deadlock_detect
No
ON
ON/OFF
Whether to enable deadlock detection.
rocksdb_manual_wal_flush
Yes
ON
ON/OFF
If the total size of WAL files exceeds rocksdb_max_total_wal_size, RocksDB will forcibly flush the column family to the disk to ensure that the oldest WAL file can be deleted.

RocksDB Monitoring Metrics

RocksDB monitoring metrics are as listed below:
Metric
Description
rocksdb_bytes_read
Data read from disk
rocksdb_bytes_written
Data written to disk
rocksdb_block_cache_bytes_read
Blocks read
rocksdb_block_cache_bytes_write
Blocks written
rocksdb_wal_log_capacity
Data written to WAL log
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support