Skip to content

Commit

Permalink
chore: resolve some review conversations
Browse files Browse the repository at this point in the history
  • Loading branch information
niebayes committed Dec 19, 2023
1 parent b2ec3d1 commit 4350751
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 34 deletions.
27 changes: 14 additions & 13 deletions config/metasrv.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ provider = "raft_engine"

# There're none raft-engine wal config since meta srv only involves in remote wal currently.

# Uncomment the following lines if switching provider to "kafka".
# Kafka wal config.
# The broker endpoints of the Kafka cluster. ["127.0.0.1:9090"] by default.
broker_endpoints = ["127.0.0.1:9090"]
# Number of topics to be created upon start.
num_topics = 64
# Topic selector type.
# Available selector types:
# - "round_robin" (default)
selector_type = "round_robin"
# A Kafka topic is constructed by concatenating `topic_name_prefix` and `topic_id`.
topic_name_prefix = "greptimedb_kafka_wal"
# Number of partitions per topic.
num_partitions = 1
# Expected number of replicas of each partition.
replication_factor = 3
# broker_endpoints = ["127.0.0.1:9090"]
# # Number of topics to be created upon start.
# num_topics = 64
# # Topic selector type.
# # Available selector types:
# # - "round_robin" (default)
# selector_type = "round_robin"
# # A Kafka topic is constructed by concatenating `topic_name_prefix` and `topic_id`.
# topic_name_prefix = "greptimedb_kafka_wal"
# # Number of partitions per topic.
# num_partitions = 1
# # Expected number of replicas of each partition.
# replication_factor = 3
4 changes: 1 addition & 3 deletions src/cmd/src/cli/bench/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ use std::time::Instant;
use common_meta::key::TableMetadataManagerRef;
use common_meta::table_name::TableName;

use super::{
bench_self_recorded, create_region_routes, create_region_wal_options, create_table_info,
};
use crate::cli::bench::*;

pub struct TableMetadataBencher {
table_metadata_manager: TableMetadataManagerRef,
Expand Down
2 changes: 1 addition & 1 deletion src/common/meta/src/key/datanode_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ mod tests {
}

// This test intends to ensure both the `serde_json::to_string` + `serde_json::from_str`
// and `serde_json::to_vec` + `serde_json::from_slice` works for `DatanodeTableValue`.
// and `serde_json::to_vec` + `serde_json::from_slice` work for `DatanodeTableValue`.
// Warning: if the key of `region_wal_options` is of type non-String, this test would fail.
#[test]
fn test_serde_with_region_info() {
Expand Down
10 changes: 5 additions & 5 deletions src/common/meta/src/wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use crate::wal::kafka::KafkaConfig;
pub use crate::wal::kafka::{KafkaOptions as KafkaWalOptions, Topic as KafkaWalTopic};
pub use crate::wal::options_allocator::WalOptionsAllocator;

// An encoded wal options will be wrapped into a (WAL_OPTIONS_KEY, encoded wal options) key-value pair
// and inserted into the options of a `RegionCreateRequest`.
/// An encoded wal options will be wrapped into a (WAL_OPTIONS_KEY, encoded wal options) key-value pair
/// and inserted into the options of a `RegionCreateRequest`.
pub const WAL_OPTIONS_KEY: &str = "wal_options";

/// Wal configurations for bootstrapping meta srv.
Expand All @@ -41,9 +41,9 @@ pub enum WalConfig {
}

/// Wal options allocated to a region.
// A wal options is encoded by meta srv into a `String` with `serde_json::to_string`.
// It's then decoded by datanode to a `HashMap<String, String>` with `serde_json::from_str`.
// Such a encoding/decoding scheme is inspired by the encoding/decoding of `RegionOptions`.
/// A wal options is encoded by meta srv into a `String` with `serde_json::to_string`.
/// It's then decoded by datanode to a `HashMap<String, String>` with `serde_json::from_str`.
/// Such a encoding/decoding scheme is inspired by the encoding/decoding of `RegionOptions`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
#[serde(tag = "wal.provider")]
pub enum WalOptions {
Expand Down
10 changes: 0 additions & 10 deletions src/common/meta/src/wal/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,7 @@ impl Default for KafkaConfig {

/// Kafka wal options allocated to a region.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(default)]
pub struct KafkaOptions {
/// Kafka wal topic.
pub topic: Topic,
}

impl Default for KafkaOptions {
fn default() -> Self {
Self {
// To indicates a default deserialized topic is invalid.
topic: "invalid_topic".to_string(),
}
}
}
2 changes: 1 addition & 1 deletion src/common/meta/src/wal/kafka/topic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

/// Kafka wal topic.
/// Publishers publish log entries to the topic while subscribers pull log entries from the topic.
// A topic is simply a string right now. But it may be more complex in the future.
/// A topic is simply a string right now. But it may be more complex in the future.
pub type Topic = String;
2 changes: 1 addition & 1 deletion src/common/meta/src/wal/kafka/topic_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use crate::wal::kafka::topic::Topic;

/// The type of the topic selector, i.e. with which strategy to select a topic.
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum SelectorType {
#[default]
#[serde(rename = "round_robin")]
RoundRobin,
}

Expand Down

0 comments on commit 4350751

Please sign in to comment.