Table schema defined with N number of Slices but created with SLICES=3

Nathan Parrish -

Sometimes when creating a table by copying and pasting the schema from the output of a SHOW CREATE TABLE, the table that is created has 3 slices when you defined a different number.

To see this problem in actions:

Schema definition with SHOW CREATE:

mysql> show create table bar\G
*************************** 1. row ***************************
Table: bar
Create Table: CREATE TABLE `bar` (
 `id` int(0)
) CHARACTER SET utf8 /*$ REPLICAS=2 SLICES=3 */

And we paste it back in, modifying the slice count like so:

mysql>  CREATE TABLE `bar` (
    ->   `id` int(0)
    ->   ) CHARACTER SET utf8 /*$ REPLICAS=2 SLICES=30 *
    ->   ;

When running SHOW CREATE TABLE it is still the default 3 slices:

mysql> show create table bar\G
*************************** 1. row ***************************
Table: bar
Create Table: CREATE TABLE `bar` (
 `id` int(0)
) CHARACTER SET utf8 /*$ REPLICAS=2 SLICES=3 */

The reason for this behavior is that mysql client is stripping the comments delimited by /*$ */ before sending the query to the server. It does this regardless of whether you are using mysql client interactively or input queries to stdin.  

The solution is to remove the comment delimiters before submitting these queries to Clustrix.  

Note that clustrix_import will not strip these comments, however unless you disable auto-reslice with -A option, it may apply reslicing logic to the table. 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk