From e168a18c8ec703179054276108f2d700a46df908 Mon Sep 17 00:00:00 2001 From: hailu Date: Thu, 16 May 2024 15:10:11 +0800 Subject: [PATCH] modify active psync --- .../applier/ApplierCommandHandler.java | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/redis/redis-keeper/src/main/java/com/ctrip/xpipe/redis/keeper/handler/applier/ApplierCommandHandler.java b/redis/redis-keeper/src/main/java/com/ctrip/xpipe/redis/keeper/handler/applier/ApplierCommandHandler.java index 109710875d..b144f24558 100644 --- a/redis/redis-keeper/src/main/java/com/ctrip/xpipe/redis/keeper/handler/applier/ApplierCommandHandler.java +++ b/redis/redis-keeper/src/main/java/com/ctrip/xpipe/redis/keeper/handler/applier/ApplierCommandHandler.java @@ -39,8 +39,6 @@ public class ApplierCommandHandler extends AbstractCommandHandler { public final static String GET_FREEZE_LAST = "getfreezelast"; - public final static String GTID_ENABLED = "gtid-enabled"; - @Override public String[] getCommands() { return new String[]{"applier"}; @@ -96,33 +94,20 @@ protected Endpoint getMasterAddress(String[] args) { } protected String getGtidSet(String gtid) { - if (gtid.contains("|gtid-enabled:")) { - String[] gtids = gtid.split("\\|"); - String gtidSet = ""; - if (gtids.length == 2) { - gtidSet = gtids[0]; - } - return gtidSet; - } - return gtid; + return gtid.split("\\|")[0]; } protected boolean enableGtid(String gtid) { - if (gtid.contains(String.format("|%s:", GTID_ENABLED))) { - String[] gtids = gtid.split("\\|"); - String gtidEnabled; - if (gtids.length == 2) { - gtidEnabled = gtids[1]; - } else { - gtidEnabled = gtids[0]; - } - String[] split = gtidEnabled.split("\\:"); - if (split.length != 2 || !GTID_ENABLED.equalsIgnoreCase(split[0])) { - throw new IllegalArgumentException("gtid-enabled argument error:" + gtidEnabled); - } - return "true".equalsIgnoreCase(split[1]); + String[] gtids = gtid.split("\\|"); + if (gtids.length < 2) { + return true; + } + String gtidEnabled = gtids[1]; + String[] split = gtidEnabled.split("\\:"); + if (split.length != 2){ + throw new IllegalArgumentException("gtid-enabled argument error:" + gtidEnabled); } - return true; + return "true".equalsIgnoreCase(split[1]); } protected ProxyConnectProtocol getProxyProtocol(String[] args) {