gabriellefu commented on code in PR #23184:
URL: https://github.com/apache/kafka/pull/23184#discussion_r3831339235
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/InMemorySessionStore.java:
##########
@@ -476,25 +476,29 @@ public <R> QueryResult<R> query(final Query<R> query,
final PositionBound positionBound,
final QueryConfig config) {
- synchronized (position) {
- // Mirror RocksDBStore#query: under READ_UNCOMMITTED, expose the
writes staged in the
- // transaction buffer since the last commit by merging the
buffer's pending position
- // deltas into a copy of the committed position. READ_COMMITTED
(and the
- // non-transactional store) query the committed position directly.
- final Position queryPosition;
- if (transactionBuffer != null && config.getIsolationLevel() ==
IsolationLevel.READ_UNCOMMITTED) {
- queryPosition =
position.copy().merge(transactionBuffer.pendingPosition());
- } else {
- queryPosition = position;
+ // Lock order must match the write paths (store monitor, then
position),
+ // otherwise concurrent put/query can deadlock (KAFKA-19629).
+ synchronized (this) {
Review Comment:
I have dropped it, thanks
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/InMemoryWindowStore.java:
##########
@@ -488,25 +488,29 @@ public <R> QueryResult<R> query(final Query<R> query,
final PositionBound positionBound,
final QueryConfig config) {
- synchronized (position) {
- // Mirror RocksDBStore#query: under READ_UNCOMMITTED, expose the
writes staged in the
- // transaction buffer since the last commit by merging the
buffer's pending position
- // deltas into a copy of the committed position. READ_COMMITTED
(and the
- // non-transactional store) query the committed position directly.
- final Position queryPosition;
- if (transactionBuffer != null && config.getIsolationLevel() ==
IsolationLevel.READ_UNCOMMITTED) {
- queryPosition =
position.copy().merge(transactionBuffer.pendingPosition());
- } else {
- queryPosition = position;
+ // Lock order must match the write paths (store monitor, then
position),
+ // otherwise concurrent put/query can deadlock (KAFKA-19629).
+ synchronized (this) {
Review Comment:
same as above
--
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]