mariadbdebeziummysqlbinlog

Is it possible to have a millisecond precision for the Timestamp in a BinLog?


We are working with a MariaDb 10.4.14 and we stream the binlog with the Debezium suite. We encounter an issue because the Timestamp in the binlog streamer is a uint32 which does not provide a millisecond precision.

Do you know if it is possible to get this precision by changing a config in MariaDb or Debezium for example?


Solution

  • No, it isn't possible, since timestamp is stored in a 32-bit integer.

    The header/description format is defined as follows (from MySQL Connector/C mariadb_rpl.h):

    struct st_mariadb_rpl_format_description_event
    {
      uint16_t format;
      char *server_version;
      uint32_t timestamp;
      uint8_t header_len;
    };
    

    The protocol implementation for a format_description binary log event can be found at the FORMAT_DESCRIPTION_EVENT of Client/Server protocol

    Changing timestamp from uint32_t e.g. to uint64_t or MYSQL_TIME would break the protocol and therefore entire replication but also existing applications which read the binary log.