gharris1727 commented on PR #13465:
URL: https://github.com/apache/kafka/pull/13465#issuecomment-1504231021
So I was manually testing this feature and ran across a serialization
problem. Here's the most concise repro case I can think of:
```
$ curl -sSX PATCH -H "Content-Type: application/json"
localhost:8083/connectors/test/offsets -d '{
"offsets": [
{
"partition": {
"float": 1.0
},
"offset": {
"key": "value"
}
}
]
}' | jq .
{
"message": "The Connect framework managed offsets for this connector have
been altered successfully. However, if this connector manages offsets
externally, they will need to be manually altered in the system that the
connector uses."
}
$ curl -X GET localhost:8083/connectors/verifiable-test/offsets | jq .
{
"offsets": [
{
"partition": {
"float": 1
},
"offset": {
"key": "value"
}
}
]
}
$ curl -sSX PATCH -H "Content-Type: application/json"
localhost:8083/connectors/test/offsets -d '{
"offsets": [
{
"partition": {
"float": 1
},
"offset": {
"key": "value"
}
}
]
}' | jq .
{
"message": "The Connect framework managed offsets for this connector have
been altered successfully. However, if this connector manages offsets
externally, they will need to be manually altered in the system that the
connector uses."
}
$ curl -sSX GET localhost:8083/connectors/test/offsets | jq .
{
"offsets": [
{
"partition": {
"float": 1
},
"offset": {
"key": "value"
}
},
{
"partition": {
"float": 1
},
"offset": {
"key": "value"
}
}
]
}
```
The GET portion of the API is mapping decimals `1.0` to the integer-looking
`1`, which is distinct when serialized by the JsonConverter in the offsets
topic. When you copy-paste the result of GET for a subsequent PATCH, it
actually edits a completely different partition, since the equality check (and
kafka keying/compaction) is done by the serialized form.
I think the ConnectorOffset serialization needs to be tweaked to force
showing the decimals, to be consistent with the JsonConverter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]