Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.

SCB-213 proper timing to handle SagaEndedEvent in asynchronous situation#111

Merged
seanyinx merged 4 commits into
apache:masterfrom
eric-lee-ltk:SCB-213
Jan 11, 2018
Merged

SCB-213 proper timing to handle SagaEndedEvent in asynchronous situation#111
seanyinx merged 4 commits into
apache:masterfrom
eric-lee-ltk:SCB-213

Conversation

@eric-lee-ltk
Copy link
Copy Markdown
Contributor

@eric-lee-ltk eric-lee-ltk commented Jan 10, 2018

Signed-off-by: Eric Lee dagang.li@huawei.com

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

Signed-off-by: Eric Lee <dagang.li@huawei.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.6%) to 95.211% when pulling 7ace5f4 on eric-lee-ltk:SCB-213 into 367b1cc on apache:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.6%) to 95.211% when pulling 7ace5f4 on eric-lee-ltk:SCB-213 into 367b1cc on apache:master.

events.forEach(omegaCallback::compensate);
eventsToCompensate.computeIfAbsent(event.globalTxId(), (v) -> {
CopyOnWriteArraySet<String> eventSet = new CopyOnWriteArraySet<>();
events.forEach(e -> eventSet.add(getUniqueEventId(e)));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what's the performance characteristics of CopyOnWrite?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There is no need to use CopyOnWriteArraySet as the set is only write once. Already used HashSet instead.

}

private String getUniqueEventId(TxEvent event) {
return event.globalTxId() + "_" + event.localTxId();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the map is based on globalTxId. why use globalTxId again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. Use localTxId is enough.

Signed-off-by: Eric Lee <dagang.li@huawei.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.3%) to 94.985% when pulling 49e580f on eric-lee-ltk:SCB-213 into 367b1cc on apache:master.

if (events != null) {
events.remove(event.localTxId());
if (events.isEmpty()) {
markGlobalTxEnd(event);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how about remove the set from map, or it will keep growing?

Signed-off-by: Eric Lee <dagang.li@huawei.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.3%) to 94.987% when pulling 78277bf on eric-lee-ltk:SCB-213 into 367b1cc on apache:master.

@seanyinx seanyinx merged commit 2b62bdb into apache:master Jan 11, 2018
@eric-lee-ltk eric-lee-ltk deleted the SCB-213 branch January 11, 2018 07:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants