Skip to content

Commit

Permalink
bugfix: fix vGroupMappingManager is NOT init (#7025)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggbocoder authored Nov 22, 2024
1 parent a3fd17c commit b6f5d68
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
3 changes: 2 additions & 1 deletion changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#7005](https://github.com/apache/incubator-seata/pull/7005)] fix the Raft NPE issue caused by two-phase concurrency
- [[#7010](https://github.com/apache/incubator-seata/pull/7010)] fix error while the "context" is key word in DM8 when delete undolog
- [[#7022](https://github.com/apache/incubator-seata/pull/7022)] fix `store.mode` property in `application.raft.example.yml`

- [[#7025](https://github.com/apache/incubator-seata/pull/7025)] fix vGroupMappingManager is NOT init
-
### optimize:
- [[#6826](https://github.com/apache/incubator-seata/pull/6826)] remove the branch registration operation of the XA read-only transaction
- [[#6874](https://github.com/apache/incubator-seata/pull/6874)] modify the version to 2.3.0-SNAPSHOT
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [[#7005](https://github.com/apache/incubator-seata/pull/7005)] 修复Raft模式下两阶段并发可能导致NPE的问题
- [[#7010](https://github.com/apache/incubator-seata/pull/7010)] 修复使用达梦数据库时删除undolog发生SQL语法错误
- [[#7022](https://github.com/apache/incubator-seata/pull/7022)] 修复 `application.raft.example.yml``store.mode`属性
- [[#7025](https://github.com/apache/incubator-seata/pull/7025)] 修复vGroupMappingManager未初始化的问题

### optimize:
- [[#6826](https://github.com/apache/incubator-seata/pull/6826)] 移除只读XA事务的分支注册操作
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ public class VGroupMappingController {

protected static final Configuration CONFIG = ConfigurationFactory.getInstance();

@PostConstruct
private void init() {
String type =
ConfigurationFactory.getInstance().getConfig(FILE_ROOT_REGISTRY + FILE_CONFIG_SPLIT_CHAR + FILE_ROOT_TYPE);
if (StringUtils.equals(type, NAMING_SERVER)) {
vGroupMappingStoreManager = SessionHolder.getRootVGroupMappingManager();
}
}

/**
* add vGroup in cluster
*
Expand All @@ -67,7 +58,7 @@ public Result<?> addVGroup(@RequestParam String vGroup, @RequestParam String uni
mappingDO.setCluster(Instance.getInstance().getClusterName());
mappingDO.setUnit(unit);
mappingDO.setVGroup(vGroup);
boolean rst = vGroupMappingStoreManager.addVGroup(mappingDO);
boolean rst = SessionHolder.getRootVGroupMappingManager().addVGroup(mappingDO);
Instance.getInstance().setTerm(System.currentTimeMillis());
if (!rst) {
result.setCode("500");
Expand All @@ -85,7 +76,7 @@ public Result<?> addVGroup(@RequestParam String vGroup, @RequestParam String uni
@GetMapping("/removeVGroup")
public Result<?> removeVGroup(@RequestParam String vGroup) {
Result<?> result = new Result<>();
boolean rst = vGroupMappingStoreManager.removeVGroup(vGroup);
boolean rst = SessionHolder.getRootVGroupMappingManager().removeVGroup(vGroup);
Instance.getInstance().setTerm(System.currentTimeMillis());
if (!rst) {
result.setCode("500");
Expand Down

0 comments on commit b6f5d68

Please sign in to comment.