Handle zeroed out time when seconds are :00 #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It looks like the datetime type for MySQL does not return the correct value when the seconds part of the datetime is
:00
. For example, the datetime 2023-04-15T12:34:00 in MySQL will end up as2023-04-15T00:00:00
after being processed by this converter.I have narrowed this behavior down to the fact that a Java
LocalDateTime
object is passed to the converter here for datetime:https://github.com/debezium/debezium/blob/main/debezium-connector-mysql/src/main/java/io/debezium/connector/mysql/RowDeserializers.java#L406
The issue is that when the seconds parameter is
:00
the string that is returned omits the seconds piece.So if you run something like:
You get:
The second example comes back without a seconds portion of the datetime string and this doesn't match the
time
portion of the existing regex for this converter. This results in the entire time portion being zeroed out to ->2023-04-15T00:00:00
.The result is that roughly 1 out of 60 timestamps will be wrong (assuming a random distribution of events).
This PR updates the regex to match the
time
group with just hour and minute portions.