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

Regression test for MySQL dates in snapshot being off by one

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • 1.0.0.Final
    • None
    • mysql-connector
    • None

    Description

      From Nikhil Benesch:

      In Debezium 0.9, if the timezone of the JVM running Debezium had an earlier offset than the timezone of the MySQL server, any values of type DATE read by the snapshot reader would be incorrectly shifted backwards by one day. This was the result of a known bug/deficiency in MySQL's JDBC connector.

      This bug was inadvertently fixed in Debezium 0.10 by PR#913, which bypassed the JDBC date retrieval logic to support zero dates, thus also avoiding the inappropriate timezone shifting logic. However, since the fix was inadvertent, there was no test to protect against regression.

      This commit adds such a regression test. Since the MySQL server used in tests uses timezone GMT-11, we just need to run a SnapshotReader in timezone GMT-12 and verify that the dates are computed correctly. This test fails if added to Debezium 0.9, but passes now thanks to #913.

      Humorously, it is likely someone would have noticed this bug long ago had the test MySQL server used any other timezone; for example, if the MySQL server used EST as its timezone, anyone running the tests from the International Date Line to Chicago would have seen the failure. But with GMT-11 there is only one timezone with a smaller offset, GMT-12, which is only used by tiny outlying islands of the US.

      Attachments

        Activity

          People

            Unassigned Unassigned
            gunnar.morling Gunnar Morling
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: