Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone Issue with MySQL JDBC Source Connector Offset #1447

Open
sorakimm opened this issue Dec 16, 2024 · 0 comments
Open

Timezone Issue with MySQL JDBC Source Connector Offset #1447

sorakimm opened this issue Dec 16, 2024 · 0 comments

Comments

@sorakimm
Copy link

Hello,
I am currently using the MySQL JDBC Source Connector. However, I am encountering an issue with the time zone setting for the connector's offset.

I am using a database set to the Asia/Seoul time zone (UTC+9).
The time zone settings of the database are as follows:

[
  {
    "@@GLOBAL.time_zone": "Asia/Seoul",
    "@@SESSION.time_zone": "Asia/Seoul",
    "@@system_time_zone": "UTC"
  }
]

And the configuration of the connector is as follows:

{
  "name": "cdc_mysql_connector",
  "config": {
    "connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
    "connection.url": "jdbc:mysql://<host>:3306/<db_name>?defaultFetchSize=500&useCursorFetch=true"
    "connection.user": "kafka_conn",
    "connection.password": "******",
    "mode": "timestamp",
    "timestamp.column.name": "updated_at",
    "topic.prefix": "cdc_mysql_connector.topic",
    "poll.interval.ms": "60000",
    "value.converter": "org.apache.kafka.connect.json.JsonConverter",
    "key.converter": "org.apache.kafka.connect.storage.StringConverter",
    "validate.non.null": "false",
    "query": "SELECT * FROM connect_table",
    "batch.max.rows": "500",
    "table.poll.interval.ms": "60000",
    "key.converter.schemas.enable": "false",
    "task.class": "io.confluent.connect.jdbc.source.JdbcSourceTask",
    "value.converter.schemas.enable": "false"
  }
}

I expected the connector's offset to be stored based on the current time.
However, the offset is being stored as a future timestamp, 9 hours ahead of the current time.

For example, when the offset value should be stored as 2024-12-16T11:00:00+09:00 (1734314400000), it is instead being stored as a future time, 2024-12-16T20:00:00+09:00 (1734346800000), 9 hours later.

Additionally, when running queries, the data is not retrieved correctly.
The current time is correctly reflected as the end time in the WHERE clause, but the start time seems to be applied as the offset, 9 hours ahead, causing the range to be incorrect.

It seems there is an issue with the time zone conversion in the connector, or perhaps there is something wrong with my configuration.
Could you please help me resolve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant