Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-260

Timestamp field not handle time zone correctly

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 0.5
    • Fix Version/s: 0.6.2
    • Component/s: mysql-connector
    • Labels:
      None
    • Environment:

      MySQL 5.6
      TZ: Asia/Shanghai (+08:00)

      Description

      Timestamp field in mysql is parsed as ZonedDateTime in DBZ, but with different TZ, the date time is always the UTC time.
      For me, the MySQL TZ is Asia/Shanghai (+08:00), a timestamp field '2017/03/14 18:07:52' is stored as epoch seconds 1489486072, which is '2017/3/14 10:07:52 UTC'.
      After parsed by debezium, the time is '2017/03/14 10:07:52+08:00', which is wrong and should be '2017/03/14 18:07:52+08:00'.
      Debug shows that when parsed by RowDesrializers, first the epoch seconds is retrieved from binlog, and convert to UTC time ('2017/03/14 10:07:52'). Then, TZ info is added, but the ZonedDateTime.of(LocalDateTime, ZoneId) just add TZ to date time but not handle the time offset.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jpechanec Jiri Pechanec
                  Reporter:
                  alei.hanami Yelei Wu
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: