...
This KIP introduces a new error type INVALID_
COMPACTION
_KEY
.
It introduces a new non-retriable exception InvalidCompactionKeyException
InvalidKeyException
. Going forward user request will fail without doing retries, if they try to produce to a log compacted topic with a null key.
...
Add a new error code and exception as follows :
Error Code :
INVALID_COMPACTION_KEY
(45, new InvalidCompactionKeyException
InvalidKeyException
("Message key cannot be null for a log compacted topic."))
...
Code Block | ||
---|---|---|
| ||
public class InvalidCompactionKeyExceptionInvalidKeyException extends ApiException { private static final long serialVersionUID = 1L; public InvalidCompactionKeyExceptionInvalidKeyException() { super(); } public InvalidCompactionKeyExceptionInvalidKeyException(String message, Throwable cause) { super(message, cause); } public InvalidCompactionKeyExceptionInvalidKeyException(String message) { super(message); } public InvalidMessageKeyExceptionInvalidKeyException(Throwable cause) { super(cause); } } |
Compatibility, Deprecation, and Migration Plan
- We should It is recommended that we upgrade the clients before the broker is upgraded, so that the clients would be able to understand the new exception. During this phase the broker will still return a
CorruptRecordException
in case it receives a null key message for a log compacted topic and the clients would treat it as a retriable exception. - Once the clients are upgraded, the broker should be upgraded to handle the error scenario more efficiently and throw the non-retriable
InvalidCompactionKeyException
KeyException
. At this point the clients would recognize that its a non-retriable exception and would fail the request without doing any retries.
...