MyRocks limitations¶
Online DDL limitations¶
MyRocks has limited support for Online DDL operations due to the lack of atomic DDL. As a result the schema changes are more restricted compared to InnoDB.
Traditional MyRocks DDL behavior¶
Operation type | Examples | ALGORITHM |
---|---|---|
Index operations | ADD INDEX , DROP INDEX , RENAME INDEX |
INPLACE (always) |
Column changes | ADD COLUMN , DROP COLUMN , MODIFY COLUMN |
COPY (full table rebuild) |
Metadata changes | RENAME TABLE , some RENAME COLUMN operations |
May be INSTANT |
Note: MyRocks does not support atomic DDL. Even metadata-only operations may require a full table rebuild, depending on the nature of the change.
Partition management support¶
As of Percona Server for MySQL 8.0.25-15
, MyRocks supports INPLACE
partition management for certain operations:
ALTER TABLE t1 DROP PARTITION p1, ALGORITHM=INPLACE;
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (MAXVALUE)), ALGORITHM=INPLACE;
VALUES LESS THAN
, still fall back to the COPY
algorithm.
Note: Dropping a partition permanently deletes any data stored in it unless that data is reassigned to another partition.
Instant DDL support¶
As of Percona Server for MySQL 8.0.42-33
, MyRocks introduces limited support for Instant DDL, which is disabled by default and controlled via configuration variables.
To enable specific types of instant operations, use the following configuration options:
Configuration variable | Enables Instant DDL for | ALGORITHM (internal only) |
---|---|---|
rocksdb_enable_instant_ddl_for_append_column=ON |
ALTER TABLE ... ADD COLUMN |
INSTANT |
rocksdb_enable_instant_ddl_for_column_default_changes=ON |
ALTER/MODIFY COLUMN … DEFAULT |
INSTANT |
rocksdb_enable_instant_ddl_for_drop_index_changes=ON |
ALTER TABLE ... DROP INDEX |
INSTANT |
rocksdb_enable_instant_ddl_for_table_comment_changes=ON |
ALTER TABLE ... COMMENT |
INSTANT |
Note: MyRocks does not support ALGORITHM=INSTANT
in SQL syntax. These operations behave like Instant DDL internally, but only if the respective configuration variables are enabled.
Unsupported InnoDB features in MyRocks¶
You should also consider the following:
-
All collations are supported on
CHAR
andVARCHAR
indexed columns. By default, MyRocks prevents creating indexes with non-binary collations (includinglatin1
). You can optionally use it by setting rocksdb_strict_collation_exceptions tot1
(table names with regex format), but non-binary covering indexes other thanlatin1
(excludinggerman1
) still require a primary key lookup to return theCHAR
orVARCHAR
column. -
Either
ORDER BY DESC
orORDER BY ASC
is slow. This is because of “Prefix Key Encoding” feature in RocksDB. See https://www.slideshare.net/matsunobu/myrocks-deep-dive/58 for details. By default, ascending scan is faster and descending scan is slower. If the “reverse column family” is configured, then descending scan will be faster and ascending scan will be slower. Note that InnoDB also imposes a cost when the index is scanned in the opposite order. -
When converting from large MyISAM/InnoDB tables, either by using the
ALTER
orINSERT INTO SELECT
statements it’s recommended that you check the Data loading documentation and create MyRocks tables as below (in case the table is sufficiently big it will cause the server to consume all the memory and then be terminated by the OOM killer):
SET session sql_log_bin=0;
SET session rocksdb_bulk_load=1;
ALTER TABLE large_myisam_table ENGINE=RocksDB;
SET session rocksdb_bulk_load=0;
Expected output
.. warning::
If you are loading large data without enabling :ref:`rocksdb_bulk_load`
or :ref:`rocksdb_commit_in_the_middle`, please make sure transaction
ize is small enough. All modifications of the ongoing transactions are
kept in memory.
-
With partitioned tables that use the TokuDB or MyRocks storage engine, the upgrade only works with native partitioning.
-
Percona Server for MySQL 8.0 and Unicode 9.0.0 standards have defined a change in the handling of binary collations. These collations are handled as NO PAD, trailing spaces are included in key comparisons. A binary collation comparison may result in two unique rows inserted and does not generate a`DUP_ENTRY` error. MyRocks key encoding and comparison does not account for this character set attribute.
Not supported on MyRocks¶
MyRocks does not support the following:
-
Operating as either a source or a replica in any replication topology that is not exclusively row-based. Statement-based and mixed-format binary logging is not supported. For more information, see Replication Formats.
-
Using multi-valued indexes. Implemented in Percona Server for MySQL 8.0.17, InnoDB supports this feature.
-
Using spatial data types .
-
Using the Clone Plugin and the Clone Plugin API. As of Percona Server for MySQL 8.0.17, InnoDB supports either these features.
-
Using encryption in tables. At this time, during an
ALTER TABLE
operation, MyRocks mistakenly detects all InnoDB tables as encrypted. Therefore, any attempt toALTER
an InnoDB table to MyRocks fails.As a workaround, we recommend a manual move of the table. The following steps are the same as the
ALTER TABLE ... ENGINE=...
process:-
Use
SHOW CREATE TABLE ...
to return the InnoDB table definition. -
With the table definition as the source, perform a
CREATE TABLE ... ENGINE=RocksDB
. -
In the new table, use
INSERT INTO <new table> SELECT \* FROM <old table>
.
Note
With MyRocks and with large tables, it is recommended to set the session variable
rocksdb_bulk_load=1
during the load to prevent running out of memory. This recommendation is because of the MyRocks large transaction limitation. For more information, see MyRocks Data Loading -