shard id starts from zero

This commit is contained in:
Chris Lu
2019-05-24 11:52:23 -07:00
parent 24b8ad9a14
commit 228850d588
5 changed files with 89 additions and 1 deletions

View File

@@ -94,7 +94,7 @@ func encodeData(file *os.File, enc reedsolomon.Encoder, startOffset, blockSize i
func openEcFiles(baseFileName string, forRead bool) (files []*os.File, err error) {
for i := 0; i < DataShardsCount+ParityShardsCount; i++ {
fname := baseFileName + ToExt(i+1)
fname := baseFileName + ToExt(i)
openOption := os.O_TRUNC | os.O_CREATE | os.O_WRONLY
if forRead {
openOption = os.O_RDONLY

View File

@@ -1,6 +1,8 @@
package erasure_coding
import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
)
@@ -61,3 +63,7 @@ func (ecInfo *EcVolumeInfo) ToVolumeEcShardInformationMessage() (ret []*master_p
}
return
}
func (ecInfo *EcVolumeInfo) String() string {
return fmt.Sprintf("id:%d shard:%v collection:%v", ecInfo.VolumeId, ecInfo.ShardIds(), ecInfo.Collection)
}