You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "mjsax (via GitHub)" <gi...@apache.org> on 2024/12/18 00:40:37 UTC
[PR] KAFKA-13722: Refactor SerdeGetter [kafka]
mjsax opened a new pull request, #18242:
URL: https://github.com/apache/kafka/pull/18242
Refactor SerdeGetter to not use old ProcessorContext any longer.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13722: Refactor SerdeGetter [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on PR #18242:
URL: https://github.com/apache/kafka/pull/18242#issuecomment-2550686533
Java 23:
```
Found 5 test failures:
FAILED ❌ UserQuotaTest > testThrottledProducerConsumer(String, String).quorum=kraft.groupProtocol=consumer
FAILED ❌ UserQuotaTest > testQuotaOverrideDelete(String, String).quorum=kraft.groupProtocol=classic
FAILED ❌ UserQuotaTest > testQuotaOverrideDelete(String, String).quorum=kraft.groupProtocol=consumer
FAILED ❌ PlaintextAdminIntegrationTest > testConsumerGroupsDeprecatedConsumerGroupState(String, String).quorum=kraft.groupProtocol=consumer
FAILED ❌ PlaintextAdminIntegrationTest > testConsumerGroups(String, String).quorum=kraft.groupProtocol=consumer
```
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13722: Refactor SerdeGetter [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on PR #18242:
URL: https://github.com/apache/kafka/pull/18242#issuecomment-2552547390
Cherry-picked to `4.0` branch.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13722: Refactor SerdeGetter [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #18242:
URL: https://github.com/apache/kafka/pull/18242#issuecomment-2551020408
testThrottledProducerConsumer -> https://issues.apache.org/jira/browse/KAFKA-8073
testQuotaOverrideDelete -> https://issues.apache.org/jira/browse/KAFKA-8032
testConsumerGroupsDeprecatedConsumerGroupState -> https://issues.apache.org/jira/browse/KAFKA-18298
testConsumerGroups -> https://issues.apache.org/jira/browse/KAFKA-18297
testOutdatedCoordinatorAssignment -> https://issues.apache.org/jira/browse/KAFKA-15900
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13722: Refactor SerdeGetter [kafka]
Posted by "cadonna (via GitHub)" <gi...@apache.org>.
cadonna commented on code in PR #18242:
URL: https://github.com/apache/kafka/pull/18242#discussion_r1889793084
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/SerdeGetter.java:
##########
@@ -18,37 +18,32 @@
import org.apache.kafka.common.serialization.Serde;
import org.apache.kafka.streams.processor.StateStoreContext;
+import org.apache.kafka.streams.processor.api.ProcessorContext;
/**
* Allows serde access across different context types.
*/
public class SerdeGetter {
- private final org.apache.kafka.streams.processor.ProcessorContext oldProcessorContext;
- private final org.apache.kafka.streams.processor.api.ProcessorContext newProcessorContext;
+ private final ProcessorContext<?, ?> processorContext;
private final StateStoreContext stateStorecontext;
- public SerdeGetter(final org.apache.kafka.streams.processor.ProcessorContext context) {
- oldProcessorContext = context;
- newProcessorContext = null;
- stateStorecontext = null;
- }
- public SerdeGetter(final org.apache.kafka.streams.processor.api.ProcessorContext context) {
- oldProcessorContext = null;
- newProcessorContext = context;
+
+ public SerdeGetter(final ProcessorContext<?, ?> context) {
+ processorContext = context;
stateStorecontext = null;
}
+
public SerdeGetter(final StateStoreContext context) {
- oldProcessorContext = null;
- newProcessorContext = null;
+ processorContext = null;
stateStorecontext = context;
}
- public Serde keySerde() {
- return oldProcessorContext != null ? oldProcessorContext.keySerde() :
- newProcessorContext != null ? newProcessorContext.keySerde() : stateStorecontext.keySerde();
+
+ public Serde<?> keySerde() {
+ return processorContext != null ? processorContext.keySerde() : stateStorecontext.keySerde();
}
- public Serde valueSerde() {
- return oldProcessorContext != null ? oldProcessorContext.valueSerde() :
- newProcessorContext != null ? newProcessorContext.valueSerde() : stateStorecontext.valueSerde();
+
+ public Serde<?> valueSerde() {
+ return processorContext != null ? processorContext.valueSerde() : stateStorecontext.valueSerde();
Review Comment:
@chia7712 I like your proposal!
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13722: Refactor SerdeGetter [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #18242:
URL: https://github.com/apache/kafka/pull/18242
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13722: Refactor SerdeGetter [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #18242:
URL: https://github.com/apache/kafka/pull/18242#discussion_r1889740367
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/SerdeGetter.java:
##########
@@ -18,37 +18,32 @@
import org.apache.kafka.common.serialization.Serde;
import org.apache.kafka.streams.processor.StateStoreContext;
+import org.apache.kafka.streams.processor.api.ProcessorContext;
/**
* Allows serde access across different context types.
*/
public class SerdeGetter {
- private final org.apache.kafka.streams.processor.ProcessorContext oldProcessorContext;
- private final org.apache.kafka.streams.processor.api.ProcessorContext newProcessorContext;
+ private final ProcessorContext<?, ?> processorContext;
private final StateStoreContext stateStorecontext;
- public SerdeGetter(final org.apache.kafka.streams.processor.ProcessorContext context) {
- oldProcessorContext = context;
- newProcessorContext = null;
- stateStorecontext = null;
- }
- public SerdeGetter(final org.apache.kafka.streams.processor.api.ProcessorContext context) {
- oldProcessorContext = null;
- newProcessorContext = context;
+
+ public SerdeGetter(final ProcessorContext<?, ?> context) {
+ processorContext = context;
stateStorecontext = null;
}
+
public SerdeGetter(final StateStoreContext context) {
- oldProcessorContext = null;
- newProcessorContext = null;
+ processorContext = null;
stateStorecontext = context;
}
- public Serde keySerde() {
- return oldProcessorContext != null ? oldProcessorContext.keySerde() :
- newProcessorContext != null ? newProcessorContext.keySerde() : stateStorecontext.keySerde();
+
+ public Serde<?> keySerde() {
+ return processorContext != null ? processorContext.keySerde() : stateStorecontext.keySerde();
}
- public Serde valueSerde() {
- return oldProcessorContext != null ? oldProcessorContext.valueSerde() :
- newProcessorContext != null ? newProcessorContext.valueSerde() : stateStorecontext.valueSerde();
+
+ public Serde<?> valueSerde() {
+ return processorContext != null ? processorContext.valueSerde() : stateStorecontext.valueSerde();
Review Comment:
The IDE incorrectly assumes that `stateStoreContext.valueSerde()` might throw a NPE. To eliminate this false alert, perhaps we can retain the Supplier<Serde<?>> instead.
```java
private final Supplier<Serde<?>> keySerdeSupplier;
private final Supplier<Serde<?>> valueSerdeSupplier;
public SerdeGetter(final ProcessorContext<?, ?> context) {
keySerdeSupplier = context::keySerde;
valueSerdeSupplier = context::valueSerde;
}
public SerdeGetter(final StateStoreContext context) {
keySerdeSupplier = context::keySerde;
valueSerdeSupplier = context::valueSerde;
}
public Serde<?> keySerde() {
return keySerdeSupplier.get();
}
public Serde<?> valueSerde() {
return valueSerdeSupplier.get();
}
```
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-13722: Refactor SerdeGetter [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on PR #18242:
URL: https://github.com/apache/kafka/pull/18242#issuecomment-2550688279
Java 17:
```
Found 1 test failures:
FAILED ❌ CooperativeConsumerCoordinatorTest > testOutdatedCoordinatorAssignment()
```
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org