fix: A typo in per pool make/delete bucket errs calculation (#17553)

This commit is contained in:
Anis Eleuch 2023-07-03 17:47:40 +01:00 committed by GitHub
parent 7f782983ca
commit 15fd5ce2fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 37 additions and 34 deletions

View File

@ -73,7 +73,7 @@ func prepareAdminErasureTestBed(ctx context.Context) (*adminErasureTestBed, erro
// Initialize boot time // Initialize boot time
globalBootTime = UTCNow() globalBootTime = UTCNow()
globalEndpoints = mustGetPoolEndpoints(erasureDirs...) globalEndpoints = mustGetPoolEndpoints(0, erasureDirs...)
initAllSubsystems(ctx) initAllSubsystems(ctx)
@ -108,7 +108,7 @@ func initTestErasureObjLayer(ctx context.Context) (ObjectLayer, []string, error)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
endpoints := mustGetPoolEndpoints(erasureDirs...) endpoints := mustGetPoolEndpoints(0, erasureDirs...)
globalPolicySys = NewPolicySys() globalPolicySys = NewPolicySys()
objLayer, err := newErasureServerPools(ctx, endpoints) objLayer, err := newErasureServerPools(ctx, endpoints)
if err != nil { if err != nil {

View File

@ -372,7 +372,7 @@ func TestGetLocalPeer(t *testing.T) {
} }
for i, testCase := range testCases { for i, testCase := range testCases {
zendpoints := mustGetPoolEndpoints(testCase.endpointArgs...) zendpoints := mustGetPoolEndpoints(0, testCase.endpointArgs...)
if !zendpoints[0].Endpoints[0].IsLocal { if !zendpoints[0].Endpoints[0].IsLocal {
if err := zendpoints[0].Endpoints.UpdateIsLocal(); err != nil { if err := zendpoints[0].Endpoints.UpdateIsLocal(); err != nil {
t.Fatalf("error: expected = <nil>, got = %v", err) t.Fatalf("error: expected = <nil>, got = %v", err)
@ -405,7 +405,7 @@ func TestGetRemotePeers(t *testing.T) {
} }
for _, testCase := range testCases { for _, testCase := range testCases {
zendpoints := mustGetPoolEndpoints(testCase.endpointArgs...) zendpoints := mustGetPoolEndpoints(0, testCase.endpointArgs...)
if !zendpoints[0].Endpoints[0].IsLocal { if !zendpoints[0].Endpoints[0].IsLocal {
if err := zendpoints[0].Endpoints.UpdateIsLocal(); err != nil { if err := zendpoints[0].Endpoints.UpdateIsLocal(); err != nil {
t.Errorf("error: expected = <nil>, got = %v", err) t.Errorf("error: expected = <nil>, got = %v", err)

View File

@ -584,7 +584,7 @@ func TestHealingDanglingObject(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
// Everything is fine, should return nil // Everything is fine, should return nil
objLayer, disks, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) objLayer, disks, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -776,8 +776,8 @@ func TestHealCorrectQuorum(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
pools := mustGetPoolEndpoints(fsDirs[:16]...) pools := mustGetPoolEndpoints(0, fsDirs[:16]...)
pools = append(pools, mustGetPoolEndpoints(fsDirs[16:]...)...) pools = append(pools, mustGetPoolEndpoints(1, fsDirs[16:]...)...)
// Everything is fine, should return nil // Everything is fine, should return nil
objLayer, _, err := initObjectLayer(ctx, pools) objLayer, _, err := initObjectLayer(ctx, pools)
@ -907,8 +907,8 @@ func TestHealObjectCorruptedPools(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
pools := mustGetPoolEndpoints(fsDirs[:16]...) pools := mustGetPoolEndpoints(0, fsDirs[:16]...)
pools = append(pools, mustGetPoolEndpoints(fsDirs[16:]...)...) pools = append(pools, mustGetPoolEndpoints(1, fsDirs[16:]...)...)
// Everything is fine, should return nil // Everything is fine, should return nil
objLayer, _, err := initObjectLayer(ctx, pools) objLayer, _, err := initObjectLayer(ctx, pools)
@ -1088,7 +1088,7 @@ func TestHealObjectCorruptedXLMeta(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
// Everything is fine, should return nil // Everything is fine, should return nil
objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -1231,7 +1231,7 @@ func TestHealObjectCorruptedParts(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
// Everything is fine, should return nil // Everything is fine, should return nil
objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -1388,7 +1388,7 @@ func TestHealObjectErasure(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
// Everything is fine, should return nil // Everything is fine, should return nil
obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -1486,7 +1486,7 @@ func TestHealEmptyDirectoryErasure(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
// Everything is fine, should return nil // Everything is fine, should return nil
obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -1582,7 +1582,7 @@ func TestHealLastDataShard(t *testing.T) {
defer removeRoots(fsDirs) defer removeRoots(fsDirs)
obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -156,7 +156,7 @@ func TestShuffleDisks(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(disks...)) objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, disks...))
if err != nil { if err != nil {
removeRoots(disks) removeRoots(disks)
t.Fatal(err) t.Fatal(err)
@ -204,7 +204,7 @@ func TestEvalDisks(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(disks...)) objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, disks...))
if err != nil { if err != nil {
removeRoots(disks) removeRoots(disks)
t.Fatal(err) t.Fatal(err)

View File

@ -1076,7 +1076,7 @@ func TestGetObjectInlineNotInline(t *testing.T) {
fsDirs = append(fsDirs, filepath.Join(path, fmt.Sprintf("disk%d", i))) fsDirs = append(fsDirs, filepath.Join(path, fmt.Sprintf("disk%d", i)))
} }
objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
removeRoots(fsDirs) removeRoots(fsDirs)
t.Fatal(err) t.Fatal(err)

View File

@ -29,8 +29,8 @@ func prepareErasurePools() (ObjectLayer, []string, error) {
return nil, nil, err return nil, nil, err
} }
pools := mustGetPoolEndpoints(fsDirs[:16]...) pools := mustGetPoolEndpoints(0, fsDirs[:16]...)
pools = append(pools, mustGetPoolEndpoints(fsDirs[16:]...)...) pools = append(pools, mustGetPoolEndpoints(1, fsDirs[16:]...)...)
// Everything is fine, should return nil // Everything is fine, should return nil
objLayer, err := newErasureServerPools(context.Background(), pools) objLayer, err := newErasureServerPools(context.Background(), pools)

View File

@ -173,7 +173,7 @@ func TestNewErasureSets(t *testing.T) {
defer os.RemoveAll(disk) defer os.RemoveAll(disk)
} }
endpoints := mustGetNewEndpoints(erasureDisks...) endpoints := mustGetNewEndpoints(0, erasureDisks...)
_, _, err := waitForFormatErasure(true, endpoints, 1, 0, 16, "", "") _, _, err := waitForFormatErasure(true, endpoints, 1, 0, 16, "", "")
if err != errInvalidArgument { if err != errInvalidArgument {
t.Fatalf("Expecting error, got %s", err) t.Fatalf("Expecting error, got %s", err)

View File

@ -36,7 +36,7 @@ func TestFixFormatV3(t *testing.T) {
for _, erasureDir := range erasureDirs { for _, erasureDir := range erasureDirs {
defer os.RemoveAll(erasureDir) defer os.RemoveAll(erasureDir)
} }
endpoints := mustGetNewEndpoints(erasureDirs...) endpoints := mustGetNewEndpoints(0, erasureDirs...)
storageDisks, errs := initStorageDisksWithErrors(endpoints, true) storageDisks, errs := initStorageDisksWithErrors(endpoints, true)
for _, err := range errs { for _, err := range errs {
@ -555,7 +555,7 @@ func benchmarkInitStorageDisksN(b *testing.B, nDisks int) {
if err != nil { if err != nil {
b.Fatal(err) b.Fatal(err)
} }
endpoints := mustGetNewEndpoints(fsDirs...) endpoints := mustGetNewEndpoints(0, fsDirs...)
b.RunParallel(func(pb *testing.PB) { b.RunParallel(func(pb *testing.PB) {
endpoints := endpoints endpoints := endpoints
for pb.Next() { for pb.Next() {

View File

@ -1887,7 +1887,7 @@ func testListObjectsContinuation(obj ObjectLayer, instanceType string, t1 TestEr
// Initialize FS backend for the benchmark. // Initialize FS backend for the benchmark.
func initFSObjectsB(disk string, t *testing.B) (obj ObjectLayer) { func initFSObjectsB(disk string, t *testing.B) (obj ObjectLayer) {
obj, _, err := initObjectLayer(context.Background(), mustGetPoolEndpoints(disk)) obj, _, err := initObjectLayer(context.Background(), mustGetPoolEndpoints(0, disk))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -260,7 +260,7 @@ func (sys *S3PeerSys) MakeBucket(ctx context.Context, bucket string, opts MakeBu
perPoolErrs = append(perPoolErrs, errs[i]) perPoolErrs = append(perPoolErrs, errs[i])
} }
} }
if poolErr := reduceReadQuorumErrs(ctx, errs, bucketOpIgnoredErrs, len(perPoolErrs)/2+1); poolErr != nil { if poolErr := reduceReadQuorumErrs(ctx, perPoolErrs, bucketOpIgnoredErrs, len(perPoolErrs)/2+1); poolErr != nil {
return toObjectErr(poolErr, bucket) return toObjectErr(poolErr, bucket)
} }
} }
@ -303,7 +303,7 @@ func (sys *S3PeerSys) DeleteBucket(ctx context.Context, bucket string, opts Dele
perPoolErrs = append(perPoolErrs, errs[i]) perPoolErrs = append(perPoolErrs, errs[i])
} }
} }
if poolErr := reduceReadQuorumErrs(ctx, errs, bucketOpIgnoredErrs, len(perPoolErrs)/2+1); poolErr != nil { if poolErr := reduceReadQuorumErrs(ctx, perPoolErrs, bucketOpIgnoredErrs, len(perPoolErrs)/2+1); poolErr != nil {
// re-create successful deletes, since we are return an error. // re-create successful deletes, since we are return an error.
sys.MakeBucket(ctx, bucket, MakeBucketOptions{}) sys.MakeBucket(ctx, bucket, MakeBucketOptions{})
return toObjectErr(poolErr, bucket) return toObjectErr(poolErr, bucket)

View File

@ -35,7 +35,7 @@ func TestNewObjectLayer(t *testing.T) {
} }
defer removeRoots(disks) defer removeRoots(disks)
obj, err := newObjectLayer(ctx, mustGetPoolEndpoints(disks...)) obj, err := newObjectLayer(ctx, mustGetPoolEndpoints(0, disks...))
if err != nil { if err != nil {
t.Fatal("Unexpected object layer initialization error", err) t.Fatal("Unexpected object layer initialization error", err)
} }
@ -55,7 +55,7 @@ func TestNewObjectLayer(t *testing.T) {
} }
defer removeRoots(disks) defer removeRoots(disks)
obj, err = newObjectLayer(ctx, mustGetPoolEndpoints(disks...)) obj, err = newObjectLayer(ctx, mustGetPoolEndpoints(0, disks...))
if err != nil { if err != nil {
t.Fatal("Unexpected object layer initialization error", err) t.Fatal("Unexpected object layer initialization error", err)
} }

View File

@ -191,7 +191,7 @@ func prepareFS(ctx context.Context) (ObjectLayer, string, error) {
if err != nil { if err != nil {
return nil, "", err return nil, "", err
} }
obj, _, err := initObjectLayer(context.Background(), mustGetPoolEndpoints(fsDirs...)) obj, _, err := initObjectLayer(context.Background(), mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
return nil, "", err return nil, "", err
} }
@ -211,7 +211,7 @@ func prepareErasure(ctx context.Context, nDisks int) (ObjectLayer, []string, err
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(fsDirs...)) obj, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, fsDirs...))
if err != nil { if err != nil {
removeRoots(fsDirs) removeRoots(fsDirs)
return nil, nil, err return nil, nil, err
@ -331,7 +331,7 @@ func initTestServerWithBackend(ctx context.Context, t TestErrHandler, testServer
testServer.Obj = objLayer testServer.Obj = objLayer
testServer.rawDiskPaths = disks testServer.rawDiskPaths = disks
testServer.Disks = mustGetPoolEndpoints(disks...) testServer.Disks = mustGetPoolEndpoints(0, disks...)
testServer.AccessKey = credentials.AccessKey testServer.AccessKey = credentials.AccessKey
testServer.SecretKey = credentials.SecretKey testServer.SecretKey = credentials.SecretKey
@ -1932,7 +1932,7 @@ func ExecObjectLayerStaleFilesTest(t *testing.T, objTest objTestStaleFilesType)
if err != nil { if err != nil {
t.Fatalf("Initialization of drives for Erasure setup: %s", err) t.Fatalf("Initialization of drives for Erasure setup: %s", err)
} }
objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(erasureDisks...)) objLayer, _, err := initObjectLayer(ctx, mustGetPoolEndpoints(0, erasureDisks...))
if err != nil { if err != nil {
t.Fatalf("Initialization of object layer failed for Erasure setup: %s", err) t.Fatalf("Initialization of object layer failed for Erasure setup: %s", err)
} }
@ -2172,8 +2172,8 @@ func generateTLSCertKey(host string) ([]byte, []byte, error) {
return certOut.Bytes(), keyOut.Bytes(), nil return certOut.Bytes(), keyOut.Bytes(), nil
} }
func mustGetPoolEndpoints(args ...string) EndpointServerPools { func mustGetPoolEndpoints(poolIdx int, args ...string) EndpointServerPools {
endpoints := mustGetNewEndpoints(args...) endpoints := mustGetNewEndpoints(poolIdx, args...)
drivesPerSet := len(args) drivesPerSet := len(args)
setCount := 1 setCount := 1
if len(args) >= 16 { if len(args) >= 16 {
@ -2188,8 +2188,11 @@ func mustGetPoolEndpoints(args ...string) EndpointServerPools {
}} }}
} }
func mustGetNewEndpoints(args ...string) (endpoints Endpoints) { func mustGetNewEndpoints(poolIdx int, args ...string) (endpoints Endpoints) {
endpoints, err := NewEndpoints(args...) endpoints, err := NewEndpoints(args...)
for i := range endpoints {
endpoints[i].Pool = poolIdx
}
logger.FatalIf(err, "unable to create new endpoint list") logger.FatalIf(err, "unable to create new endpoint list")
return endpoints return endpoints
} }