aliehsaeedii commented on code in PR #21513:
URL: https://github.com/apache/kafka/pull/21513#discussion_r2832891251


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredSessionStore.java:
##########
@@ -63,24 +63,24 @@ public class MeteredSessionStore<K, V>
     extends WrappedStateStore<SessionStore<Bytes, byte[]>, Windowed<K>, V>
     implements SessionStore<K, V>, MeteredStateStore {
 
-    private final String metricsScope;
-    private final Serde<K> keySerde;
-    private final Serde<V> valueSerde;
-    private final Time time;
-    private StateSerdes<K, V> serdes;
-    private StreamsMetricsImpl streamsMetrics;
-    private Sensor putSensor;
-    private Sensor fetchSensor;
-    private Sensor flushSensor;
-    private Sensor removeSensor;
-    private Sensor e2eLatencySensor;
-    private Sensor iteratorDurationSensor;
-    private InternalProcessorContext<?, ?> internalContext;
-    private TaskId taskId;
-    private Sensor restoreSensor;
-
-    private final LongAdder numOpenIterators = new LongAdder();
-    private final NavigableSet<MeteredIterator> openIterators = new 
ConcurrentSkipListSet<>(Comparator.comparingLong(MeteredIterator::startTimestamp));
+    protected final String metricsScope;
+    protected final Serde<K> keySerde;
+    protected final Serde<V> valueSerde;
+    protected final Time time;
+    protected StateSerdes<K, V> serdes;
+    protected StreamsMetricsImpl streamsMetrics;
+    protected Sensor putSensor;
+    protected Sensor fetchSensor;
+    protected Sensor flushSensor;
+    protected Sensor removeSensor;
+    protected Sensor e2eLatencySensor;
+    protected Sensor iteratorDurationSensor;
+    protected InternalProcessorContext<?, ?> internalContext;
+    protected TaskId taskId;
+    protected Sensor restoreSensor;
+
+    protected final LongAdder numOpenIterators = new LongAdder();
+    protected final NavigableSet<MeteredIterator> openIterators = new 
ConcurrentSkipListSet<>(Comparator.comparingLong(MeteredIterator::startTimestamp));

Review Comment:
   Let's send empty headers to `keyBytes` or any de/serializer caller of this 
class as we are depcrating the old ones with no headers an input. Thanks



##########
streams/src/main/java/org/apache/kafka/streams/state/internals/MeteredSessionStoreWithHeaders.java:
##########
@@ -0,0 +1,318 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.streams.state.internals;
+
+import org.apache.kafka.common.header.internals.RecordHeaders;
+import org.apache.kafka.common.serialization.Deserializer;
+import org.apache.kafka.common.serialization.Serde;
+import org.apache.kafka.common.serialization.Serializer;
+import org.apache.kafka.common.utils.Bytes;
+import org.apache.kafka.common.utils.Time;
+import org.apache.kafka.streams.internals.ApiUtils;
+import org.apache.kafka.streams.kstream.Windowed;
+import org.apache.kafka.streams.kstream.internals.Change;
+import org.apache.kafka.streams.kstream.internals.WrappingNullableUtils;
+import org.apache.kafka.streams.processor.StateStore;
+import org.apache.kafka.streams.processor.StateStoreContext;
+import org.apache.kafka.streams.processor.internals.ProcessorContextUtils;
+import org.apache.kafka.streams.state.AggregationWithHeaders;
+import org.apache.kafka.streams.state.KeyValueIterator;
+import org.apache.kafka.streams.state.SessionStore;
+import org.apache.kafka.streams.state.SessionStoreWithHeaders;
+import org.apache.kafka.streams.state.StateSerdes;
+
+import java.time.Instant;
+
+import static 
org.apache.kafka.streams.internals.ApiUtils.prepareMillisCheckFailMsgPrefix;
+
+public class MeteredSessionStoreWithHeaders<K, AGG>
+    extends MeteredSessionStore<K, AggregationWithHeaders<AGG>>
+    implements SessionStoreWithHeaders<K, AGG> {
+
+    private final Serde<AGG> rawAggSerde;
+    private StateSerdes<K, AGG> serdes;
+    private AggregationWithHeadersSerializer<AGG> 
aggregationWithHeadersSerializer;
+    private AggregationWithHeadersDeserializer<AGG> 
aggregationWithHeadersDeserializer;
+
+    MeteredSessionStoreWithHeaders(final SessionStore<Bytes, byte[]> inner,
+                                   final String metricsScope,
+                                   final Serde<K> keySerde,
+                                   final Serde<AGG> aggSerde,
+                                   final Time time) {
+        super(inner, metricsScope, keySerde, 
createAggregationWithHeadersSerde(aggSerde), time);
+        this.rawAggSerde = aggSerde;
+    }

Review Comment:
   If it's doable, then we dont need the properties and most of the methods 
except the write ones. Of course we must change  `MeteredSessionStore` to send 
empty headers to `keyBytes` for read methods as well.



-- 
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]

Reply via email to