[refine](exec/operator) replace std::mutex/std::lock_guard with annotated wrappers for thread safety analysis#63070
Open
Mryange wants to merge 2 commits intoapache:masterfrom
Open
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
7f97364 to
a29fb60
Compare
Contributor
Author
|
/review |
Contributor
|
OpenCode automated review failed and did not complete. Error: Review step was failure (possibly timeout or cancelled) Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
Contributor
Author
|
/review |
Contributor
There was a problem hiding this comment.
Review opinion: no blocking issues found in the changed PR diff.
Critical checkpoint conclusions:
- Goal/test: The PR appears focused on adding annotated mutex/lock wrappers and applying them to selected pipeline shared-state locks so Clang thread-safety annotations can be used. The existing multicast streamer test was adjusted to respect the new guarded fields; I did not run tests in this review environment.
- Scope/focus: The change is small and focused on lock annotation/conversion in the authoritative PR patch.
- Concurrency: Reviewed the converted pipeline locks, dependency interactions, multicast spill/read paths, shared hash table finish dependency list, exchange finished-channel set, and scan conjunct lock. I did not find a concrete introduced race, missed wake-up, or deadlock from the changed lock wrappers/usages.
- Lifecycle/static initialization: No new static/global lifecycle dependency was introduced.
- Configuration/compatibility: No new config items, wire protocol changes, persisted format changes, or rolling-upgrade compatibility concerns were found.
- Parallel paths: The modified paths are localized conversions; no obvious parallel path requires the same annotation change for correctness.
- Conditional checks/error handling: No new unchecked Status or silent error continuation was found in the changed code.
- Test coverage/results: Existing test coverage is lightly adjusted for guarded access; no new behavioral test was required by the annotation-only intent. I did not verify by running BE tests.
- Observability: No new runtime behavior requiring additional logs or metrics was introduced.
- Transactions/data writes/FE-BE passing: Not applicable to this PR diff.
- Performance: The annotated wrappers preserve std::mutex semantics at reviewed call sites; no obvious hot-path extra work is introduced outside BE_TEST mock sleeps.
User focus: no additional user-provided review focus was present.
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 29606 ms |
Contributor
TPC-DS: Total hot run time: 169778 ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
What problem does this PR solve?
Issue Number: N/A
Problem Summary:
This PR introduces Clang thread safety annotations (-Wthread-safety) to pipeline operator shared states by
replacing raw std::mutex/std::lock_guard/std::unique_lock with annotated wrappers (AnnotatedMutex, LockGuard,
UniqueLock), and by decorating guarded member variables with GUARDED_BY attributes. This enables the compiler to
statically detect data races where a field is accessed without holding its associated mutex.
The change also fixes two bugs uncovered during the annotation process:
branch to fire on the prior call's stale state rather than the current one.
check is now done via a boolean captured inside the lock.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)