yiguolei commented on code in PR #41429: URL: https://github.com/apache/doris/pull/41429#discussion_r1794993760
########## be/src/olap/metadata_adder.h: ########## @@ -0,0 +1,144 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#pragma once + +#include <bvar/bvar.h> +#include <stdint.h> + +namespace doris { + +inline bvar::Adder<int64_t> g_total_rowset_meta_mem_size("doris_total_rowset_meta_mem_size"); +inline bvar::Adder<int64_t> g_total_rowset_meta_num("doris_total_rowset_meta_num"); + +inline bvar::Adder<int64_t> g_total_tablet_meta_mem_size("doris_total_tablet_meta_mem_size"); +inline bvar::Adder<int64_t> g_total_tablet_meta_num("doris_total_tablet_meta_num"); + +inline bvar::Adder<int64_t> g_total_tablet_column_mem_size("doris_total_tablet_column_mem_size"); +inline bvar::Adder<int64_t> g_total_tablet_column_num("doris_total_tablet_column_num"); + +inline bvar::Adder<int64_t> g_total_tablet_index_mem_size("doris_total_tablet_index_mem_size"); +inline bvar::Adder<int64_t> g_total_tablet_index_num("doris_total_tablet_index_num"); + +inline bvar::Adder<int64_t> g_total_tablet_schema_mem_size("doris_total_tablet_schema_mem_size"); +inline bvar::Adder<int64_t> g_total_tablet_schema_num("doris_total_tablet_schema_num"); + +inline bvar::Adder<int64_t> g_total_segment_mem_size("doris_total_segment_mem_size"); +inline bvar::Adder<int64_t> g_total_segment_num("doris_total_segment_num"); + +class RowsetMeta; +class TabletMeta; +class TabletColumn; +class TabletIndex; +class TabletSchema; + +namespace segment_v2 { +class Segment; +}; + +template <typename T> +class MetadataAdder { +private: + int64_t _current_meta_size {0}; + + void add_mem_size(int64_t val); + + void add_num(int64_t val); + +protected: + virtual ~MetadataAdder(); + + virtual int64_t get_metadata_size() = 0; + + MetadataAdder(const MetadataAdder& other); + +public: + MetadataAdder(); + + void update_metadata_size(); +}; + +template <typename T> +MetadataAdder<T>::MetadataAdder(const MetadataAdder<T>& other) { Review Comment: 需要重写 operator = , copy constructor -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org