-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BugFix] Publish time should be update in shared data #53209
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: smartlxh <[email protected]>
state.updatePublishTaskFinishTime(); | ||
} | ||
} | ||
|
||
// a proxy method | ||
public void afterVisible(TransactionStatus transactionStatus, boolean txnOperated) { | ||
for (TransactionState transactionState : transactionStates) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most risky bug in this code is:
ConcurrentModificationException risk when iterating over transactionStates
if it is modified elsewhere.
You can modify the code like this:
import java.util.concurrent.CopyOnWriteArrayList;
public void updateSendTaskTime() {
for (TransactionState state : new CopyOnWriteArrayList<>(transactionStates)) {
state.updateSendTaskTime();
}
}
public void updatePublishTaskFinishTime() {
for (TransactionState state : new CopyOnWriteArrayList<>(transactionStates)) {
state.updatePublishTaskFinishTime();
}
}
This modification ensures a thread-safe iteration over transactionStates
by using CopyOnWriteArrayList
, which avoids ConcurrentModificationException
since it makes a separate copy of the list during iteration.
fe/fe-core/src/main/java/com/starrocks/transaction/TransactionState.java
Outdated
Show resolved
Hide resolved
…State.java Co-authored-by: Kevin Cai <[email protected]> Signed-off-by: fgump <[email protected]>
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]❌ fail : 5 / 8 (62.50%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Why I'm doing:
publishVersionFinishTime
andpublishVersionTime
in TransacctionState should be updated when publish in shared dataWhat I'm doing:
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: