Skip to content

[fix][CGS][engineconn] fix sr task retry causing init_sql loading exception#964

Merged
casionone merged 4 commits intodev-1.18.0-webankfrom
dev-1.18.0-bug-fix
Mar 31, 2026
Merged

[fix][CGS][engineconn] fix sr task retry causing init_sql loading exception#964
casionone merged 4 commits intodev-1.18.0-webankfrom
dev-1.18.0-bug-fix

Conversation

@v-kkhuang
Copy link
Copy Markdown

What is the purpose of the change

Background/Problem:
When SR (Script) tasks are retried, the init_sql loading process causes an exception due to null pointer exception when accessing the EngineTypeLabel. The method adjustErrorIndexForSetScenarios uses find().get which throws NoSuchElementException when the label is not present in the task labels.

Purpose of Change:
To address this problem, this PR replaces the unsafe find().get pattern with collectFirst which safely handles the case when EngineTypeLabel is not present, and adds null check for executionCode to prevent null pointer exceptions.

Value/Impact:
After the change, the system handles task retry scenarios gracefully without throwing exceptions, improving system stability and reliability.

Related issues/PRs

Related issues: close apache#5392
Related pr:none

Brief change log

  • Replace unsafe find().get with collectFirst to safely access EngineTypeLabel
  • Add null check for executionCode before processing
  • Refactor adjustErrorIndexForSetScenarios method to use functional style

Checklist

  • I have read the Contributing Guidelines on pull requests.
  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible
  • If this is a code change: I have written unit tests to fully verify the new behavior.

@v-kkhuang v-kkhuang added the bug Something isn't working label Mar 27, 2026
Copy link
Copy Markdown

@casionone casionone left a comment

Choose a reason for hiding this comment

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

LGTM.

@casionone casionone merged commit 069a8e3 into dev-1.18.0-webank Mar 31, 2026
12 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants