Browse Source

解决调度EC对象时文件内容错误的问题

master
Sydonian 3 months ago
parent
commit
1c8c0f52cf
4 changed files with 10 additions and 5 deletions
  1. +2
    -2
      client/internal/downloader/strategy/selector.go
  2. +2
    -2
      client/internal/services/user_space.go
  3. +1
    -0
      client/internal/ticktock/redundancy_shrink.go
  4. +5
    -1
      common/pkgs/ioswitch/exec/executor.go

+ 2
- 2
client/internal/downloader/strategy/selector.go View File

@@ -39,7 +39,7 @@ type ECReconstructStrategy struct {
Detail jcstypes.ObjectDetail
Redundancy jcstypes.ECRedundancy
Blocks []jcstypes.ObjectBlock
UserSpaces []jcstypes.UserSpaceDetail
UserSpaces []jcstypes.UserSpaceDetail // 与Blocks一一对应,表示每个Block应该从哪个UserSpace下载
}

func (s *ECReconstructStrategy) GetDetail() jcstypes.ObjectDetail {
@@ -50,7 +50,7 @@ type LRCReconstructStrategy struct {
Detail jcstypes.ObjectDetail
Redundancy jcstypes.LRCRedundancy
Blocks []jcstypes.ObjectBlock
Spaces []jcstypes.UserSpaceDetail
Spaces []jcstypes.UserSpaceDetail // 与Blocks一一对应,表示每个Block应该从哪个UserSpace下载
}

func (s *LRCReconstructStrategy) GetDetail() jcstypes.ObjectDetail {


+ 2
- 2
client/internal/services/user_space.go View File

@@ -245,9 +245,9 @@ func (svc *UserSpaceService) DownloadPackage(req cliapi.UserSpaceDownloadPackage
if shouldAtClient && strg.UserSpaces[i].RecommendHub != nil {
newSpace := strg.UserSpaces[i]
newSpace.RecommendHub = nil
ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, newSpace, ioswitch2.RawStream()))
ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, newSpace, ioswitch2.ECStream(b.Index)))
} else {
ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, strg.UserSpaces[i], ioswitch2.RawStream()))
ft.AddFrom(ioswitch2.NewFromShardstore(b.FileHash, strg.UserSpaces[i], ioswitch2.ECStream(b.Index)))
}

ft.ECParam = &strg.Redundancy


+ 1
- 0
client/internal/ticktock/redundancy_shrink.go View File

@@ -509,6 +509,7 @@ func (t *ChangeRedundancy) initBlockList(ctx *annealingState) {
if blocks[i].Index == b.Index {
blocks[i].HasEntity = true
blocks[i].FileHash = b.FileHash
blocks[i].Size = b.Size
has = true
break
}


+ 5
- 1
common/pkgs/ioswitch/exec/executor.go View File

@@ -85,7 +85,11 @@ func (s *Executor) runOps(ops []Op, ctx *ExecContext, cancel context.CancelFunc)
err = context.Canceled
}
} else {
err = multierror.Append(err, fmt.Errorf("%T: %w", op, e))
if err == context.Canceled {
err = e
} else {
err = multierror.Append(err, fmt.Errorf("%T: %w", op, e))
}
}
lock.Unlock()



Loading…
Cancel
Save