-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DAOS-15956 control: Limit race between taking leadership and join (#1…
…4541) In very limited situations, it is possible to encounter a race condition between an MS replica stepping up as leader and engines beginning to join the system. In that case, the system fabric provider property may not yet be set, causing the engine join to fail. This change shrinks the gap where the race can occur. It also returns a retryable error on the small chance that this scenario is hit. Signed-off-by: Kris Jacque <kris.jacque@intel.com>
- Loading branch information
Showing
9 changed files
with
274 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
// (C) Copyright 2024 Intel Corporation. | ||
// | ||
// SPDX-License-Identifier: BSD-2-Clause-Patent | ||
// | ||
|
||
package system | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/pkg/errors" | ||
|
||
"github.com/daos-stack/daos/src/control/common/test" | ||
) | ||
|
||
func TestSystem_Errors_IsNotReady(t *testing.T) { | ||
for name, tc := range map[string]struct { | ||
err error | ||
expResult bool | ||
}{ | ||
"nil": {}, | ||
"uninitialized": { | ||
err: ErrUninitialized, | ||
expResult: true, | ||
}, | ||
"raft not available": { | ||
err: ErrRaftUnavail, | ||
expResult: true, | ||
}, | ||
"leadership transfer in progress": { | ||
err: ErrLeaderStepUpInProgress, | ||
expResult: true, | ||
}, | ||
"something else": { | ||
err: errors.New("something is wrong"), | ||
}, | ||
} { | ||
t.Run(name, func(t *testing.T) { | ||
test.AssertEqual(t, tc.expResult, IsNotReady(tc.err), "") | ||
}) | ||
} | ||
} | ||
|
||
func TestSystem_Errors_IsUninitialized(t *testing.T) { | ||
for name, tc := range map[string]struct { | ||
err error | ||
expResult bool | ||
}{ | ||
"nil": {}, | ||
"uninitialized": { | ||
err: ErrUninitialized, | ||
expResult: true, | ||
}, | ||
"unavailable not uninitialized": { | ||
err: ErrRaftUnavail, | ||
}, | ||
"something else": { | ||
err: errors.New("something is wrong"), | ||
}, | ||
} { | ||
t.Run(name, func(t *testing.T) { | ||
test.AssertEqual(t, tc.expResult, IsUninitialized(tc.err), "") | ||
}) | ||
} | ||
} | ||
|
||
func TestSystem_Errors_IsUnavailable(t *testing.T) { | ||
for name, tc := range map[string]struct { | ||
err error | ||
expResult bool | ||
}{ | ||
"nil": {}, | ||
"raft not available": { | ||
err: ErrRaftUnavail, | ||
expResult: true, | ||
}, | ||
"leadership transfer in progress": { | ||
err: ErrLeaderStepUpInProgress, | ||
expResult: true, | ||
}, | ||
"uninitialized not unavailable": { | ||
err: ErrUninitialized, | ||
}, | ||
"something else": { | ||
err: errors.New("something is wrong"), | ||
}, | ||
} { | ||
t.Run(name, func(t *testing.T) { | ||
test.AssertEqual(t, tc.expResult, IsUnavailable(tc.err), "") | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.