You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "zhang-arvin (via GitHub)" <gi...@apache.org> on 2026/09/08 07:21:59 UTC

[PR] [KYUUBI-7645][SERVER] Fix inaccurate operation state metrics on failed or racing transitions [kyuubi]

zhang-arvin opened a new pull request, #7716:
URL: https://github.com/apache/kyuubi/pull/7716

   ## What changes were proposed in this pull request?
   
   Fix operation state metrics being updated before the actual state transition is validated and applied, which makes metrics inaccurate when a transition fails or races (KYUUBI-7645).
   
   `KyuubiOperation#setState` previously:
   
   1. Updated the metrics meters first (`OPERATION_STATE.<opType>.<oldState>` decremented, `OPERATION_STATE.<opType>.<newState>` and `OPERATION_STATE.<newState>` incremented).
   2. Then delegated to `AbstractOperation#setState`, which calls `OperationState.validateTransition(state, newState)` and may throw for stale/invalid transitions.
   
   This caused two problems:
   
   - If `validateTransition` rejected the transition, the meters had already been updated, so metrics diverged from the real operation state.
   - Concurrent state transitions for the same operation were not an atomic transition-and-metrics-update sequence, so multiple threads could compute meter updates from the same stale old state.
   
   ## How was this patch tested?
   
   Rely on existing CI. The change reuses `AbstractOperation#withLockRequired` (the per-operation `ReentrantLock` already used by `cleanup`/`cancel`/`close`) to make the validate → update metrics → apply transition sequence atomic, and runs `OperationState.validateTransition` before any metrics update.
   
   Closes #7645


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI-7645][SERVER] Fix inaccurate operation state metrics on failed or racing transitions [kyuubi]

Posted by "wangzhigang1999 (via GitHub)" <gi...@apache.org>.
wangzhigang1999 commented on PR #7716:
URL: https://github.com/apache/kyuubi/pull/7716#issuecomment-5581604948

   closed as duplicate of #7642


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI-7645][SERVER] Fix inaccurate operation state metrics on failed or racing transitions [kyuubi]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7716:
URL: https://github.com/apache/kyuubi/pull/7716#issuecomment-5580985227

   Hello @zhang-arvin,
   Thanks for finding the time to submit the Pull request, the Kyuubi community thanks you!
   We really appreciate the community's efforts to improve Apache Kyuubi.
   If you are new to Apache Kyuubi for code changes, please take some time to read our [contributing guide](https://kyuubi.apache.org/contributing.html).


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] [KYUUBI-7645][SERVER] Fix inaccurate operation state metrics on failed or racing transitions [kyuubi]

Posted by "wangzhigang1999 (via GitHub)" <gi...@apache.org>.
wangzhigang1999 closed pull request #7716: [KYUUBI-7645][SERVER] Fix inaccurate operation state metrics on failed or racing transitions
URL: https://github.com/apache/kyuubi/pull/7716


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org