-
Bug
-
Resolution: Done
-
Major
-
1.4.0.Final
-
None
-
False
-
False
-
Undefined
-
Vitess's VStream API has a bug that adds extra whitespaces to Decimal values when the Decimal precision is greater than or equal to 13.
For example, with the following table definition, when inserting 2 rows:
mysql> desc t1; +--------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+---------------+------+-----+---------+-------+ | id | bigint(20) | NO | PRI | NULL | | | decimal_col | decimal(12,4) | NO | | NULL | | | decimal_col2 | decimal(13,4) | NO | | NULL | | +--------------+---------------+------+-----+---------+-------+ mysql> insert into t1 (id, decimal_col, decimal_col2) values (1, 1.23, 1.23); Query OK, 1 row affected (0.01 sec) mysql> insert into t1 (id, decimal_col, decimal_col2) values (2, -1.23, -1.23); Query OK, 1 row affected (0.01 sec)
VStream emits the following 2 ROW events:
row_event { table_name: "test_sharded_keyspace.t1" row_changes { after { lengths: 1 lengths: 6 lengths: 14 values: "11.2300 1.2300" } } } row_event { table_name: "test_sharded_keyspace.t1" row_changes { after { lengths: 1 lengths: 7 lengths: 15 values: "2-1.2300- 1.2300" } } }
I've reported the VStream bug [here|https://vitess.slack.com/archives/C0PQY0PTK/p1610371341082400.] Vitess Connector needs to sanitise DECIMAL string to avoid this case.