aboutsummaryrefslogtreecommitdiff
path: root/go/weed/fix.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-09-19 11:06:14 -0700
committerChris Lu <chris.lu@gmail.com>2013-09-19 11:06:14 -0700
commit69ac6b6bf6e5608322884ed6d01b9163a656797b (patch)
treec4031c31db965d0e8db6bab901cf027c4d7eef65 /go/weed/fix.go
parent82b74c7940d958c4244cbc67d495b8156a17d2b3 (diff)
downloadseaweedfs-69ac6b6bf6e5608322884ed6d01b9163a656797b.tar.xz
seaweedfs-69ac6b6bf6e5608322884ed6d01b9163a656797b.zip
Issue 45 in weed-fs: [Compact issue] Offset overflow
New issue 45 by hieu.hcmus@gmail.com: [Compact issue] Offset overflow http://code.google.com/p/weed-fs/issues/detail?id=45 You are using uint32(Maximum 4Gb) to store needle offset(Maximum 32Gb) when compacting. Currently It is ok if the volume size is < 4gb Change variable "offset" in ScanVolumeFile function to uint64 to fix the issue.
Diffstat (limited to 'go/weed/fix.go')
-rw-r--r--go/weed/fix.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/go/weed/fix.go b/go/weed/fix.go
index e1cc63943..c97fd60d3 100644
--- a/go/weed/fix.go
+++ b/go/weed/fix.go
@@ -45,10 +45,10 @@ func runFix(cmd *Command, args []string) bool {
vid := storage.VolumeId(*fixVolumeId)
err = storage.ScanVolumeFile(*fixVolumePath, vid, func(superBlock storage.SuperBlock) error {
return nil
- }, func(n *storage.Needle, offset uint32) error {
+ }, func(n *storage.Needle, offset int64) error {
debug("key", n.Id, "offset", offset, "size", n.Size, "disk_size", n.DiskSize(), "gzip", n.IsGzipped())
if n.Size > 0 {
- count, pe := nm.Put(n.Id, offset/storage.NeedlePaddingSize, n.Size)
+ count, pe := nm.Put(n.Id, uint32(offset/storage.NeedlePaddingSize), n.Size)
debug("saved", count, "with error", pe)
} else {
debug("skipping deleted file ...")