diff --git a/be/src/common/config.h b/be/src/common/config.h index dbc9887d08..b59d9d42e3 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -937,6 +937,9 @@ CONF_Int32(max_depth_of_expr_tree, "600"); // Report a tablet as bad when io errors occurs more than this value. CONF_mInt64(max_tablet_io_errors, "-1"); +// Page size of row column, default 4KB +CONF_mInt64(row_column_page_size, "4096"); + #ifdef BE_TEST // test s3 CONF_String(test_s3_resource, "resource"); diff --git a/be/src/olap/rowset/segment_v2/segment_writer.cpp b/be/src/olap/rowset/segment_v2/segment_writer.cpp index 71b2939f18..0789777cf3 100644 --- a/be/src/olap/rowset/segment_v2/segment_writer.cpp +++ b/be/src/olap/rowset/segment_v2/segment_writer.cpp @@ -17,6 +17,7 @@ #include "olap/rowset/segment_v2/segment_writer.h" +#include "common/config.h" #include "common/consts.h" #include "common/logging.h" // LOG #include "io/fs/file_writer.h" @@ -189,7 +190,7 @@ Status SegmentWriter::init(const std::vector& col_ids, bool has_key, if (column.is_row_store_column()) { // smaller page size for row store column - opts.data_page_size = 16 * 1024; + opts.data_page_size = config::row_column_page_size; } std::unique_ptr writer; diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index f70bc7f4c7..2bf536468f 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -2329,7 +2329,8 @@ TabletSchemaSPtr Tablet::get_max_version_schema(std::lock_guard(input_rowset); if (!rowset) { @@ -2366,7 +2367,6 @@ Status Tablet::lookup_row_data(const Slice& encoded_key, const RowLocation& row_ &column_iterator)); std::unique_ptr ptr_guard(column_iterator); segment_v2::ColumnIteratorOptions opt; - OlapReaderStatistics stats; opt.file_reader = segment->file_reader().get(); opt.stats = &stats; opt.use_page_cache = !config::disable_storage_page_cache; diff --git a/be/src/olap/tablet.h b/be/src/olap/tablet.h index 93c7e78192..faa5a5c8e0 100644 --- a/be/src/olap/tablet.h +++ b/be/src/olap/tablet.h @@ -382,7 +382,8 @@ public: // Lookup a row with TupleDescriptor and fill Block Status lookup_row_data(const Slice& encoded_key, const RowLocation& row_location, RowsetSharedPtr rowset, const TupleDescriptor* desc, - vectorized::Block* block, bool write_to_cache = false); + OlapReaderStatistics& stats, vectorized::Block* block, + bool write_to_cache = false); // calc delete bitmap when flush memtable, use a fake version to calc // For example, cur max version is 5, and we use version 6 to calc but diff --git a/be/src/service/point_query_executor.cpp b/be/src/service/point_query_executor.cpp index 1db2881007..f57547d003 100644 --- a/be/src/service/point_query_executor.cpp +++ b/be/src/service/point_query_executor.cpp @@ -183,6 +183,7 @@ std::string PointQueryExecutor::print_profile() { auto lookup_data_us = _profile_metrics.lookup_data_ns.value() / 1000; auto output_data_us = _profile_metrics.output_data_ns.value() / 1000; auto total_us = init_us + lookup_key_us + lookup_data_us + output_data_us; + auto read_stats = _profile_metrics.read_stats; return fmt::format( "" "[lookup profile:{}us] init:{}us, init_key:{}us," @@ -192,10 +193,15 @@ std::string PointQueryExecutor::print_profile() { "" "" ", is_binary_row:{}, output_columns:{}, total_keys:{}, row_cache_hits:{}" + ", hit_cached_pages:{}, total_pages_read:{}, compressed_bytes_read:{}, " + "io_latency:{}ns, " + "uncompressed_bytes_read:{}" "", total_us, init_us, init_key_us, lookup_key_us, lookup_data_us, output_data_us, _hit_lookup_cache, _binary_row_format, _reusable->output_exprs().size(), - _row_read_ctxs.size(), _row_cache_hits); + _row_read_ctxs.size(), _row_cache_hits, read_stats.cached_pages_num, + read_stats.total_pages_num, read_stats.compressed_bytes_read, read_stats.io_ns, + read_stats.uncompressed_bytes_read); } Status PointQueryExecutor::_init_keys(const PTabletKeyLookupRequest* request) { @@ -271,7 +277,8 @@ Status PointQueryExecutor::_lookup_row_data() { } RETURN_IF_ERROR(_tablet->lookup_row_data( _row_read_ctxs[i]._primary_key, _row_read_ctxs[i]._row_location.value(), - *(_row_read_ctxs[i]._rowset_ptr), _reusable->tuple_desc(), _result_block.get(), + *(_row_read_ctxs[i]._rowset_ptr), _reusable->tuple_desc(), + _profile_metrics.read_stats, _result_block.get(), !config::disable_storage_row_cache /*whether write row cache*/)); } return Status::OK(); diff --git a/be/src/service/point_query_executor.h b/be/src/service/point_query_executor.h index 9dd5a36822..3f4a0426a1 100644 --- a/be/src/service/point_query_executor.h +++ b/be/src/service/point_query_executor.h @@ -23,6 +23,7 @@ #include "common/status.h" #include "gen_cpp/internal_service.pb.h" #include "gutil/int128.h" +#include "olap/olap_common.h" #include "olap/rowset/rowset.h" #include "olap/tablet.h" #include "util/runtime_profile.h" @@ -234,6 +235,7 @@ struct Metrics { RuntimeProfile::Counter lookup_key_ns; RuntimeProfile::Counter lookup_data_ns; RuntimeProfile::Counter output_data_ns; + OlapReaderStatistics read_stats; }; // An util to do tablet lookup