-
Notifications
You must be signed in to change notification settings - Fork 25
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
pg2k4j fails when xid
s are between 32-bit int max and unsigned 32-bit int max
#24
Comments
I don’t know enough Java to suggest a fix, but switching to long works for me locally. |
Thanks for submitting @teej we'll get this looked at and fixed this week. |
@teej you're right it does seem that postgres uses unsigned ints for the transaction id field, though I had a tough time finding that info in any postgres documentation. I found this which indicates that the transaction id is unsigned but this seems far from official: http://www.interdb.jp/pg/pgsql05.html . If you found any official documentation that says this please point me in that direction. See this pr for a fix #26 . This pr just changes the xid field from an int to a long as you suggested |
The official Postrgres documentation calls them "32-bit quantities"
https://www.postgresql.org/docs/current/datatype-oid.html The Postgres source defines I wish their documentation was less ambiguous but that's what I've got for ya. Thanks for the fix! |
This issue is fixed in the latest release https://github.com/disneystreaming/pg2k4j/releases/tag/1.0.6 . Please reopen if you see it again and great catch! |
Postgres transaction IDs are of type
xid
, unsigned 32-bit int. pg2k4j assumes they are signed 32-bit ints https://github.com/disneystreaming/pg2k4j/blob/master/src/main/java/com/disneystreaming/pg2k4j/models/SlotMessage.java#L35. This causes JSON parsing of WAL messages into SlotMessage to fail withcom.fasterxml.jackson.core.JsonParseException: Numeric value (...) out of range of int
when a there's an xid between signed 32bit int max and unsigned 32bit int max.The text was updated successfully, but these errors were encountered: