This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new f2a37d58fb8 [fix](stat) handle overflow of memory stat if load failed (#39621) (#39887) f2a37d58fb8 is described below commit f2a37d58fb86ef09165ac8d34535926c47517cb3 Author: Yongqiang YANG <98214048+dataroar...@users.noreply.github.com> AuthorDate: Sun Aug 25 18:24:08 2024 +0800 [fix](stat) handle overflow of memory stat if load failed (#39621) (#39887) ## Proposed changes pick #39621 Issue Number: close #xxx <!--Describe your changes.--> --- be/src/olap/rowset/segment_v2/ordinal_page_index.cpp | 16 ++++++++++------ be/src/olap/rowset/segment_v2/zone_map_index.cpp | 12 +++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/be/src/olap/rowset/segment_v2/ordinal_page_index.cpp b/be/src/olap/rowset/segment_v2/ordinal_page_index.cpp index b93d461d8c7..24b2e337996 100644 --- a/be/src/olap/rowset/segment_v2/ordinal_page_index.cpp +++ b/be/src/olap/rowset/segment_v2/ordinal_page_index.cpp @@ -115,6 +115,11 @@ Status OrdinalIndexReader::_load(bool use_page_cache, bool kept_in_memory, _num_pages = reader.count(); _ordinals.resize(_num_pages + 1); _pages.resize(_num_pages); + + g_ordinal_index_memory_bytes << sizeof(*this) + _ordinals.size() * sizeof(ordinal_t) + + _pages.size() * sizeof(PagePointer) + + sizeof(OrdinalIndexReader); + for (int i = 0; i < _num_pages; i++) { Slice key = reader.get_key(i); ordinal_t ordinal = 0; @@ -127,9 +132,6 @@ Status OrdinalIndexReader::_load(bool use_page_cache, bool kept_in_memory, } _ordinals[_num_pages] = _num_values; - g_ordinal_index_memory_bytes << sizeof(*this) + _ordinals.size() * sizeof(ordinal_t) + - _pages.size() * sizeof(PagePointer) + - sizeof(OrdinalIndexReader); return Status::OK(); } @@ -155,9 +157,11 @@ OrdinalPageIndexIterator OrdinalIndexReader::seek_at_or_before(ordinal_t ordinal } OrdinalIndexReader::~OrdinalIndexReader() { - g_ordinal_index_memory_bytes << -sizeof(*this) - _ordinals.size() * sizeof(ordinal_t) - - _pages.size() * sizeof(PagePointer) - - sizeof(OrdinalIndexReader); + if (_ordinals.size() > 0) { + g_ordinal_index_memory_bytes << -sizeof(*this) - _ordinals.size() * sizeof(ordinal_t) - + _pages.size() * sizeof(PagePointer) - + sizeof(OrdinalIndexReader); + } } } // namespace segment_v2 diff --git a/be/src/olap/rowset/segment_v2/zone_map_index.cpp b/be/src/olap/rowset/segment_v2/zone_map_index.cpp index 6a1dee39cd7..991df2f9475 100644 --- a/be/src/olap/rowset/segment_v2/zone_map_index.cpp +++ b/be/src/olap/rowset/segment_v2/zone_map_index.cpp @@ -157,6 +157,9 @@ Status ZoneMapIndexReader::_load(bool use_page_cache, bool kept_in_memory, _page_zone_maps.resize(reader.num_values()); + g_zone_map_memory_bytes << sizeof(*this) + sizeof(ZoneMapPB) * _page_zone_maps.size() + + sizeof(IndexedColumnMetaPB); + // read and cache all page zone maps for (int i = 0; i < reader.num_values(); ++i) { size_t num_to_read = 1; @@ -176,16 +179,15 @@ Status ZoneMapIndexReader::_load(bool use_page_cache, bool kept_in_memory, } } - g_zone_map_memory_bytes << sizeof(*this) + sizeof(ZoneMapPB) * _page_zone_maps.size() + - sizeof(IndexedColumnMetaPB); - return Status::OK(); } ZoneMapIndexReader::~ZoneMapIndexReader() { // Maybe wrong due to load failures. - g_zone_map_memory_bytes << -sizeof(*this) - sizeof(ZoneMapPB) * _page_zone_maps.size() - - sizeof(IndexedColumnMetaPB); + if (_page_zone_maps.size() > 0) { + g_zone_map_memory_bytes << -sizeof(*this) - sizeof(ZoneMapPB) * _page_zone_maps.size() - + sizeof(IndexedColumnMetaPB); + } } #define APPLY_FOR_PRIMITITYPE(M) \ M(TYPE_TINYINT) \ --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org