mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-24 02:59:13 +08:00
volume: large_volume version has bug when using in memory index
fix https://github.com/chrislusf/seaweedfs/issues/2162
This commit is contained in:
parent
a2979aa051
commit
fc8dd58aea
BIN
test/data/187.idx
Normal file
BIN
test/data/187.idx
Normal file
Binary file not shown.
@ -96,6 +96,7 @@ func (cs *CompactSection) setOverflowEntry(skey SectionalNeedleId, offset Offset
|
|||||||
cs.overflowExtra[i] = cs.overflowExtra[i-1]
|
cs.overflowExtra[i] = cs.overflowExtra[i-1]
|
||||||
}
|
}
|
||||||
cs.overflow[insertCandidate] = needleValue
|
cs.overflow[insertCandidate] = needleValue
|
||||||
|
cs.overflowExtra[insertCandidate] = needleValueExtra
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
weed/storage/needle_map/compact_map_cases_test.go
Normal file
33
weed/storage/needle_map/compact_map_cases_test.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// +build 5BytesOffset
|
||||||
|
|
||||||
|
package needle_map
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test5bytesIndexLoading(t *testing.T) {
|
||||||
|
|
||||||
|
indexFile, ie := os.OpenFile("../../../test/data/187.idx", os.O_RDWR|os.O_RDONLY, 0644)
|
||||||
|
if ie != nil {
|
||||||
|
log.Fatalln(ie)
|
||||||
|
}
|
||||||
|
defer indexFile.Close()
|
||||||
|
m, rowCount := loadNewNeedleMap(indexFile)
|
||||||
|
|
||||||
|
println("total entries:", rowCount)
|
||||||
|
|
||||||
|
key := types.NeedleId(0x671b905)
|
||||||
|
|
||||||
|
needle, found := m.Get(types.NeedleId(0x671b905))
|
||||||
|
|
||||||
|
fmt.Printf("%v key:%v offset:%v size:%v\n", found, key, needle.Offset, needle.Size)
|
||||||
|
|
||||||
|
assert.Equal(t, int64(12884911892)*8, needle.Offset.ToActualOffset(), "offset")
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user