Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@funky-eyes
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the global lock handling in raft mode by adding a new field ("vgroup") to support the additional data requirement. Key changes include:

  • Introducing a new GlobalLockQueryBO to encapsulate row lock and session information.
  • Updating GlobalLockVO to include and propagate the new "vgroup" field.
  • Refactoring package imports and class references from the old “console.param/vo” packages to the new “console/entity/param/vo” structure.
  • Adjusting the naming server configuration to replace deprecated filter beans with the new RaftRequestFilter.

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
server/src/main/java/org/apache/seata/server/console/entity/bo/GlobalLockQueryBO.java New business object to encapsulate row lock and session for global lock queries.
server/src/main/java/org/apache/seata/server/config/SeataNamingserverWebConfig.java Updated filter configuration to use RaftRequestFilter with revised dependency order.
server/src/main/java/org/apache/seata/server/console/entity/vo/GlobalLockVO.java Added the vgroup field and updated conversion logic to include the new field.
Other files (GlobalLockParam, GlobalSessionParam, VO and DB/Redis/File service implementations) Refactored package names and import statements to reflect updated module structuring.
server/src/main/java/org/apache/seata/server/console/impl/file/GlobalLockFileServiceImpl.java Updated stream processing to create GlobalLockQueryBO objects and integrate vgroup.
Comments suppressed due to low confidence (2)

server/src/main/java/org/apache/seata/server/config/SeataNamingserverWebConfig.java:33

  • [nitpick] The method name 'raftLeaderWriteServletFilter' does not reflect the use of RaftRequestFilter. Consider renaming it to 'raftRequestServletFilter' to improve clarity.
public FilterRegistrationBean<RaftRequestFilter> raftLeaderWriteServletFilter(RaftRequestFilter raftRequestFilter) {

server/src/main/java/org/apache/seata/server/console/entity/vo/GlobalLockVO.java:91

  • [nitpick] The field name 'vgroup' may be ambiguous. Consider renaming it to 'transactionServiceGroup' or adding a clarifying comment if its purpose is not immediately clear.
globalLockVO.setVgroup(vgroup);

@funky-eyes funky-eyes requested a review from Copilot March 15, 2025 07:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the raft mode global lock handling by adding a new vgroup field and refactoring associated conversion logic while also updating package names across multiple modules.

  • Added the vgroup field to GlobalLockVO and updated conversion methods to incorporate it.
  • Migrated package paths from console.param/vo to console.entity.param/vo and refactored filter bean definitions in the naming server configuration.
  • Updated GlobalLockFileServiceImpl to use GlobalLockQueryBO for improved clarity in lock conversion.

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated no comments.

Show a summary per file
File Description
server/src/main/java/org/apache/seata/server/console/entity/vo/GlobalLockVO.java Added vgroup field, updated conversion method and toString, and introduced new setters for transactionId/branchId.
server/src/main/java/org/apache/seata/server/config/SeataNamingserverWebConfig.java Changed filter bean definitions by replacing RaftGroupFilter and RaftLeaderWriteFilter with RaftRequestFilter.
server/src/main/java/org/apache/seata/server/console/impl/file/GlobalLockFileServiceImpl.java Refactored stream mapping to use GlobalLockQueryBO instead of directly processing RowLock.
changes/en-us/2.x.md & changes/zh-cn/2.x.md Updated changelog documentation to reflect the new vgroup field addition.
Other controller and service classes Updated package declarations and imports to match the new entity package structure.

@xjlgod
Copy link
Contributor

xjlgod commented Mar 15, 2025

ci test is not passed

@codecov
Copy link

codecov bot commented Mar 15, 2025

Codecov Report

Attention: Patch coverage is 36.23188% with 44 lines in your changes missing coverage. Please review.

Please upload report for BASE (2.x@8e519fc). Learn more about missing BASE report.
Report is 1 commits behind head on 2.x.

Files with missing lines Patch % Lines
...r/console/impl/file/GlobalLockFileServiceImpl.java 27.77% 13 Missing ⚠️
.../apache/seata/server/filter/RaftRequestFilter.java 0.00% 13 Missing ⚠️
...e/seata/server/console/entity/vo/GlobalLockVO.java 50.00% 6 Missing ⚠️
...ta/server/console/entity/bo/GlobalLockQueryBO.java 60.00% 4 Missing ⚠️
...eata/server/config/SeataNamingserverWebConfig.java 0.00% 3 Missing ⚠️
...ata/namingserver/filter/ConsoleRemotingFilter.java 0.00% 2 Missing ⚠️
...er/cluster/raft/serializer/CustomDeserializer.java 77.77% 2 Missing ⚠️
...ache/seata/namingserver/manager/NamingManager.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff           @@
##             2.x    #7222   +/-   ##
======================================
  Coverage       ?   53.62%           
  Complexity     ?     7130           
======================================
  Files          ?     1171           
  Lines          ?    41619           
  Branches       ?     4877           
======================================
  Hits           ?    22318           
  Misses         ?    17193           
  Partials       ?     2108           
Files with missing lines Coverage Δ
...he/seata/server/cluster/raft/RaftStateMachine.java 46.98% <100.00%> (ø)
...uster/raft/snapshot/vgroup/VGroupSnapshotFile.java 13.79% <ø> (ø)
...er/console/controller/BranchSessionController.java 14.28% <ø> (ø)
...erver/console/controller/GlobalLockController.java 28.57% <ø> (ø)
...er/console/controller/GlobalSessionController.java 9.52% <ø> (ø)
...a/server/console/entity/param/GlobalLockParam.java 65.00% <ø> (ø)
...erver/console/entity/param/GlobalSessionParam.java 85.00% <ø> (ø)
...eata/server/console/entity/vo/BranchSessionVO.java 14.81% <ø> (ø)
...eata/server/console/entity/vo/GlobalSessionVO.java 55.88% <ø> (ø)
...seata/server/console/impl/AbstractLockService.java 9.09% <ø> (ø)
... and 18 more
🚀 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.

Copy link
Contributor

@xjlgod xjlgod left a comment

Choose a reason for hiding this comment

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

LGTM

FilterRegistrationBean<RaftRequestFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(raftRequestFilter);
registrationBean.addUrlPatterns("/api/v1/console/*");
registrationBean.addUrlPatterns("/api/v1/console/*", "/vgroup/v1/*");
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these two paths need the same filter function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are these two paths need the same filter function?

Yes, because the newly added transaction group must go through the leader node.

@xjlgod
Copy link
Contributor

xjlgod commented Mar 16, 2025

I find sendCommitOrRollback interface can not transfer to server, too.

@funky-eyes
Copy link
Contributor Author

I find sendCommitOrRollback interface can not transfer to server, too.

image
I don't see the sendCommitOrRollback interface

@funky-eyes
Copy link
Contributor Author

I find sendCommitOrRollback interface can not transfer to server, too.

image
image
My testing shows that it can be successfully forwarded to the leader node

@xjlgod
Copy link
Contributor

xjlgod commented Mar 16, 2025

I find sendCommitOrRollback interface can not transfer to server, too.

image image My testing shows that it can be successfully forwarded to the leader node

Ok, after your pr be merged, I will test it again.

@funky-eyes funky-eyes requested a review from Copilot March 16, 2025 12:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes global lock handling in raft mode by adding a new “vgroup” field and updating associated backend and frontend components. Key changes include updating the VO and BO classes to support the new field, integrating the vgroup field into raft snapshot registration, and modifying client-side requests to propagate vgroup and related parameters.

Reviewed Changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server/src/main/java/org/apache/seata/server/console/entity/bo/GlobalLockQueryBO.java New BO class to encapsulate RowLock and GlobalSession details
server/src/main/java/org/apache/seata/server/cluster/raft/serializer/CustomDeserializer.java Added PERMIT_PACKAGES support for HashMap class
namingserver/src/main/java/org/apache/seata/namingserver/filter/ConsoleRemotingFilter.java Updated node casting and header field from group to unit
server/src/main/java/org/apache/seata/server/config/SeataNamingserverWebConfig.java Updated filter registration to use RaftRequestFilter
server/src/main/java/org/apache/seata/server/cluster/raft/snapshot/vgroup/VGroupSnapshotFile.java Modified constant for snapshot file naming
server/src/main/java/org/apache/seata/server/console/entity/vo/GlobalLockVO.java Added new vgroup field and updated conversion methods and toString()
console/src/main/resources/static/console-fe/src/components/Header/Header.tsx Improved token validation in header component
server/src/main/java/org/apache/seata/server/cluster/raft/RaftStateMachine.java Registered new VGroupSnapshotFile for raft mode
console/src/main/resources/static/console-fe/src/pages/GlobalLockInfo/GlobalLockInfo.tsx Passed cluster and namespace to lock data elements
namingserver/src/main/java/org/apache/seata/namingserver/manager/NamingManager.java Updated logic by removing an unnecessary commented condition
Various files under server/src/main/java/org/apache/seata/server/console/entity, controller, and param directories Adjusted package names to reflect entity-based structure and updated imports accordingly
console/src/main/resources/static/console-fe/src/service/globalLockInfo.ts Added vgroup parameter to API requests for global lock information
Comments suppressed due to low confidence (3)

server/src/main/java/org/apache/seata/server/console/entity/vo/GlobalLockVO.java:70

  • [nitpick] Ensure that using 'globalSession.getTransactionServiceGroup()' as the vgroup value correctly reflects the intended semantics of the new vgroup field.
result.add(convert(globalLockQueryBO.getRowLock(), globalLockQueryBO.getGlobalSession().getTransactionServiceGroup()));

server/src/main/java/org/apache/seata/server/cluster/raft/snapshot/vgroup/VGroupSnapshotFile.java:39

  • [nitpick] Confirm that removing the '.json' extension from the ROOT_MAPPING_MANAGER_NAME is intentional and aligns with the expected storage convention.
public static final String ROOT_MAPPING_MANAGER_NAME = "vgroup_mapping";

namingserver/src/main/java/org/apache/seata/namingserver/manager/NamingManager.java:218

  • [nitpick] Verify that removing the previously commented condition regarding unitName presence does not inadvertently alter the intended behavior of the addGroup method.
if (clusterBO != null) {

static {
PERMIT_PACKAGES.add("org.apache.seata");
// The storage structure of vgroup is a map.
PERMIT_PACKAGES.add("java.util.HashMap");
Copy link

Copilot AI Mar 16, 2025

Choose a reason for hiding this comment

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

Review the security implications of adding 'java.util.HashMap' to the permitted packages list to ensure it does not widen the deserialization attack surface.

Copilot uses AI. Check for mistakes.
@funky-eyes funky-eyes merged commit e0dc0c3 into apache:2.x Mar 16, 2025
6 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