Skip to content

Comments

Update engineError conditionally based on engineError or engineId presence#7320

Open
turboFei wants to merge 1 commit intoapache:masterfrom
turboFei:k8s_error
Open

Update engineError conditionally based on engineError or engineId presence#7320
turboFei wants to merge 1 commit intoapache:masterfrom
turboFei:k8s_error

Conversation

@turboFei
Copy link
Member

@turboFei turboFei commented Feb 6, 2026

Why are the changes needed?

In the previous commit [KYUUBI #7313], when a k8s application is pending, we audit the app diagnostics to record the pending reason. This information is eventually updated to the engineError field in the metadata store via the updateMetadata method.

However, when the application transitions from pending to finished successfully, if there is no error (i.e., engineError is None), the old pending reason remains in the metadata, causing confusion.

What are the changes?

Modified JDBCMetadataStore.updateMetadata() to always update the engineError field:

  • Previously: Only updated when engineError was Some(error)
  • Now: Always updates, setting to null when engineError is None

This ensures that pending reasons are properly cleared when the application state changes.

How was this patch tested?

  • Added unit test update engineError to null when it becomes None in JDBCMetadataStoreSuite
  • The test verifies that:
    1. Setting engineError to a pending reason works correctly
    2. Updating engineError to None clears the value in the database

Was this patch authored or co-authored using generative AI tooling?

🤖 Generated with Claude Code

### Why are the changes needed?

In the previous commit [KYUUBI apache#7313], when a k8s application is pending, we audit the app diagnostics to record the pending reason. This information is eventually updated to the `engineError` field in the metadata store via the `updateMetadata` method.

However, when the application transitions from pending to finished successfully, if there is no error (i.e., `engineError` is `None`), the old pending reason remains in the metadata, causing confusion.

### What are the changes?

Modified `JDBCMetadataStore.updateMetadata()` to conditionally update the `engineError` field:
- Previously: Only updated when `engineError` was `Some(error)`
- Now: Updates when either:
  1. `engineError` is defined (Some), OR
  2. `engineId` is defined (indicating app has been launched)

This ensures that:
- Pending reasons are properly cleared when the application transitions to success (engineId is set)
- engineError won't be updated unnecessarily when neither engineError nor engineId is present in the update

### How was this patch tested?

- Enhanced unit test `update engineError conditionally based on engineError or engineId presence` in `JDBCMetadataStoreSuite`
- The test verifies three scenarios:
  1. Setting engineError when it's defined works correctly
  2. Clearing engineError when engineId is defined (even if engineError is None)
  3. engineError remains unchanged when neither engineError nor engineId is in the update

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@turboFei turboFei changed the title Always update engineError to clear pending reasons Update engineError conditionally based on engineError or engineId presence Feb 6, 2026
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (2037881) to head (c6694bd).

Files with missing lines Patch % Lines
...yuubi/server/metadata/jdbc/JDBCMetadataStore.scala 0.00% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #7320   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         698     698           
  Lines       43656   43656           
  Branches     5896    5897    +1     
======================================
  Misses      43656   43656           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}
metadata.engineError.foreach { error =>
// Update engineError when it's defined or when engineId is defined
// This ensures pending reasons are cleared when app transitions to success
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... when app transitions to success

the code does not reflect the condition. is there a chance that the batch transfers to another negative state and clears the error message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K8S App:

Pending (appError=Some("reason")) -> FINISHED (appError = None), and then the pending reason is stored in the metadata store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants