gabriellefu commented on code in PR #23184:
URL: https://github.com/apache/kafka/pull/23184#discussion_r3897569518


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/StoreQueryUtils.java:
##########
@@ -128,29 +128,35 @@ public static <R> QueryResult<R> handleBasicQueries(
         final QueryResult<R> result;
 
         final QueryHandler<?> handler = 
QUERY_HANDLER_MAP.get(query.getClass());
-        synchronized (position) {
-            if (handler == null) {
-                result = QueryResult.forUnknownQueryType(query, store);
-            } else if (context == null || !isPermitted(position, 
positionBound, context.taskId().partition())) {
-                result = QueryResult.notUpToBound(
-                    position,
-                    positionBound,
-                    context == null ? null : context.taskId().partition()
-                );
-            } else {
-                result = ((QueryHandler<R>) handler).apply(
-                    query,
-                    positionBound,
-                    config,
-                    store
-                );
-            }
-            if (config.isCollectExecutionInfo()) {
-                result.addExecutionInfo(
-                    "Handled in " + store.getClass() + " in " + 
(System.nanoTime() - start) + "ns"
-                );
+        // Take the store monitor before the position lock, matching the write 
paths, so a
+        // concurrent put/query cannot deadlock (KAFKA-19629). Callers must 
not hold the
+        // position lock when calling in, unless nothing else locks their 
store monitor

Review Comment:
   sounds good, i'll add it accordingly



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