Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions be/src/olap/rowset/segment_v2/column_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,12 @@ Status ColumnReader::new_inverted_index_iterator(
std::shared_ptr<InvertedIndexFileReader> index_file_reader, const TabletIndex* index_meta,
const StorageReadOptions& read_options, std::unique_ptr<InvertedIndexIterator>* iterator) {
RETURN_IF_ERROR(_ensure_inverted_index_loaded(std::move(index_file_reader), index_meta));
if (_inverted_index) {
RETURN_IF_ERROR(_inverted_index->new_iterator(read_options.stats,
read_options.runtime_state, iterator));
{
std::shared_lock<std::shared_mutex> rlock(_load_index_lock);
if (_inverted_index) {
RETURN_IF_ERROR(_inverted_index->new_iterator(read_options.stats,
read_options.runtime_state, iterator));
}
}
return Status::OK();
}
Expand Down Expand Up @@ -537,7 +540,7 @@ Status ColumnReader::_load_bitmap_index(bool use_page_cache, bool kept_in_memory

Status ColumnReader::_load_inverted_index_index(
std::shared_ptr<InvertedIndexFileReader> index_file_reader, const TabletIndex* index_meta) {
std::lock_guard<std::mutex> wlock(_load_index_lock);
std::unique_lock<std::shared_mutex> wlock(_load_index_lock);

if (_inverted_index && index_meta &&
_inverted_index->get_index_id() == index_meta->index_id()) {
Expand Down
2 changes: 1 addition & 1 deletion be/src/olap/rowset/segment_v2/column_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class ColumnReader {
// meta for various column indexes (null if the index is absent)
std::unique_ptr<ZoneMapPB> _segment_zone_map;

mutable std::mutex _load_index_lock;
mutable std::shared_mutex _load_index_lock;
std::unique_ptr<ZoneMapIndexReader> _zone_map_index;
std::unique_ptr<OrdinalIndexReader> _ordinal_index;
std::unique_ptr<BitmapIndexReader> _bitmap_index;
Expand Down