Skip to content

Commit

Permalink
Merge branch 'develop' into feat/pprof
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Jun 7, 2023
2 parents 5d46b9c + 8cda163 commit 24b1778
Show file tree
Hide file tree
Showing 34 changed files with 454 additions and 232 deletions.
54 changes: 27 additions & 27 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion src/client/src/client_manager.rs
Expand Up @@ -31,7 +31,6 @@ pub struct DatanodeClients {

impl Default for DatanodeClients {
fn default() -> Self {
// TODO(LFC): Make this channel config configurable.
let config = ChannelConfig::new().timeout(Duration::from_secs(8));

Self {
Expand Down
1 change: 0 additions & 1 deletion src/client/src/database.rs
Expand Up @@ -254,7 +254,6 @@ impl Database {

let mut client = self.client.make_flight_client()?;

// TODO(LFC): Streaming get flight data.
let flight_data: Vec<FlightData> = client
.mut_inner()
.do_get(request)
Expand Down
4 changes: 1 addition & 3 deletions src/cmd/Cargo.toml
Expand Up @@ -10,7 +10,6 @@ name = "greptime"
path = "src/bin/greptime.rs"

[features]
mem-prof = ["tikv-jemallocator", "tikv-jemalloc-ctl"]
tokio-console = ["common-telemetry/tokio-console"]

[dependencies]
Expand Down Expand Up @@ -42,8 +41,7 @@ servers = { path = "../servers" }
session = { path = "../session" }
snafu.workspace = true
substrait = { path = "../common/substrait" }
tikv-jemalloc-ctl = { version = "0.5", optional = true }
tikv-jemallocator = { version = "0.5", optional = true }
tikv-jemallocator = "0.5"
tokio.workspace = true

[dev-dependencies]
Expand Down
1 change: 0 additions & 1 deletion src/cmd/src/bin/greptime.rs
Expand Up @@ -180,7 +180,6 @@ fn full_version() -> &'static str {
)
}

#[cfg(feature = "mem-prof")]
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

Expand Down
1 change: 0 additions & 1 deletion src/common/query/src/logical_plan/accumulator.rs
Expand Up @@ -172,7 +172,6 @@ impl DfAccumulator for DfAccumulatorAdaptor {
}

fn size(&self) -> usize {
// TODO(LFC): Implement new "size" method for Accumulator.
0
}
}
1 change: 0 additions & 1 deletion src/common/query/src/physical_plan.rs
Expand Up @@ -194,7 +194,6 @@ impl DfPhysicalPlan for DfPhysicalPlanAdapter {
}

fn statistics(&self) -> Statistics {
// TODO(LFC): impl statistics
Statistics::default()
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/frontend/src/instance.rs
Expand Up @@ -285,9 +285,6 @@ impl Instance {
requests: InsertRequests,
ctx: QueryContextRef,
) -> Result<Output> {
// TODO(LFC): Optimize concurrent table creation and table alteration.
// Currently table creation is guarded by a distributed lock in Metasrv. However, table
// alteration is not. We should all switch to procedures in Metasrv.
let _ = future::join_all(
requests
.inserts
Expand Down
3 changes: 0 additions & 3 deletions src/frontend/src/instance/distributed.rs
Expand Up @@ -598,7 +598,6 @@ impl DistInstance {
Ok(Output::AffectedRows(affected_rows as usize))
}

// TODO(LFC): Like insertions above, refactor GRPC deletion impl here.
async fn handle_dist_delete(
&self,
request: DeleteRequest,
Expand Down Expand Up @@ -662,8 +661,6 @@ impl GrpcQueryHandler for DistInstance {
match expr {
DdlExpr::CreateDatabase(expr) => self.handle_create_database(expr, ctx).await,
DdlExpr::CreateTable(mut expr) => {
// TODO(LFC): Support creating distributed table through GRPC interface.
// Currently only SQL supports it; how to design the fields in CreateTableExpr?
let _ = self.create_table(&mut expr, None).await;
Ok(Output::AffectedRows(0))
}
Expand Down
6 changes: 0 additions & 6 deletions src/meta-srv/src/handler/failure_handler.rs
Expand Up @@ -74,12 +74,6 @@ impl HeartbeatHandler for RegionFailureHandler {

let Some(stat) = acc.stat.as_ref() else { return Ok(()) };

// TODO(LFC): Filter out the stalled heartbeats:
// After the region failover is done, the distribution of region is changed.
// We can compare the heartbeat info here with the global region placement metadata,
// and remove the incorrect region ident keys in failure detect runner
// (by sending a control message).

let heartbeat = DatanodeHeartbeat {
region_idents: stat
.region_stats
Expand Down
20 changes: 8 additions & 12 deletions src/meta-srv/src/metasrv.rs
Expand Up @@ -146,25 +146,21 @@ impl MetaSrv {
common_runtime::spawn_bg(async move {
loop {
match rx.recv().await {
Ok(msg) => {
match msg {
LeaderChangeMessage::Elected(_) => {
if let Err(e) = procedure_manager.recover().await {
error!("Failed to recover procedures, error: {e}");
}
}
LeaderChangeMessage::StepDown(leader) => {
// TODO(LFC): TBC
error!("Leader :{:?} step down", leader);
Ok(msg) => match msg {
LeaderChangeMessage::Elected(_) => {
if let Err(e) = procedure_manager.recover().await {
error!("Failed to recover procedures, error: {e}");
}
}
}
LeaderChangeMessage::StepDown(leader) => {
error!("Leader :{:?} step down", leader);
}
},
Err(RecvError::Closed) => {
error!("Not expected, is leader election loop still running?");
break;
}
Err(RecvError::Lagged(_)) => {
// TODO(LFC): TBC
break;
}
}
Expand Down
10 changes: 0 additions & 10 deletions src/meta-srv/src/procedure/region_failover/update_metadata.rs
Expand Up @@ -43,16 +43,6 @@ impl UpdateRegionMetadata {
Self { candidate }
}

// TODO(LFC): Update the two table metadata values in a batch atomically.
//
// Though the updating of the two metadata values is guarded by a distributed lock,
// it does not robust enough. For example, the lock lease could be expired in the middle of
// one's updating, letting others to start updating concurrently. For now, we set the lease of
// the distributed lock to 10 seconds, which is long enough here to get the job done.
//
// Maybe we should introduce "version" companion values to these two metadata values, and
// use ETCD transaction request to update them?

/// Updates the metadata of the table. Specifically, the [TableGlobalValue] and [TableRouteValue].
async fn update_metadata(
&self,
Expand Down
8 changes: 8 additions & 0 deletions src/meta-srv/src/service/admin.rs
Expand Up @@ -16,6 +16,7 @@ mod health;
mod heartbeat;
mod leader;
mod meta;
mod route;

use std::collections::HashMap;
use std::convert::Infallible;
Expand Down Expand Up @@ -73,6 +74,13 @@ pub fn make_admin_service(meta_srv: MetaSrv) -> Admin {
},
);

let router = router.route(
"/route",
route::RouteHandler {
kv_store: meta_srv.kv_store(),
},
);

let router = Router::nest("/admin", router);

Admin::new(router)
Expand Down

0 comments on commit 24b1778

Please sign in to comment.