Skip to content

Commit 9a45829

Browse files
authored
chore: remove admin api for testing for old version SM (#16236)
1 parent a3a878b commit 9a45829

File tree

7 files changed

+4
-184
lines changed

7 files changed

+4
-184
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/meta/raft-store/src/sm_v003/sm_v003.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ use crate::leveled_store::map_api::MapApiExt;
5353
use crate::leveled_store::map_api::MapApiRO;
5454
use crate::leveled_store::sys_data_api::SysDataApiRO;
5555
use crate::marked::Marked;
56-
use crate::state_machine::sm::BlockingConfig;
5756
use crate::state_machine::ExpireKey;
5857
use crate::state_machine::StateMachineSubscriber;
5958
use crate::utils::prefix_right_bound;
@@ -117,8 +116,6 @@ impl<'a> SMV003KVApi<'a> {
117116
pub struct SMV003 {
118117
pub(in crate::sm_v003) levels: LeveledMap,
119118

120-
blocking_config: BlockingConfig,
121-
122119
/// The expiration key since which for next clean.
123120
pub(in crate::sm_v003) expire_cursor: ExpireKey,
124121

@@ -172,15 +169,6 @@ impl SMV003 {
172169
self.levels.persisted().cloned()
173170
}
174171

175-
/// Return a Arc of the blocking config. It is only used for testing.
176-
pub fn blocking_config_mut(&mut self) -> &mut BlockingConfig {
177-
&mut self.blocking_config
178-
}
179-
180-
pub fn blocking_config(&self) -> &BlockingConfig {
181-
&self.blocking_config
182-
}
183-
184172
#[allow(dead_code)]
185173
pub(crate) fn new_applier(&mut self) -> Applier {
186174
Applier::new(self)
@@ -257,7 +245,7 @@ impl SMV003 {
257245
}
258246

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

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

339327
self.levels = level;
340328

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

src/meta/raft-store/src/state_machine/sm.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ pub struct StateMachine {
107107
/// - Every other state is store in its own keyspace such as `Nodes`.
108108
pub sm_tree: SledTree,
109109

110-
blocking_config: BlockingConfig,
111-
112110
/// subscriber of state machine data
113111
pub subscriber: Option<Box<dyn StateMachineSubscriber>>,
114112
}
@@ -135,23 +133,7 @@ impl SerializableSnapshot {
135133
}
136134
}
137135

138-
/// Configuration of what operation to block for testing purpose.
139-
#[derive(Debug, Clone, Default)]
140-
pub struct BlockingConfig {
141-
pub write_snapshot: Duration,
142-
pub compact_snapshot: Duration,
143-
}
144-
145136
impl StateMachine {
146-
/// Return a Arc of the blocking config. It is only used for testing.
147-
pub fn blocking_config_mut(&mut self) -> &mut BlockingConfig {
148-
&mut self.blocking_config
149-
}
150-
151-
pub fn blocking_config(&self) -> &BlockingConfig {
152-
&self.blocking_config
153-
}
154-
155137
pub fn tree_name(config: &RaftConfig, sm_id: u64) -> String {
156138
config.tree_name(format!("{}/{}", TREE_STATE_MACHINE, sm_id))
157139
}
@@ -167,7 +149,6 @@ impl StateMachine {
167149

168150
let sm = StateMachine {
169151
sm_tree,
170-
blocking_config: BlockingConfig::default(),
171152
subscriber: None,
172153
};
173154

src/meta/service/src/api/http/v1/ctrl.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
use std::sync::Arc;
16-
use std::time::Duration;
1716

1817
use databend_common_meta_sled_store::openraft::async_runtime::watch::WatchReceiver;
1918
use databend_common_meta_types::NodeId;
@@ -128,21 +127,3 @@ pub async fn trigger_transfer_leader(
128127
voter_ids,
129128
}))
130129
}
131-
132-
#[poem::handler]
133-
pub async fn block_write_snapshot(
134-
meta_node: Data<&Arc<MetaNode>>,
135-
) -> poem::Result<impl IntoResponse> {
136-
let mut sm = meta_node.sto.get_state_machine().await;
137-
sm.blocking_config_mut().write_snapshot = Duration::from_millis(1_000_000);
138-
Ok(Json(()))
139-
}
140-
141-
#[poem::handler]
142-
pub async fn block_compact_snapshot(
143-
meta_node: Data<&Arc<MetaNode>>,
144-
) -> poem::Result<impl IntoResponse> {
145-
let mut sm = meta_node.sto.get_state_machine().await;
146-
sm.blocking_config_mut().compact_snapshot = Duration::from_millis(1_000_000);
147-
Ok(Json(()))
148-
}

src/meta/service/src/api/http_service.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ impl HttpService {
6565
"/v1/ctrl/trigger_transfer_leader",
6666
get(super::http::v1::ctrl::trigger_transfer_leader),
6767
)
68-
.at(
69-
"/v1/ctrl/block_write_snapshot",
70-
get(super::http::v1::ctrl::block_write_snapshot),
71-
)
72-
.at(
73-
"/v1/ctrl/block_compact_snapshot",
74-
get(super::http::v1::ctrl::block_compact_snapshot),
75-
)
7668
.at(
7769
"/v1/cluster/nodes",
7870
get(super::http::v1::cluster_state::nodes_handler),

src/meta/service/tests/it/meta_node/meta_node_raft_api.rs

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/meta/service/tests/it/meta_node/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@
1515
pub(crate) mod meta_node_kv_api;
1616
pub(crate) mod meta_node_kv_api_expire;
1717
pub(crate) mod meta_node_lifecycle;
18-
pub(crate) mod meta_node_raft_api;
1918
pub(crate) mod meta_node_replication;
2019
pub(crate) mod meta_node_request_forwarding;

0 commit comments

Comments
 (0)