diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-11-27 03:17:10 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-11-27 03:17:10 -0800 |
| commit | 6d30b21b10260c8c0f2c9f665a3d907494566092 (patch) | |
| tree | b2509c87ee0cb5eb373d8c3fabc4fd1ac53c7af5 /weed/storage/disk_location_ec.go | |
| parent | 3c229eb677a9aedd4e59f511f10aa4ba552f821b (diff) | |
| download | seaweedfs-6d30b21b10260c8c0f2c9f665a3d907494566092.tar.xz seaweedfs-6d30b21b10260c8c0f2c9f665a3d907494566092.zip | |
volume: add "-dir.idx" option for separate index storage
fix https://github.com/chrislusf/seaweedfs/issues/1265
Diffstat (limited to 'weed/storage/disk_location_ec.go')
| -rw-r--r-- | weed/storage/disk_location_ec.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index 07fab96d9..d1237b40f 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -68,7 +68,7 @@ func (l *DiskLocation) LoadEcShard(collection string, vid needle.VolumeId, shard defer l.ecVolumesLock.Unlock() ecVolume, found := l.ecVolumes[vid] if !found { - ecVolume, err = erasure_coding.NewEcVolume(l.Directory, collection, vid) + ecVolume, err = erasure_coding.NewEcVolume(l.Directory, l.IdxDirectory, collection, vid) if err != nil { return fmt.Errorf("failed to create ec volume %d: %v", vid, err) } @@ -122,6 +122,13 @@ func (l *DiskLocation) loadAllEcShards() (err error) { if err != nil { return fmt.Errorf("load all ec shards in dir %s: %v", l.Directory, err) } + if l.IdxDirectory != l.Directory { + indexFileInfos, err := ioutil.ReadDir(l.IdxDirectory) + if err != nil { + return fmt.Errorf("load all ec shards in dir %s: %v", l.IdxDirectory, err) + } + fileInfos = append(fileInfos, indexFileInfos...) + } sort.Slice(fileInfos, func(i, j int) bool { return fileInfos[i].Name() < fileInfos[j].Name() |
