-
Notifications
You must be signed in to change notification settings - Fork 8.9k
optimize: in raft mode add the vgroup field to global lock #7222
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
Conversation
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.
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);
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.
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. |
|
ci test is not passed |
server/src/main/java/org/apache/seata/server/console/impl/file/GlobalLockFileServiceImpl.java
Outdated
Show resolved
Hide resolved
…/GlobalLockFileServiceImpl.java
xjlgod
left a comment
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.
LGTM
| FilterRegistrationBean<RaftRequestFilter> registrationBean = new FilterRegistrationBean<>(); | ||
| registrationBean.setFilter(raftRequestFilter); | ||
| registrationBean.addUrlPatterns("/api/v1/console/*"); | ||
| registrationBean.addUrlPatterns("/api/v1/console/*", "/vgroup/v1/*"); |
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.
Are these two paths need the same filter function?
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.
Are these two paths need the same filter function?
Yes, because the newly added transaction group must go through the leader node.
|
I find sendCommitOrRollback interface can not transfer to server, too. |
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.
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"); |
Copilot
AI
Mar 16, 2025
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.
Review the security implications of adding 'java.util.HashMap' to the permitted packages list to ensure it does not widen the deserialization attack surface.





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