aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin D. <4972091+Okhoshi@users.noreply.github.com>2025-05-09 17:47:53 +0200
committerGitHub <noreply@github.com>2025-05-09 08:47:53 -0700
commit2ae5b480a66fb21abbf6e27ff13af9b05742077a (patch)
treee72033ee5ce368f3f108abdf0eec90e32e718ea1
parent97dad06ed89bc0bbc0c7299b190477c00608e0a4 (diff)
downloadseaweedfs-2ae5b480a66fb21abbf6e27ff13af9b05742077a.tar.xz
seaweedfs-2ae5b480a66fb21abbf6e27ff13af9b05742077a.zip
Use the correct constant when computing the offset in SearchNeedleFromSortedIndex (#6771)
NeedleHeaderSize happen to have the same size as NeedleMapEntrySize, except when running the 5 bytes offset variant of Seaweedfs, because it does not contain OffsetSize. This causes ECX corruption on deletes, due to the drifting offset computation (offset is always computed on a basis of 16 bytes per record instead of 17 bytes) Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
-rw-r--r--weed/storage/erasure_coding/ec_volume.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/weed/storage/erasure_coding/ec_volume.go b/weed/storage/erasure_coding/ec_volume.go
index ed3ce4e2f..f0b662752 100644
--- a/weed/storage/erasure_coding/ec_volume.go
+++ b/weed/storage/erasure_coding/ec_volume.go
@@ -3,14 +3,13 @@ package erasure_coding
import (
"errors"
"fmt"
- "github.com/seaweedfs/seaweedfs/weed/glog"
"math"
"os"
+ "slices"
"sync"
"time"
- "slices"
-
+ "github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb"
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
@@ -263,7 +262,7 @@ func SearchNeedleFromSortedIndex(ecxFile *os.File, ecxFileSize int64, needleId t
key, offset, size = idx.IdxFileEntry(buf)
if key == needleId {
if processNeedleFn != nil {
- err = processNeedleFn(ecxFile, m*types.NeedleHeaderSize)
+ err = processNeedleFn(ecxFile, m*types.NeedleMapEntrySize)
}
return
}