inner-2407-supplement : upload metadata for switch

This commit is contained in:
dcy
2024-09-13 17:12:22 +08:00
committed by Rico
parent d6e46512b2
commit 61c7d47530

View File

@@ -37,6 +37,7 @@ public final class DbGroupHaSwitch {
final ReentrantReadWriteLock lock = DbleServer.getInstance().getConfig().getLock();
lock.readLock().lock();
try {
ClusterHelper clusterHelper = ClusterHelper.getInstance(ClusterOperation.HA);
HaConfigManager.getInstance().info("added configLock");
PhysicalDbGroup dh = DbleServer.getInstance().getConfig().getDbGroups().get(dbGroupName);
if (dh == null) {
@@ -59,6 +60,11 @@ public final class DbGroupHaSwitch {
try {
//dble start in single mode
RawJson result = dh.switchMaster(masterName, true);
if (ClusterConfig.getInstance().isClusterEnable()) {
clusterHelper.setKV(ClusterMetaUtil.getHaStatusPath(dh.getGroupName()), result);
}
HaConfigManager.getInstance().haFinish(id, null, result);
} catch (Exception e) {
packetResult.setSuccess(false);