fix(metanode): replace runtime.GC with debug.OsFreeMemory.#1000228535

The runtime.GC may cause metanode lose heartbeat.

Signed-off-by: Wu Huocheng <wuhuocheng@oppo.com>
This commit is contained in:
Wu Huocheng 2025-07-14 16:45:32 +08:00 committed by zhumingze1108
parent 3264a846e5
commit 503a930226
2 changed files with 12 additions and 3 deletions

View File

@ -22,7 +22,6 @@ import (
"net"
"os"
"path"
"runtime"
"runtime/debug"
"strconv"
"strings"
@ -3174,8 +3173,10 @@ func (m *metadataManager) opBackupEmptyMetaPartition(conn net.Conn,
p.PacketOkReply()
m.respondToClientWithVer(conn, p)
runtime.GC()
log.LogInfof("%s [opDeleteMetaPartition] req: %d - %v, resp: %v",
go func() {
debug.FreeOSMemory()
}()
log.LogInfof("%s [opBackupEmptyMetaPartition] req: %d - %v, resp: %v",
remoteAddr, p.GetReqID(), req, err)
return
}

View File

@ -742,6 +742,14 @@ func (p *Packet) GetOpMsg() (m string) {
m = "OpFlashNodeTaskCommand"
case OpSetRepairingStatus:
m = "OpSetRepairingStatus"
case OpFreezeEmptyMetaPartition:
m = "OpFreezeEmptyMetaPartition"
case OpBackupEmptyMetaPartition:
m = "OpBackupEmptyMetaPartition"
case OpRemoveBackupMetaPartition:
m = "OpRemoveBackupMetaPartition"
case OpIsRaftStatusOk:
m = "OpIsRaftStatusOk"
default:
m = fmt.Sprintf("op:%v not found", p.Opcode)
}