-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[source-mysql] 7084 source mysql regression in 39x date parsing errors #49932
[source-mysql] 7084 source mysql regression in 39x date parsing errors #49932
Conversation
…for fractions of a second an an offset
…for fractions of a second an an offset
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…for fractions of a second an an offset
…for fractions of a second an an offset
.optionalEnd() | ||
.appendOffset("+HH:mm", "Z") | ||
.optionalEnd() | ||
.toFormatter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is painful 😓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found chatgpt useful for generating this kind of code. Even so, it's still annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually gave me wrong advice here, much to my delight
maybe humans still got a chance 🤭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay humans!
val offsetDateTime = | ||
try { | ||
OffsetDateTime.parse(stateValue, formatter) | ||
} catch (_: DateTimeParseException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If value include no +xx:xx
or Z
then we create an offset datetime with an assumed UTC offset.
This is done via a LocalDate.
.optionalEnd() | ||
.appendOffset("+HH:mm", "Z") | ||
.optionalEnd() | ||
.toFormatter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found chatgpt useful for generating this kind of code. Even so, it's still annoying.
} catch (_: DateTimeParseException) { | ||
// if no offset exists, we assume it's UTC | ||
LocalDateTime.parse(stateValue, formatter) | ||
.atOffset(java.time.ZoneOffset.UTC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the qualified class name??
"'2025-09-03T05:23:35Z', '2025-09-03T05:23:35.000000Z'", | ||
"'2025-09-03T05:23:35 Z', '2025-09-03T05:23:35.000000Z'", | ||
"'2025-09-03T05:23:35.12345 +12:34', '2025-09-03T05:23:35.123450+12:34'", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excellent
What
A saved state timestamp with timezone may have a variation due to legacy mysql:
We need to be able to parse all variations in order to be backward compatible with existing states saved by legacy connector.
Once a state was read we should always emit a normalized value when saving back to state.
How
Rather than relying on fallback default
Jsons.valueToTree()
we are declaring a datetime formatter that can accommodate all above variations.User Impact
This should fix syncs jobs that are failing to start to to cursor values saved in an unexpected format.
Can this PR be safely reverted and rolled back?