Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-2354

Timestamp/Datetime precision lost when using cdc streaming

    XMLWordPrintable

Details

    • MXS-SPRINT-91

    Description

      When trying to run a cdc.py script for a table like:

      CREATE TABLE `names` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `name` varchar(20) DEFAULT NULL,
        `t1` timestamp(3) NOT NULL DEFAULT current_timestamp(3) ON UPDATE current_timestamp(3),
        `t2` datetime(6) DEFAULT NULL,
        PRIMARY KEY (`id`)
      );
      

      data printed for datetime/timestamp field doesn't have milli-/microseconds part.

      For example:

      {"domain": 0, "server_id": 0, "sequence": 0, "event_number": 137636, "timestamp": 1551252268, "event_type": "insert", "id": 1, "name": "x", "t1": "2019-02-27 07:24:28", "t2": "2019-01-01 00:01:01"}
      {"domain": 0, "server_id": 0, "sequence": 0, "event_number": 137637, "timestamp": 1551252316, "event_type": "insert", "id": 2, "name": "x", "t1": "2019-02-27 08:25:30", "t2": "2019-01-01 00:01:01"}
      {"domain": 0, "server_id": 0, "sequence": 0, "event_number": 137638, "timestamp": 1551252369, "event_type": "update_before", "id": 1, "name": "x", "t1": "2019-02-27 07:24:28", "t2": "2019-01-01 00:01:01"}
      {"domain": 0, "server_id": 0, "sequence": 0, "event_number": 137639, "timestamp": 1551252369, "event_type": "update_after", "id": 1, "name": "y", "t1": "2019-02-27 07:26:09", "t2": "2019-01-01 00:01:01"}
      

      while data in the table looks like this:

      MariaDB [test]> select * from names;
      +----+------+-------------------------+----------------------------+
      | id | name | t1                      | t2                         |
      +----+------+-------------------------+----------------------------+
      |  1 | y    | 2019-02-27 07:26:09.773 | 2019-01-01 00:01:01.120000 |
      |  2 | x    | 2019-02-27 08:25:30.111 | 2019-01-01 00:01:01.120000 |
      +----+------+-------------------------+----------------------------+
      2 rows in set (0.001 sec)
      

      Attachments

        Activity

          People

            markus makela markus makela
            bikeholik Krzysztof Lewandowski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.