Skip to content

Commit

Permalink
Merge pull request #8256 from BohuTANG/dev-more-logs
Browse files Browse the repository at this point in the history
chore: add more debug log to measure the time cost
  • Loading branch information
BohuTANG authored Oct 17, 2022
2 parents 3d42104 + 01586a5 commit 1a8cd3d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/query/storages/fuse/src/fuse_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ impl Table for FuseTable {
self.do_read_partitions(ctx, push_downs).await
}

#[tracing::instrument(level = "debug", name = "fuse_table_read2", skip(self, ctx, pipeline), fields(ctx.id = ctx.get_id().as_str()))]
#[tracing::instrument(level = "debug", name = "fuse_table_read_data", skip(self, ctx, pipeline), fields(ctx.id = ctx.get_id().as_str()))]
fn read_data(
&self,
ctx: Arc<dyn TableContext>,
plan: &ReadDataSourcePlan,
pipeline: &mut Pipeline,
) -> Result<()> {
self.do_read2(ctx, plan, pipeline)
self.do_read_data(ctx, plan, pipeline)
}

fn append_data(
Expand All @@ -370,7 +370,7 @@ impl Table for FuseTable {
need_output: bool,
) -> Result<()> {
self.check_mutable()?;
self.do_append2(ctx, pipeline, need_output)
self.do_append_data(ctx, pipeline, need_output)
}

#[tracing::instrument(level = "debug", name = "fuse_table_commit_insertion", skip(self, ctx, operations), fields(ctx.id = ctx.get_id().as_str()))]
Expand Down
2 changes: 1 addition & 1 deletion src/query/storages/fuse/src/operations/append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::DEFAULT_BLOCK_PER_SEGMENT;
use crate::FUSE_OPT_KEY_BLOCK_PER_SEGMENT;

impl FuseTable {
pub fn do_append2(
pub fn do_append_data(
&self,
ctx: Arc<dyn TableContext>,
pipeline: &mut Pipeline,
Expand Down
2 changes: 1 addition & 1 deletion src/query/storages/fuse/src/operations/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl FuseTable {
};

ctx.try_set_partitions(plan.parts.clone())?;
self.do_read2(ctx.clone(), &plan, pipeline)?;
self.do_read_data(ctx.clone(), &plan, pipeline)?;

pipeline.add_transform(|transform_input_port, transform_output_port| {
TransformCompact::try_create(
Expand Down
2 changes: 1 addition & 1 deletion src/query/storages/fuse/src/operations/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl FuseTable {
}

#[inline]
pub fn do_read2(
pub fn do_read_data(
&self,
ctx: Arc<dyn TableContext>,
plan: &ReadDataSourcePlan,
Expand Down
17 changes: 17 additions & 0 deletions src/query/storages/fuse/src/operations/read_partitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use std::collections::HashMap;
use std::sync::Arc;
use std::time::Instant;

use common_catalog::table_context::TableContext;
use common_datavalues::DataSchemaRef;
Expand All @@ -28,6 +29,7 @@ use common_legacy_planners::Projection;
use common_legacy_planners::Statistics;
use common_meta_app::schema::TableInfo;
use opendal::Operator;
use tracing::debug;

use crate::fuse_lazy_part::FuseLazyPartInfo;
use crate::fuse_part::ColumnLeaves;
Expand All @@ -43,6 +45,8 @@ impl FuseTable {
ctx: Arc<dyn TableContext>,
push_downs: Option<Extras>,
) -> Result<(Statistics, Partitions)> {
debug!("fuse table do read partitions, push downs:{:?}", push_downs);

let snapshot = self.read_table_snapshot(ctx.clone()).await?;
match snapshot {
Some(snapshot) => {
Expand Down Expand Up @@ -95,6 +99,12 @@ impl FuseTable {
segments_location: Vec<Location>,
summary: usize,
) -> Result<(Statistics, Partitions)> {
let start = Instant::now();
debug!(
"prune snapshot block start, segment numbers:{}",
segments_location.len()
);

let block_metas = BlockPruner::prune(
&ctx,
dal,
Expand All @@ -106,6 +116,13 @@ impl FuseTable {
.into_iter()
.map(|(_, v)| v)
.collect::<Vec<_>>();

debug!(
"prune snapshot block end, final block numbers:{}, cost:{}",
block_metas.len(),
start.elapsed().as_secs()
);

Self::read_partitions_with_metas(ctx, table_info.schema(), push_downs, block_metas, summary)
}

Expand Down
2 changes: 1 addition & 1 deletion src/query/storages/fuse/src/operations/recluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl FuseTable {
};

ctx.try_set_partitions(plan.parts.clone())?;
self.do_read2(ctx.clone(), &plan, pipeline)?;
self.do_read_data(ctx.clone(), &plan, pipeline)?;

let cluster_stats_gen = self.get_cluster_stats_gen(
ctx.clone(),
Expand Down

1 comment on commit 1a8cd3d

@vercel
Copy link

@vercel vercel bot commented on 1a8cd3d Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend.rs
databend-git-main-databend.vercel.app
databend.vercel.app
databend-databend.vercel.app

Please sign in to comment.