KAFKA-10179: Pass correct changelog topic to state serdes (#8902)
Until now we always passed the default changelog topic name
to the state serdes. However, for optimized source tables
and global tables the changelog topic is the source topic.
Most serdes do not use the topic name passed to them.
However, if the serdes actually use the topic name for
(de)serialization a
org.apache.kafka.common.errors.SerializationException is thrown.
This commits passed the correct changelog topic to the state
serdes of the metered state stores.
Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>, Matthias J. Sax <matthias@confluent.io>, John Roesler <vvcephei@apache.org>
@ -45,24 +45,23 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
@@ -45,24 +45,23 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
@ -95,7 +94,7 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
@@ -95,7 +94,7 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
@Override
publicFilestateDir(){
returnstateManager.baseDir();
returnstateManager().baseDir();
}
@Override
@ -110,7 +109,7 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
@@ -110,7 +109,7 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
thrownewIllegalStateException("Can only create state stores during initialization.");
}
Objects.requireNonNull(store,"store must not be null");
@ -223,6 +222,11 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
@@ -223,6 +222,11 @@ public abstract class AbstractProcessorContext implements InternalProcessorConte
@ -73,6 +72,8 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@@ -73,6 +72,8 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@ -80,20 +81,20 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@@ -80,20 +81,20 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@ -128,12 +129,10 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@@ -128,12 +129,10 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
thrownewStreamsException("Failed to read checkpoints for global state globalStores",e);
@ -226,7 +225,7 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@@ -226,7 +225,7 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@ -402,4 +401,8 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@@ -402,4 +401,8 @@ public class GlobalStateManagerImpl implements GlobalStateManager {
@ -49,7 +50,8 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@@ -49,7 +50,8 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@ -57,7 +59,8 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@@ -57,7 +59,8 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
finalProcessorStateManagerstateMgr,
finalStreamsMetricsImplmetrics,
finalThreadCachecache){
super(id,config,metrics,stateMgr,cache);
super(id,config,metrics,cache);
stateManager=stateMgr;
}
@Override
@ -96,15 +99,9 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@@ -96,15 +99,9 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@ -118,16 +115,20 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@@ -118,16 +115,20 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@ -147,8 +147,8 @@ public class ProcessorStateManager implements StateManager {
@@ -147,8 +147,8 @@ public class ProcessorStateManager implements StateManager {
@ -174,7 +174,7 @@ public class ProcessorStateManager implements StateManager {
@@ -174,7 +174,7 @@ public class ProcessorStateManager implements StateManager {
@ -182,7 +182,6 @@ public class ProcessorStateManager implements StateManager {
@@ -182,7 +182,6 @@ public class ProcessorStateManager implements StateManager {
@ -559,13 +558,13 @@ public class ProcessorStateManager implements StateManager {
@@ -559,13 +558,13 @@ public class ProcessorStateManager implements StateManager {
// NOTE we assume the partition of the topic can always be inferred from the task id;
// if user ever use a custom partition grouper (deprecated in KIP-528) this would break and
// it is not a regression (it would always break anyways)
@ -590,4 +589,25 @@ public class ProcessorStateManager implements StateManager {
@@ -590,4 +589,25 @@ public class ProcessorStateManager implements StateManager {
@ -88,4 +88,9 @@ public class GlobalStateManagerStub implements GlobalStateManager {
@@ -88,4 +88,9 @@ public class GlobalStateManagerStub implements GlobalStateManager {
@ -145,4 +145,9 @@ public class MockInternalProcessorContext extends MockProcessorContext implement
@@ -145,4 +145,9 @@ public class MockInternalProcessorContext extends MockProcessorContext implement
@ -45,7 +49,7 @@ public class NoOpProcessorContext extends AbstractProcessorContext {
@@ -45,7 +49,7 @@ public class NoOpProcessorContext extends AbstractProcessorContext {
@ -55,6 +59,11 @@ public class NoOpProcessorContext extends AbstractProcessorContext {
@@ -55,6 +59,11 @@ public class NoOpProcessorContext extends AbstractProcessorContext {
returnnewStreamsConfig(props);
}
@Override
protectedStateManagerstateManager(){
returnnewStateManagerStub();
}
@Override
publicStateStoregetStateStore(finalStringname){
returnnull;
@ -134,4 +143,9 @@ public class NoOpProcessorContext extends AbstractProcessorContext {
@@ -134,4 +143,9 @@ public class NoOpProcessorContext extends AbstractProcessorContext {