From 10c65da3d2af7056f48d9301e83f53f102f76e18 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 30 十月 2023 14:52:11 +0800 Subject: [PATCH] fix --- serf/sync.go | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/serf/sync.go b/serf/sync.go index c92fe96..ce3c2fb 100644 --- a/serf/sync.go +++ b/serf/sync.go @@ -152,9 +152,9 @@ // 鍚姩鍚庢煡璇竴娆¢泦缇ょ姸鎬� ss.QueryClusterStat() - if ss.ClusterStatus != "" { - ss.sqlDB.LogMode(true) - } + //if ss.ClusterStatus != "" { + ss.sqlDB.LogMode(true) + //} initChan <- true <-q @@ -252,7 +252,7 @@ // 閫�鍑洪泦缇�, 寮�鍚棩蹇楄窡韪�, 璁剧疆瑙掕壊slave ss.clusterEventFn(EventLeaveCluster) ss.ClusterStatus = "" - ss.sqlDB.LogMode(false) + ss.sqlDB.LogMode(true) case "slave2master": ss.clusterEventFn(EventSlave2Master) ss.ClusterStatus = "master" @@ -410,10 +410,11 @@ //fmt.Println("鍚屾鍏ㄩ噺鏁版嵁缁欒妭鐐�:", targetId) sqls, err := DumpTables(ss.sqlDB, ss.syncTables) if err != nil { - fmt.Println("DumpTables error, ", err.Error()) + logx.Errorf("DumpTables error: %s", err.Error()) return err } + logx.Infof("DumpTables sql:%v", sqls) syncSql := strings.Join(sqls, ";") if len(syncSql) < sizeLimit { err = ss.pubSyncSqlMessage([]byte(syncSql), targetId) @@ -427,6 +428,10 @@ shard = fmt.Sprintf("%s%s;", shard, sql) } + + if len(shard) > 0 { + err = ss.pubSyncSqlMessage([]byte(shard), targetId) + } } return err -- Gitblit v1.8.0