Skip to content

Conversation

@xjlgod
Copy link
Contributor

@xjlgod xjlgod commented Mar 12, 2025

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

optimize: intercept non-leader write requests of the console trx operation
p.s The Raft mode of the global lock delete is not currently supported and needs to be fixed. @funky-eyes

Ⅱ. 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

@funky-eyes funky-eyes changed the title feat: add raft console trx operation feature: add raft console trx operation Mar 13, 2025
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

raft事务控制的实现在哪里?
Where is the implementation of Raft transaction control?

if (!"GET".equalsIgnoreCase(method)) {
String group = SeataClusterContext.bindGroup();
if (!isPass(group)) {
throw new ConsoleException(new TransactionException(TransactionExceptionCode.NotRaftLeader,
Copy link
Contributor

Choose a reason for hiding this comment

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

为什么是抛出异常,而不是响应某种result+状态码让namingserver能感知?
Why throw an exception instead of responding with a result and status code so that the naming server can be aware?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a controller aspect that can capture console related errors and return them. Why need namingserver need to know? The error will be displayed on the console web client to user.
有一个controller的切面能够捕捉到console的相关错误,并返回。让namingserver感知是为什么,这个错误最后会在客户端展现给用户

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a controller aspect that can capture console related errors and return them. Why need namingserver need to know? The error will be displayed on the console web client to user. 有一个controller的切面能够捕捉到console的相关错误,并返回。让namingserver感知是为什么,这个错误最后会在客户端展现给用户

最后被全局异常捕获器包装了是吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
yes.

@xjlgod
Copy link
Contributor Author

xjlgod commented Mar 13, 2025

raft事务控制的实现在哪里? Where is the implementation of Raft transaction control?
Previously, you have directly inherited the transaction control of raft from file session.
之前你已经把raft的事务控制直接继承file了

@funky-eyes
Copy link
Contributor

raft事务控制的实现在哪里? Where is the implementation of Raft transaction control?
Previously, you have directly inherited the transaction control of raft from file session.
之前你已经把raft的事务控制直接继承file了

那这个pr只能是一个优化,拦截非leader的写请求

@xjlgod xjlgod changed the title feature: add raft console trx operation feature: intercept non-leader write requests of the console trx operation Mar 13, 2025
@codecov
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 4.16667% with 23 lines in your changes missing coverage. Please review.

Project coverage is 53.27%. Comparing base (886874e) to head (06e3450).

Files with missing lines Patch % Lines
...che/seata/server/filter/RaftLeaderWriteFilter.java 0.00% 18 Missing ⚠️
...eata/server/config/SeataNamingserverWebConfig.java 0.00% 4 Missing ⚠️
.../org/apache/seata/server/filter/RaftCondition.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #7215      +/-   ##
============================================
- Coverage     53.28%   53.27%   -0.01%     
- Complexity     7069     7074       +5     
============================================
  Files          1169     1171       +2     
  Lines         41585    41609      +24     
  Branches       4871     4873       +2     
============================================
+ Hits          22158    22169      +11     
- Misses        17328    17342      +14     
+ Partials       2099     2098       -1     
Files with missing lines Coverage Δ
...rver/console/aop/GlobalExceptionHandlerAdvice.java 14.28% <ø> (ø)
.../org/apache/seata/server/filter/RaftCondition.java 50.00% <50.00%> (ø)
...eata/server/config/SeataNamingserverWebConfig.java 55.55% <0.00%> (-44.45%) ⬇️
...che/seata/server/filter/RaftLeaderWriteFilter.java 0.00% <0.00%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@funky-eyes funky-eyes changed the title feature: intercept non-leader write requests of the console trx operation optimize: intercept non-leader write requests of the console trx operation Mar 13, 2025
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

LGTM

@funky-eyes funky-eyes merged commit c59ca15 into apache:2.x Mar 15, 2025
6 of 7 checks passed
slievrly pushed a commit to slievrly/fescar that referenced this pull request Oct 21, 2025
YvCeung pushed a commit to YvCeung/incubator-seata that referenced this pull request Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants