Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove admin api for testing for old version SM #16236

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 4 additions & 16 deletions src/meta/raft-store/src/sm_v003/sm_v003.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ use crate::leveled_store::map_api::MapApiExt;
use crate::leveled_store::map_api::MapApiRO;
use crate::leveled_store::sys_data_api::SysDataApiRO;
use crate::marked::Marked;
use crate::state_machine::sm::BlockingConfig;
use crate::state_machine::ExpireKey;
use crate::state_machine::StateMachineSubscriber;
use crate::utils::prefix_right_bound;
Expand Down Expand Up @@ -117,8 +116,6 @@ impl<'a> SMV003KVApi<'a> {
pub struct SMV003 {
pub(in crate::sm_v003) levels: LeveledMap,

blocking_config: BlockingConfig,

/// The expiration key since which for next clean.
pub(in crate::sm_v003) expire_cursor: ExpireKey,

Expand Down Expand Up @@ -172,15 +169,6 @@ impl SMV003 {
self.levels.persisted().cloned()
}

/// Return a Arc of the blocking config. It is only used for testing.
pub fn blocking_config_mut(&mut self) -> &mut BlockingConfig {
&mut self.blocking_config
}

pub fn blocking_config(&self) -> &BlockingConfig {
&self.blocking_config
}

#[allow(dead_code)]
pub(crate) fn new_applier(&mut self) -> Applier {
Applier::new(self)
Expand Down Expand Up @@ -257,7 +245,7 @@ impl SMV003 {
}

/// List expiration index by expiration time,
/// upto current time(exclusive) in milli seconds.
/// upto current time(exclusive) in milliseconds.
///
/// Only records with expire time less than current time will be returned.
/// Expire time that equals to current time is not considered expired.
Expand Down Expand Up @@ -323,7 +311,7 @@ impl SMV003 {
self.levels.acquire_compactor().await
}

/// Replace all of the state machine data with the given one.
/// Replace all the state machine data with the given one.
/// The input is a multi-level data.
pub fn replace(&mut self, level: LeveledMap) {
let applied = self.levels.writable_ref().last_applied_ref();
Expand All @@ -338,8 +326,8 @@ impl SMV003 {

self.levels = level;

// The installed data may not cleaned up all expired keys, if it is built with an older state machine.
// So we need to reset the cursor then the next time applying a log it will cleanup all expired.
// The installed data may not clean up all expired keys, if it is built with an older state machine.
// So we need to reset the cursor then the next time applying a log it will clean up all expired.
self.expire_cursor = ExpireKey::new(0, 0);
}

Expand Down
19 changes: 0 additions & 19 deletions src/meta/raft-store/src/state_machine/sm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ pub struct StateMachine {
/// - Every other state is store in its own keyspace such as `Nodes`.
pub sm_tree: SledTree,

blocking_config: BlockingConfig,

/// subscriber of state machine data
pub subscriber: Option<Box<dyn StateMachineSubscriber>>,
}
Expand All @@ -135,23 +133,7 @@ impl SerializableSnapshot {
}
}

/// Configuration of what operation to block for testing purpose.
#[derive(Debug, Clone, Default)]
pub struct BlockingConfig {
pub write_snapshot: Duration,
pub compact_snapshot: Duration,
}

impl StateMachine {
/// Return a Arc of the blocking config. It is only used for testing.
pub fn blocking_config_mut(&mut self) -> &mut BlockingConfig {
&mut self.blocking_config
}

pub fn blocking_config(&self) -> &BlockingConfig {
&self.blocking_config
}

pub fn tree_name(config: &RaftConfig, sm_id: u64) -> String {
config.tree_name(format!("{}/{}", TREE_STATE_MACHINE, sm_id))
}
Expand All @@ -167,7 +149,6 @@ impl StateMachine {

let sm = StateMachine {
sm_tree,
blocking_config: BlockingConfig::default(),
subscriber: None,
};

Expand Down
19 changes: 0 additions & 19 deletions src/meta/service/src/api/http/v1/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

use std::sync::Arc;
use std::time::Duration;

use databend_common_meta_sled_store::openraft::async_runtime::watch::WatchReceiver;
use databend_common_meta_types::NodeId;
Expand Down Expand Up @@ -128,21 +127,3 @@ pub async fn trigger_transfer_leader(
voter_ids,
}))
}

#[poem::handler]
pub async fn block_write_snapshot(
meta_node: Data<&Arc<MetaNode>>,
) -> poem::Result<impl IntoResponse> {
let mut sm = meta_node.sto.get_state_machine().await;
sm.blocking_config_mut().write_snapshot = Duration::from_millis(1_000_000);
Ok(Json(()))
}

#[poem::handler]
pub async fn block_compact_snapshot(
meta_node: Data<&Arc<MetaNode>>,
) -> poem::Result<impl IntoResponse> {
let mut sm = meta_node.sto.get_state_machine().await;
sm.blocking_config_mut().compact_snapshot = Duration::from_millis(1_000_000);
Ok(Json(()))
}
8 changes: 0 additions & 8 deletions src/meta/service/src/api/http_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ impl HttpService {
"/v1/ctrl/trigger_transfer_leader",
get(super::http::v1::ctrl::trigger_transfer_leader),
)
.at(
"/v1/ctrl/block_write_snapshot",
get(super::http::v1::ctrl::block_write_snapshot),
)
.at(
"/v1/ctrl/block_compact_snapshot",
get(super::http::v1::ctrl::block_compact_snapshot),
)
.at(
"/v1/cluster/nodes",
get(super::http::v1::cluster_state::nodes_handler),
Expand Down
120 changes: 0 additions & 120 deletions src/meta/service/tests/it/meta_node/meta_node_raft_api.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/meta/service/tests/it/meta_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
pub(crate) mod meta_node_kv_api;
pub(crate) mod meta_node_kv_api_expire;
pub(crate) mod meta_node_lifecycle;
pub(crate) mod meta_node_raft_api;
pub(crate) mod meta_node_replication;
pub(crate) mod meta_node_request_forwarding;
Loading