-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only start overload monitor when sui node is a validator (#16309)
## Description Says by the title. It also doesn't handle validator -> fullnode -> validator flow. ## Test Plan Unit test added. Also did a round of cluster testing to make sure that overload monitor can start on validators. --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
- Loading branch information
Showing
5 changed files
with
99 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Tests that overload monitor only starts on validators. | ||
#[cfg(msim)] | ||
mod simtests { | ||
use std::sync::atomic::AtomicUsize; | ||
use std::sync::atomic::Ordering; | ||
use std::sync::Arc; | ||
use sui_macros::register_fail_point; | ||
use sui_macros::sim_test; | ||
use test_cluster::TestClusterBuilder; | ||
|
||
#[sim_test] | ||
async fn overload_monitor_in_different_nodes() { | ||
telemetry_subscribers::init_for_testing(); | ||
|
||
// Uses a fail point to count the number of nodes that start overload monitor. | ||
let counter: Arc<AtomicUsize> = Arc::new(AtomicUsize::new(0)); | ||
let counter_clone = counter.clone(); | ||
register_fail_point("starting_overload_monitor", move || { | ||
counter_clone.fetch_add(1, Ordering::SeqCst); | ||
}); | ||
|
||
// Creates a cluster, and tests that number of nodes with overload monitor is equal to | ||
// the number of validators. | ||
let test_cluster = TestClusterBuilder::new().build().await; | ||
let nodes_with_overload_monitor = counter.load(Ordering::SeqCst); | ||
assert_eq!( | ||
nodes_with_overload_monitor, | ||
test_cluster.swarm.validator_node_handles().len() | ||
); | ||
|
||
// Tests (indirectly) that fullnodes don't run overload monitor. | ||
assert!( | ||
test_cluster.swarm.all_nodes().collect::<Vec<_>>().len() > nodes_with_overload_monitor | ||
); | ||
} | ||
} | ||
|
||
// TODO: move other overload relate tests from execution_driver_tests.rs to here. |
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