Load Rowset only once in a thread-safe manner (#2022)

[Storage]
This PR implements thread-safe `Rowset::load()` for both AlphaRowset and BetaRowset. The main changes are 

1. Introduce `DorisCallOnce<ReturnType>` to be the replacement for `DorisInitOnce` . It works for both Status and OLAPStatus.
2. `segment_v2::ColumnReader::init()` is now implemented by DorisCallOnce.
3. `segment_v2::Segment` is now created by a factory open() method. This guarantees all Segment instances are in opened state.
4. `segment_v2::Segment::_load_index()` is now implemented by DorisCallOnce.
5. Implement thread-safe load() for AlphaRowset and BetaRowset
This commit is contained in:
Dayue Gao
2019-10-21 16:05:12 +08:00
committed by ZHAO Chun
parent 58c882fa2a
commit 8aa2cbe12d
14 changed files with 147 additions and 126 deletions

View File

@ -125,7 +125,7 @@ OLAPStatus Tablet::_init_once_action() {
}
OLAPStatus Tablet::init() {
return _init_once.init([this] { return _init_once_action(); });
return _init_once.call([this] { return _init_once_action(); });
}
bool Tablet::is_used() {