From fe573f26a8db0a4c3bbd5e645c4fa2192683c97e Mon Sep 17 00:00:00 2001 From: wusong <75450248+wusongANKANG@users.noreply.github.com> Date: Wed, 1 Feb 2023 11:36:59 +0800 Subject: [PATCH] memchunk save content twice (#4174) --- weed/mount/page_writer/page_chunk_mem.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/weed/mount/page_writer/page_chunk_mem.go b/weed/mount/page_writer/page_chunk_mem.go index 3928f7077..70814262d 100644 --- a/weed/mount/page_writer/page_chunk_mem.go +++ b/weed/mount/page_writer/page_chunk_mem.go @@ -1,10 +1,11 @@ package page_writer import ( - "github.com/seaweedfs/seaweedfs/weed/util" - "github.com/seaweedfs/seaweedfs/weed/util/mem" "sync" "sync/atomic" + + "github.com/seaweedfs/seaweedfs/weed/util" + "github.com/seaweedfs/seaweedfs/weed/util/mem" ) var ( @@ -100,11 +101,6 @@ func (mc *MemChunk) SaveContent(saveFn SaveToStorageFunc) { if saveFn == nil { return } - for t := mc.usage.head.next; t != mc.usage.tail; t = t.next { - reader := util.NewBytesReader(mc.buf[t.StartOffset:t.stopOffset]) - saveFn(reader, int64(mc.logicChunkIndex)*mc.chunkSize+t.StartOffset, t.Size(), t.TsNs, func() { - }) - } for t := mc.usage.head.next; t != mc.usage.tail; t = t.next { startOffset := t.StartOffset