Skip to content
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

Success state after retrying is synchronized back to the client, and print log. #861

Merged
merged 14 commits into from
May 10, 2019

Conversation

XCXCXCXCX
Copy link
Contributor

Ⅰ. Describe what this PR did

At present, the client can only perceive the first commit or rollback failure. In fact, the transaction will be retried on the server at this time, so the client needs to be aware of the final state of the retry transaction.
At first I thought I needed to design the server push mode, and found that need to change a lot of code.
Eventually I used the client polling mode and added my logic to DefaultFailureHandlerImpl.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Apr 21, 2019

Codecov Report

Merging #861 into develop will decrease coverage by 0.1%.
The diff coverage is 0%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #861      +/-   ##
=============================================
- Coverage      38.37%   38.26%   -0.11%     
  Complexity      1046     1046              
=============================================
  Files            218      218              
  Lines           8670     8694      +24     
  Branches        1080     1083       +3     
=============================================
  Hits            3327     3327              
- Misses          4923     4947      +24     
  Partials         420      420
Impacted Files Coverage Δ Complexity Δ
...ava/io/seata/tm/api/DefaultFailureHandlerImpl.java 0% <0%> (ø) 0 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2adee4...9fdd6d2. Read the comment docs.

@zhangthen
Copy link
Contributor

The retry number is unlimited ? It's better to add a limit for retry number.

@XCXCXCXCX
Copy link
Contributor Author

The retry number is unlimited ? It's better to add a limit for retry number.

Good advice, I will modify it later.

Copy link
Contributor

@zhangthen zhangthen left a comment

Choose a reason for hiding this comment

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

Okey to me.

Copy link
Contributor

@CoffeeLatte007 CoffeeLatte007 left a comment

Choose a reason for hiding this comment

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

I left some comments


private static final int TICKS_PER_WHEEL = 8;

private HashedWheelTimer timer = new HashedWheelTimer(
Copy link
Contributor

Choose a reason for hiding this comment

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

we need custom threadFactory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we should.

return;
}
isStopped = shouldStop(tx, required);
timer.newTimeout(this, SCHEDULE_INTERVAL_SECONDS, TimeUnit.SECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use exponential backoff 10s,20s,40s.... ns

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is not necessary in such a scenario.

private boolean shouldStop(final GlobalTransaction tx, GlobalStatus required){
try {
GlobalStatus status = tx.getStatus();
LOGGER.warn("transaction[" + tx.getXid() + "] current status is [" + status + "]");
Copy link
Contributor

Choose a reason for hiding this comment

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

info

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will modify it later.

LOGGER.error("transaction[" + tx.getXid() + "] retry fetch status times exceed the limit [" + RETRY_MAX_TIMES + " times]");
return;
}
isStopped = shouldStop(tx, required);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what you mean...

Copy link
Contributor

@CoffeeLatte007 CoffeeLatte007 left a comment

Choose a reason for hiding this comment

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

I left some comments

LOGGER.error("transaction[" + tx.getXid() + "] retry fetch status times exceed the limit [" + RETRY_MAX_TIMES + " times]");
return;
}
isStopped = shouldStop(tx, required);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what you mean...

Copy link
Contributor

@CoffeeLatte007 CoffeeLatte007 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

@CoffeeLatte007 CoffeeLatte007 merged commit 1d8b059 into apache:develop May 10, 2019
nick-tan pushed a commit to nick-tan/seata that referenced this pull request Jul 12, 2019
…print log. (apache#861)

* Success state after retrying is synchronized back to the client, and print log.
@wangliang181230 wangliang181230 added this to the 0.5.* milestone Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants