diff options
| author | chrislu <chris.lu@gmail.com> | 2024-08-13 12:01:46 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2024-08-13 12:01:46 -0700 |
| commit | 3a2e21fee78f932eba19a4d20d0914176cc9f5c8 (patch) | |
| tree | 77e015b0e853cfe0581a9cb7a2ab3ab00d280df4 /weed/storage/erasure_coding/ec_test.go | |
| parent | 915f9f50547daae9c046ef0dab38ef768ce3fc0c (diff) | |
| download | seaweedfs-3a2e21fee78f932eba19a4d20d0914176cc9f5c8.tar.xz seaweedfs-3a2e21fee78f932eba19a4d20d0914176cc9f5c8.zip | |
fix EC reading on nLargeBlockRows
fix https://github.com/seaweedfs/seaweedfs/issues/5465
Diffstat (limited to 'weed/storage/erasure_coding/ec_test.go')
| -rw-r--r-- | weed/storage/erasure_coding/ec_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/weed/storage/erasure_coding/ec_test.go b/weed/storage/erasure_coding/ec_test.go index aa46cf6d4..fc0adbe9f 100644 --- a/weed/storage/erasure_coding/ec_test.go +++ b/weed/storage/erasure_coding/ec_test.go @@ -3,6 +3,7 @@ package erasure_coding import ( "bytes" "fmt" + "github.com/stretchr/testify/assert" "math/rand" "os" "testing" @@ -208,3 +209,14 @@ func (this Interval) sameAs(that Interval) bool { this.BlockIndex == that.BlockIndex && this.Size == that.Size } + +func TestLocateData2(t *testing.T) { + intervals := LocateData(ErasureCodingLargeBlockSize, ErasureCodingSmallBlockSize, 32205678320, 21479557912, 4194339) + assert.Equal(t, intervals, []Interval{ + {BlockIndex: 4, InnerBlockOffset: 527128, Size: 521448, IsLargeBlock: false, LargeBlockRowsCount: 2}, + {BlockIndex: 5, InnerBlockOffset: 0, Size: 1048576, IsLargeBlock: false, LargeBlockRowsCount: 2}, + {BlockIndex: 6, InnerBlockOffset: 0, Size: 1048576, IsLargeBlock: false, LargeBlockRowsCount: 2}, + {BlockIndex: 7, InnerBlockOffset: 0, Size: 1048576, IsLargeBlock: false, LargeBlockRowsCount: 2}, + {BlockIndex: 8, InnerBlockOffset: 0, Size: 527163, IsLargeBlock: false, LargeBlockRowsCount: 2}, + }) +} |
