object reader throughput improvement

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2026-08-11 14:07:59 +08:00
parent 92bcf5a3b3
commit c8127e243b
5 changed files with 6 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
Add prefetch mechanism to object reader so as to improve the restore throughput of block data mover
@@ -382,7 +382,6 @@ func (kr *kopiaRepository) OpenObject(ctx context.Context, id udmrepo.ID, opt ud
prefetch.cond = sync.NewCond(&prefetch.mu)
}
}
rd := &kopiaObjectReader{
@@ -908,7 +908,7 @@ func TestReaderClose(t *testing.T) {
err := kr.Close()
if tc.withPrefetch {
assert.ErrorIs(t, kr.prefetch.ctx.Err(), context.Canceled)
require.ErrorIs(t, kr.prefetch.ctx.Err(), context.Canceled)
}
if tc.expectedErr == "" {
+1 -1
View File
@@ -663,7 +663,7 @@ func TestBlockUploaderRestore(t *testing.T) {
objReader.On("Read", mock.Anything).Return(0, io.EOF)
objReader.On("Close").Return(nil)
repoWriter.On("OpenObject", mock.Anything, udmrepo.ID("data-id")).Return(objReader, nil)
repoWriter.On("OpenObject", mock.Anything, udmrepo.ID("data-id"), mock.Anything).Return(objReader, nil)
snap := udmrepo.Snapshot{
Description: "test snapshot",
+3 -3
View File
@@ -81,7 +81,7 @@ func TestOpenObject(t *testing.T) {
name: "Success",
backupRepo: func() *mocks.BackupRepo {
backupRepo := &mocks.BackupRepo{}
backupRepo.On("OpenObject", mock.Anything, mock.Anything).Return(&shimObjectReader{}, nil)
backupRepo.On("OpenObject", mock.Anything, mock.Anything, mock.Anything).Return(&shimObjectReader{}, nil)
return backupRepo
}(),
},
@@ -89,7 +89,7 @@ func TestOpenObject(t *testing.T) {
name: "Open object error",
backupRepo: func() *mocks.BackupRepo {
backupRepo := &mocks.BackupRepo{}
backupRepo.On("OpenObject", mock.Anything, mock.Anything).Return(&shimObjectReader{}, errors.New("Error open object"))
backupRepo.On("OpenObject", mock.Anything, mock.Anything, mock.Anything).Return(&shimObjectReader{}, errors.New("Error open object"))
return backupRepo
}(),
isOpenObjectError: true,
@@ -98,7 +98,7 @@ func TestOpenObject(t *testing.T) {
name: "Get nil reader",
backupRepo: func() *mocks.BackupRepo {
backupRepo := &mocks.BackupRepo{}
backupRepo.On("OpenObject", mock.Anything, mock.Anything).Return(nil, nil)
backupRepo.On("OpenObject", mock.Anything, mock.Anything, mock.Anything).Return(nil, nil)
return backupRepo
}(),
isReaderNil: true,