fix: optimize parentDirIsObject by moving isObject to storage layer (#11291)

For objects with `N` prefix depth, this PR reduces `N` such network
operations by converting `CheckFile` into a single bulk operation.

Reduction in chattiness here would allow disks to be utilized more
cleanly, while maintaining the same functionality along with one
extra volume check stat() call is removed.

Update tests to test multiple sets scenario
This commit is contained in:
Harshavardhana
2021-01-18 12:25:22 -08:00
committed by GitHub
parent 3d9000d5b5
commit 3ca6330661
5 changed files with 84 additions and 104 deletions

View File

@@ -1657,6 +1657,10 @@ func TestXLStorageCheckFile(t *testing.T) {
t.Fatalf("Unable to create file, %s", err)
}
if err := xlStorage.MakeVol(context.Background(), "success-vol/path/to/"+xlStorageFormatFile); err != nil {
t.Fatalf("Unable to create path, %s", err)
}
testCases := []struct {
srcVol string
srcPath string
@@ -1695,7 +1699,7 @@ func TestXLStorageCheckFile(t *testing.T) {
{
srcVol: "success-vol",
srcPath: "path",
expectedErr: errFileNotFound,
expectedErr: errPathNotFound,
},
// TestXLStorage case - 6.
// TestXLStorage case with non existent volume.
@@ -1704,6 +1708,13 @@ func TestXLStorageCheckFile(t *testing.T) {
srcPath: "success-file",
expectedErr: errPathNotFound,
},
// TestXLStorage case - 7.
// TestXLStorage case with file with directory.
{
srcVol: "success-vol",
srcPath: "path/to",
expectedErr: errFileNotFound,
},
}
for i, testCase := range testCases {