You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/10/06 02:37:06 UTC

[GitHub] [kafka] mjsax commented on a change in pull request #11370: MINOR: remove unneeded size and add lock coarsening to inMemoryKeyValueStore

mjsax commented on a change in pull request #11370:
URL: https://github.com/apache/kafka/pull/11370#discussion_r722840836



##########
File path: streams/src/main/java/org/apache/kafka/streams/state/internals/InMemoryKeyValueStore.java
##########
@@ -98,9 +96,15 @@ public synchronized void put(final Bytes key, final byte[] value) {
     }
 
     @Override
-    public void putAll(final List<KeyValue<Bytes, byte[]>> entries) {
+    public synchronized void putAll(final List<KeyValue<Bytes, byte[]>> entries) {
         for (final KeyValue<Bytes, byte[]> entry : entries) {
-            put(entry.key, entry.value);
+            // intended to duplicate codes in #put, to avoid continuously lock/unlock cost

Review comment:
       We should not duplicate code, but instead extract an internal `private` helper method `putInternal` that can be called by `put` and `putAll`




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