mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-10 07:12:54 +00:00
fix: format error correctly (#4204)
* chore: remove TODO comments * fix: format error correctly
This commit is contained in:
@@ -83,20 +83,16 @@
|
||||
|
||||
pub mod catalog_name;
|
||||
pub mod datanode_table;
|
||||
/// TODO(weny):removes id.
|
||||
#[allow(unused)]
|
||||
pub mod flow;
|
||||
pub mod schema_name;
|
||||
pub mod table_info;
|
||||
pub mod table_name;
|
||||
pub mod view_info;
|
||||
// TODO(weny): removes it.
|
||||
#[allow(deprecated)]
|
||||
pub mod table_route;
|
||||
#[cfg(any(test, feature = "testing"))]
|
||||
pub mod test_utils;
|
||||
mod tombstone;
|
||||
pub(crate) mod txn_helper;
|
||||
pub mod view_info;
|
||||
|
||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
use std::fmt::Debug;
|
||||
|
||||
@@ -29,9 +29,9 @@ use self::flownode_flow::FlownodeFlowKey;
|
||||
use self::table_flow::TableFlowKey;
|
||||
use crate::ensure_values;
|
||||
use crate::error::{self, Result};
|
||||
use crate::key::flow::flow_info::{FlowInfoManager, FlowInfoManagerRef};
|
||||
use crate::key::flow::flow_name::{FlowNameManager, FlowNameManagerRef};
|
||||
use crate::key::flow::flownode_flow::{FlownodeFlowManager, FlownodeFlowManagerRef};
|
||||
use crate::key::flow::flow_info::FlowInfoManager;
|
||||
use crate::key::flow::flow_name::FlowNameManager;
|
||||
use crate::key::flow::flownode_flow::FlownodeFlowManager;
|
||||
pub use crate::key::flow::table_flow::{TableFlowManager, TableFlowManagerRef};
|
||||
use crate::key::txn_helper::TxnOpGetResponseSet;
|
||||
use crate::key::{FlowId, MetaKey};
|
||||
@@ -214,15 +214,15 @@ impl FlowMetadataManager {
|
||||
let source_table_ids = flow_value.source_table_ids();
|
||||
let mut keys =
|
||||
Vec::with_capacity(2 + flow_value.flownode_ids.len() * (source_table_ids.len() + 1));
|
||||
/// Builds flow name key
|
||||
// Builds flow name key
|
||||
let flow_name = FlowNameKey::new(&flow_value.catalog_name, &flow_value.flow_name);
|
||||
keys.push(flow_name.to_bytes());
|
||||
|
||||
/// Builds flow value key
|
||||
// Builds flow value key
|
||||
let flow_info_key = FlowInfoKey::new(flow_id);
|
||||
keys.push(flow_info_key.to_bytes());
|
||||
|
||||
/// Builds flownode flow keys & table flow keys
|
||||
// Builds flownode flow keys & table flow keys
|
||||
flow_value
|
||||
.flownode_ids
|
||||
.iter()
|
||||
@@ -310,7 +310,6 @@ mod tests {
|
||||
}
|
||||
|
||||
fn test_flow_info_value(
|
||||
flow_id: FlowId,
|
||||
flow_name: &str,
|
||||
flownode_ids: BTreeMap<FlowPartitionId, FlownodeId>,
|
||||
source_table_ids: Vec<TableId>,
|
||||
@@ -339,8 +338,7 @@ mod tests {
|
||||
let mem_kv = Arc::new(MemoryKvBackend::default());
|
||||
let flow_metadata_manager = FlowMetadataManager::new(mem_kv.clone());
|
||||
let flow_id = 10;
|
||||
let flow_value =
|
||||
test_flow_info_value(flow_id, "flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
let flow_value = test_flow_info_value("flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
flow_metadata_manager
|
||||
.create_flow_metadata(flow_id, flow_value.clone())
|
||||
.await
|
||||
@@ -380,9 +378,7 @@ mod tests {
|
||||
let mem_kv = Arc::new(MemoryKvBackend::default());
|
||||
let flow_metadata_manager = FlowMetadataManager::new(mem_kv);
|
||||
let flow_id = 10;
|
||||
let catalog_name = "greptime";
|
||||
let flow_value =
|
||||
test_flow_info_value(flow_id, "flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
let flow_value = test_flow_info_value("flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
flow_metadata_manager
|
||||
.create_flow_metadata(flow_id, flow_value.clone())
|
||||
.await
|
||||
@@ -401,8 +397,7 @@ mod tests {
|
||||
let flow_metadata_manager = FlowMetadataManager::new(mem_kv);
|
||||
let flow_id = 10;
|
||||
let catalog_name = "greptime";
|
||||
let flow_value =
|
||||
test_flow_info_value(flow_id, "flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
let flow_value = test_flow_info_value("flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
flow_metadata_manager
|
||||
.create_flow_metadata(flow_id, flow_value.clone())
|
||||
.await
|
||||
@@ -436,9 +431,7 @@ mod tests {
|
||||
let mem_kv = Arc::new(MemoryKvBackend::default());
|
||||
let flow_metadata_manager = FlowMetadataManager::new(mem_kv.clone());
|
||||
let flow_id = 10;
|
||||
let catalog_name = "greptime";
|
||||
let flow_value =
|
||||
test_flow_info_value(flow_id, "flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
let flow_value = test_flow_info_value("flow", [(0, 1u64)].into(), vec![1024, 1025, 1026]);
|
||||
flow_metadata_manager
|
||||
.create_flow_metadata(flow_id, flow_value.clone())
|
||||
.await
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use api::v1::flow::flow_server::Flow;
|
||||
use lazy_static::lazy_static;
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -23,9 +20,7 @@ use snafu::OptionExt;
|
||||
use crate::error::{self, Result};
|
||||
use crate::key::flow::FlowScoped;
|
||||
use crate::key::txn_helper::TxnOpGetResponseSet;
|
||||
use crate::key::{
|
||||
txn_helper, DeserializedValueWithBytes, FlowId, MetaKey, TableMetaValue, NAME_PATTERN,
|
||||
};
|
||||
use crate::key::{DeserializedValueWithBytes, FlowId, MetaKey, TableMetaValue, NAME_PATTERN};
|
||||
use crate::kv_backend::txn::Txn;
|
||||
use crate::kv_backend::KvBackendRef;
|
||||
|
||||
@@ -50,11 +45,13 @@ impl<'a> FlowNameKey<'a> {
|
||||
FlowNameKey(FlowScoped::new(inner))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
/// Returns the catalog.
|
||||
pub fn catalog(&self) -> &str {
|
||||
self.0.catalog_name
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
/// Return the `flow_name`
|
||||
pub fn flow_name(&self) -> &str {
|
||||
self.0.flow_name
|
||||
@@ -143,8 +140,6 @@ impl FlowNameValue {
|
||||
}
|
||||
}
|
||||
|
||||
pub type FlowNameManagerRef = Arc<FlowNameManager>;
|
||||
|
||||
/// The manager of [FlowNameKey].
|
||||
pub struct FlowNameManager {
|
||||
kv_backend: KvBackendRef,
|
||||
|
||||
@@ -79,6 +79,7 @@ impl FlownodeFlowKey {
|
||||
self.0.flow_id
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
/// Returns the [FlownodeId].
|
||||
pub fn flownode_id(&self) -> FlownodeId {
|
||||
self.0.flownode_id
|
||||
@@ -150,8 +151,6 @@ impl<'a> MetaKey<'a, FlownodeFlowKeyInner> for FlownodeFlowKeyInner {
|
||||
}
|
||||
}
|
||||
|
||||
pub type FlownodeFlowManagerRef = Arc<FlownodeFlowManager>;
|
||||
|
||||
/// The manager of [FlownodeFlowKey].
|
||||
pub struct FlownodeFlowManager {
|
||||
kv_backend: KvBackendRef,
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use common_error::ext::ErrorExt;
|
||||
use common_meta::instruction::{InstructionReply, SimpleReply};
|
||||
use common_meta::RegionIdent;
|
||||
use common_telemetry::{tracing, warn};
|
||||
@@ -47,7 +46,7 @@ impl HandlerContext {
|
||||
}
|
||||
Err(err) => InstructionReply::CloseRegion(SimpleReply {
|
||||
result: false,
|
||||
error: Some(err.output_msg()),
|
||||
error: Some(format!("{err:?}")),
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use common_error::ext::ErrorExt;
|
||||
use common_meta::instruction::{DowngradeRegion, DowngradeRegionReply, InstructionReply};
|
||||
use futures_util::future::BoxFuture;
|
||||
use store_api::region_engine::SetReadonlyResponse;
|
||||
@@ -43,7 +42,7 @@ impl HandlerContext {
|
||||
Err(err) => InstructionReply::DowngradeRegion(DowngradeRegionReply {
|
||||
last_entry_id: None,
|
||||
exists: true,
|
||||
error: Some(err.output_msg()),
|
||||
error: Some(format!("{err:?}")),
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use common_error::ext::ErrorExt;
|
||||
use common_meta::instruction::{InstructionReply, OpenRegion, SimpleReply};
|
||||
use common_meta::wal_options_allocator::prepare_wal_options;
|
||||
use futures_util::future::BoxFuture;
|
||||
@@ -43,7 +42,7 @@ impl HandlerContext {
|
||||
});
|
||||
let result = self.region_server.handle_request(region_id, request).await;
|
||||
let success = result.is_ok();
|
||||
let error = result.as_ref().map_err(|e| e.output_msg()).err();
|
||||
let error = result.as_ref().map_err(|e| format!("{e:?}")).err();
|
||||
InstructionReply::OpenRegion(SimpleReply {
|
||||
result: success,
|
||||
error,
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use common_error::ext::ErrorExt;
|
||||
use common_meta::instruction::{InstructionReply, UpgradeRegion, UpgradeRegionReply};
|
||||
use common_telemetry::{info, warn};
|
||||
use futures_util::future::BoxFuture;
|
||||
@@ -107,7 +106,7 @@ impl HandlerContext {
|
||||
InstructionReply::UpgradeRegion(UpgradeRegionReply {
|
||||
ready: false,
|
||||
exists: true,
|
||||
error: Some(err.output_msg()),
|
||||
error: Some(format!("{err:?}")),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user