mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(clustermgr): fix chunk report err return
with #23020436 Signed-off-by: tangdeyi <tangdeyi@oppo.com>
This commit is contained in:
parent
1cdfd8f95a
commit
c48913bc24
@ -298,7 +298,7 @@ func (v *VolumeMgr) applyChunkReport(ctx context.Context, chunks *cmapi.ReportCh
|
||||
}
|
||||
idx := chunk.Vuid.Index()
|
||||
|
||||
err = vol.withLocked(func() error {
|
||||
err_ := vol.withLocked(func() error {
|
||||
if int(idx) >= len(vol.vUnits) {
|
||||
return errors.Newf("report vuid: %d is invalid", chunk.Vuid)
|
||||
}
|
||||
@ -337,8 +337,9 @@ func (v *VolumeMgr) applyChunkReport(ctx context.Context, chunks *cmapi.ReportCh
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
span.Warn("applyChunkReport", err)
|
||||
|
||||
if err_ != nil {
|
||||
span.Warn("applyChunkReport", err_)
|
||||
continue
|
||||
}
|
||||
// put on dirty volumes and flush asynchronously
|
||||
|
||||
@ -409,11 +409,17 @@ func TestVolumeMgr_applyChunkReport(t *testing.T) {
|
||||
require.Equal(t, unit.vuInfo.Free, uint64(1024*1024))
|
||||
}
|
||||
|
||||
// invalid vuid case
|
||||
// invalid vuid case: several chunks
|
||||
args[1].Vuid = proto.EncodeVuid(proto.EncodeVuidPrefix(44, 2), 1)
|
||||
args[2].Vuid = proto.EncodeVuid(proto.EncodeVuidPrefix(2, 200), 1)
|
||||
err = mockVolumeMgr.applyChunkReport(context.Background(), &clustermgr.ReportChunkArgs{ChunkInfos: args})
|
||||
require.NoError(t, err)
|
||||
|
||||
// invalid vuid case: one chunk
|
||||
args = args[:1]
|
||||
args[0].Vuid = proto.EncodeVuid(proto.EncodeVuidPrefix(2, 200), 1)
|
||||
err = mockVolumeMgr.applyChunkReport(context.Background(), &clustermgr.ReportChunkArgs{ChunkInfos: args})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestVolumeMgr_applyChunkReportWithVolumeOverbought(t *testing.T) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user