mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 20:06:19 +08:00
collect ec shard from multiple locations
fix https://github.com/seaweedfs/seaweedfs/issues/4365
This commit is contained in:
@@ -151,7 +151,7 @@ func iterateEcjFile(baseFileName string, processNeedleFn func(key types.NeedleId
|
||||
}
|
||||
|
||||
// WriteDatFile generates .dat from from .ec00 ~ .ec09 files
|
||||
func WriteDatFile(baseFileName string, datFileSize int64) error {
|
||||
func WriteDatFile(baseFileName string, datFileSize int64, shardFileNames []string) error {
|
||||
|
||||
datFile, openErr := os.OpenFile(baseFileName+".dat", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if openErr != nil {
|
||||
@@ -161,13 +161,19 @@ func WriteDatFile(baseFileName string, datFileSize int64) error {
|
||||
|
||||
inputFiles := make([]*os.File, DataShardsCount)
|
||||
|
||||
defer func() {
|
||||
for shardId := 0; shardId < DataShardsCount; shardId++ {
|
||||
if inputFiles[shardId] != nil {
|
||||
inputFiles[shardId].Close()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
for shardId := 0; shardId < DataShardsCount; shardId++ {
|
||||
shardFileName := baseFileName + ToExt(shardId)
|
||||
inputFiles[shardId], openErr = os.OpenFile(shardFileName, os.O_RDONLY, 0)
|
||||
inputFiles[shardId], openErr = os.OpenFile(shardFileNames[shardId], os.O_RDONLY, 0)
|
||||
if openErr != nil {
|
||||
return openErr
|
||||
}
|
||||
defer inputFiles[shardId].Close()
|
||||
}
|
||||
|
||||
for datFileSize >= DataShardsCount*ErasureCodingLargeBlockSize {
|
||||
|
Reference in New Issue
Block a user