Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.2.17
-
None
-
MXS-SPRINT-91
Description
Values in unsigned columns come across in JSON as signed.
In this example, value 8888888 comes across as -7888328.
To reproduce:
CREATE TABLE `unsigned_test` (
`unsigned_test_id` mediumint(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
INSERT INTO `unsigned_test` (`unsigned_test_id`)
VALUES
(3),
(8000000),
(8888888);
JSON Output:
{"namespace": "MaxScaleChangeDataSchema.avro", "type": "record", "name": "ChangeRecord", "fields": [
{"name": "domain", "type": "int"},
{"name": "server_id", "type": "int"},
{"name": "sequence", "type": "int"},
{"name": "event_number", "type": "int"},
{"name": "timestamp", "type": "int"}, {"name": "event_type", "type": {"type": "enum", "name": "EVENT_TYPES", "symbols": ["insert", "update_before", "update_after", "delete"]}},
{"name": "unsigned_test_id", "type": ["null", "int"], "real_type": "mediumint", "length": 8}]}
{"domain": 0, "server_id": 11009, "sequence": 9780915, "event_number": 1, "timestamp": 1547529921, "event_type": "insert", "unsigned_test_id": 3} {"domain": 0, "server_id": 11009, "sequence": 9781001, "event_number": 1, "timestamp": 1547529930, "event_type": "insert", "unsigned_test_id": 8000000} {"domain": 0, "server_id": 11009, "sequence": 9781377, "event_number": 1, "timestamp": 1547529978, "event_type": "insert", "unsigned_test_id": -7888328}