Debezium server connect to Vitess issues

65 views
Skip to first unread message

Mars Weng

unread,
Aug 23, 2022, 6:57:27 AM8/23/22
to debezium
Hi there,
I am trying to use the Debezium server to capture CDC log from Vitess,
but encountering several issues:
1. use MySQL connector
debezium.source.connector.class=io.debezium.connector.mysql.MySqlConnector
debezium.source.database.hostname=127.0.0.1
debezium.source.database.port=3306
debezium.source.database.user=orc_client_user
debezium.source.database.password=orc_client_user_password
debezium.source.database.dbname=@rdonly


=>
Caused by: java.sql.SQLException: target: vt_data.0.rdonly: vttablet: rpc error: code = InvalidArgument desc = Unknown system variable 'query_cache_size


2. use Vitess connector

debezium.source.connector.class=io.debezium.connector.vitess.VitessConnector
debezium.source.database.hostname=127.0.0.1
debezium.source.database.port=15991
debezium.source.database.user=orc_client_user
debezium.source.database.password=orc_client_user_password
debezium.source.vitess.tablet.type=RDONLY
debezium.source.vitess.keyspace=commerce


=> weird data type mappings

CREATE TABLE `temp_table` (
  `id` int(11) DEFAULT '0',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `id_str` char(8) COLLATE utf8mb4_bin NOT NULL,
  `quantity` smallint(5) unsigned NOT NULL DEFAULT '1',
  `price` decimal(8,2) unsigned NOT NULL,
  `price2` float NOT NULL,
  `scheme` enum('USER','STORE') COLLATE utf8mb4_bin NOT NULL DEFAULT 'USER',
  `meta` text COLLATE utf8mb4_bin,
  `value` bigint(20) unsigned DEFAULT '0',
  `since` datetime ,
  `modefied_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;




INSERT INTO `temp_table` (`id`, `name`, `id_str` , `quantity`, `price`, `price2`, `scheme`, `meta`, `value`, `since`,`modefied_at`, `created_at`) VALUES ('1', 'test_user','A', '1', '11.11' ,'11.11' ,'USER','official','111','2020-05-07 16:06:11', '2020-05-07 16:06:11', '2020-05-07 16:06:11');

and got

{
    "schema":{
        "type":"struct",
        "fields":[
            ...,
            {
                "type":"struct",
                "fields":[
                    {
                        "type":"int32",
                        "optional":false,
                        "field":"id"
                    },
                    {
                        "type":"bytes",
                        "optional":false,
                        "field":"name"
                    },
                    {
                        "type":"bytes",
                        "optional":false,
                        "field":"id_str"
                    },
                    {
                        "type":"int32",
                        "optional":false,
                        "field":"quantity"
                    },
                    {
                        "type":"string",
                        "optional":false,
                        "field":"price"
                    },
                    {
                        "type":"double",
                        "optional":false,
                        "field":"price2"
                    },
                    {
                        "type":"bytes",
                        "optional":false,
                        "field":"scheme"
                    },
                    {
                        "type":"bytes",
                        "optional":true,
                        "field":"meta"
                    },
                    {
                        "type":"string",
                        "optional":true,
                        "field":"value"
                    },
                    {
                        "type":"string",
                        "optional":true,
                        "field":"since"
                    },
                    {
                        "type":"string",
                        "optional":false,
                        "field":"modefied_at"
                    },
                    {
                        "type":"string",
                        "optional":false,
                        "field":"created_at"
                    }
                ],
                "optional":true,
                "name":"servername.keyspace.temp_table.Value",
                "field":"after"
            },
            ...
        ],
        "optional":false,
        "name":"servername.keyspace.temp_table.Envelope"
    },
    "payload":{
        ...,
        "after":{
            "id":1,
            "name":"dGVzdF91c2Vy",
            "id_str":"QQ==",
            "quantity":1,
            "price":"11.11",
            "price2":11.109999656677246,
            "scheme":"MQ==",
            "meta":"b2ZmaWNpYWw=",
            "value":"111",
            "since":"2020-05-07 16:06:11",
            "modefied_at":"2020-05-07 08:06:11",
            "created_at":"2020-05-07 08:06:11"
        },
        ...,
        "op":"c",
        "ts_ms":1661249086066,
        "transaction":null
    }
}


that column type: char, varchar, decimal, enum, text, bigint
all become "bytes", quite different from the official document

Is there anything I can try?

Thanks,
Mars

Reply all
Reply to author
Forward
0 new messages