Commit c6694bd
[KYUUBI #7XXX] Conditionally update engineError to clear pending reasons
### 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 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>1 parent 2037881 commit c6694bd
File tree
2 files changed
+66
-2
lines changed- kyuubi-server/src
- main/scala/org/apache/kyuubi/server/metadata/jdbc
- test/scala/org/apache/kyuubi/server/metadata/jdbc
2 files changed
+66
-2
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
380 | 382 | | |
381 | | - | |
| 383 | + | |
382 | 384 | | |
383 | 385 | | |
384 | 386 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
274 | 336 | | |
275 | 337 | | |
276 | 338 | | |
| |||
0 commit comments