mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-15 19:56:06 +00:00
object reader throughput improvement
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -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 == "" {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user