anshul98ks123 opened a new pull request, #20446:
URL: https://github.com/apache/pinot/pull/20446
## Problem
The Confluent schema registry decoders (Avro, JSON, Protobuf) throw whenever
a message's schema can't be fetched. The realtime consumer then drops the
message and moves past its offset, so a registry outage loses rows that are
still in Kafka. In one production cluster an intermittently failing registry
(connections closed with `SocketException: Unexpected end of file from server`)
dropped about 3.7k rows across 24 tables over two weeks. Nothing re-reads them.
## Root cause
#20137 added `RetriableDecodeException` so that a decoder can ask the
consumer to keep the offset and decode the same message again, but no Confluent
decoder throws it. The Confluent deserializer wraps the registry failure
(`SerializationException` around an `IOException`, `TimeoutException` for 5xx,
and so on) and the decoder rethrows it as an ordinary decode failure.
## Approaches
| Option | Verdict |
|---|---|
| Sleep and re-fetch inside the decoder | Blocks pause, force commit and
stop, and stacks a second backoff on the consumer's |
| Raise the Confluent client's `max.retries` | Still drops once the budget
is spent; already configurable |
| **Classify the failure and throw `RetriableDecodeException`; the
consumer's decode-retry backoff and `decodeRetryMaxDurationMillis` bound it** |
Chosen |
## Change
- New module `pinot-confluent-common` with `SchemaRegistryFailureHandler`,
shared by the three decoders (they already shared nothing else, so it follows
`pinot-avro-base`):
- **Registry unavailable**: network failure, timeout, 401, 403, 408, 429,
500, 502, 503 or 504. Retriable.
- **Schema not found (404)**: retriable for
`schema.registry.notFoundMaxWaitSeconds` (default 600, `0` drops at once),
tracked per registry URL and schema id across decoder instances, so the next
consuming segment carries on with the same window. Then dropped until a message
with that schema decodes.
- **Anything else** (malformed payload, unknown magic byte, other
statuses): dropped as before.
- The Avro, JSON and Protobuf decoders call the handler on failure, and on
success to end a not-found window.
- `decodeRetryMaxDurationMillis=0` in the stream config restores the old
drop-at-once behaviour.
## Testing
- `SchemaRegistryFailureHandlerTest` (24): every status and exception shape
the Confluent deserializer produces, the not-found window with a fake clock,
the limit key, wire-format schema ids.
- Decoder tests against a fake HTTP registry: 503 then recovery,
429/401/403, a connection closed without a response, an unreachable port, 404
with and without the limit, a truncated payload, an unknown magic byte (Avro 7,
JSON 2, Protobuf 2).
- Live on a test cluster with a fault-injecting registry: see the comment
below once posted.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]