Skip to content

MySQL-kafka: wrong value for data type timestamp #957

Closed
@asiroliu

Description

@asiroliu

Description

MySQL-kafka: wrong value for data type timestamp

Steps to reproduce the issue

  1. check src MySQL time_zone
mysql> SELECT @@GLOBAL.time_zone, @@SESSION.time_zone;
+--------------------+---------------------+
| @@GLOBAL.time_zone | @@SESSION.time_zone |
+--------------------+---------------------+
| SYSTEM             | SYSTEM              |
+--------------------+---------------------+
1 row in set (0.00 sec)
shell> date
2022年 04月 20日 星期三 13:27:43 CST
  1. insert data on src MySQL
mysql> CREATE DATABASE IF NOT EXISTS `action_db`;
mysql> create table timestamp_columns( id int(11) not null primary key, c_timestamp '
 'timestamp DEFAULT CURRENT_TIMESTAMP)ENGINE=InnoDB DEFAULT CHARSET=utf8;
mysql> insert into timestamp_columns values (0,'1970-01-01 08:00:01');
mysql> insert into timestamp_columns values (1,'2038-01-19 11:14:07');
mysql> insert into timestamp_columns values (2,'2015-08-12 14:57:05');
  1. create dtle job
{
  "job_id": "data_types_default_full_timestamp_columns",
  "is_password_encrypted": false,
  "task_step_name": "all",
  "failover": true,
  "retry": 2,
  "src_task": {
    "task_name": "src",
    "node_id": "1981dac8-c247-d804-f2b0-2e27d74c40ad",
    "mysql_src_task_config": {
      "gtid": "",
      "binlog_relay": false
    },
    "drop_table_if_exists": true,
    "skip_create_db_table": false,
    "repl_chan_buffer_size": 120,
    "chunk_size": 2000,
    "group_max_size": 1,
    "group_timeout": 100,
    "connection_config": {
      "database_type": "MySQL",
      "host": "172.100.9.1",
      "port": 3306,
      "user": "test_src",
      "password": "test_src"
    },
    "replicate_do_db": [
      {
        "table_schema": "action_db",
        "tables": [
          {
            "table_name": "timestamp_columns"
          }
        ]
      }
    ]
  },
  "dest_task": {
    "task_name": "dest",
    "node_id": "3ffe60b0-8a48-32c1-28d6-473c89792fcf",
    "parallel_workers": 1,
    "kafka_topic": "dtle",
    "kafka_broker_addrs": [
      "172.100.9.21:9092"
    ]
  }
}
  1. get kafka message, and compare with dbz

image

5. check src MySQL binlog

image

image

Describe the results you expected

  1. 对于TIMESTAMP,它把客户端插入的时间从当前时区转化为UTC(世界标准时间)进行存储。查询时,将其又转化为客户端当前时区进行返回。
  2. DTLE发送kafka消息时应直接发送UTC时间,而不应做时区转换,因为DTLE不知道消费端的时区。

Output of ./dtle version:**

9.9.9.9-master-a269c29

Metadata

Metadata

Assignees

No one assigned

    Labels

    VERIFIEDverified issuekafkabugs about kafka

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions