imay commented on a change in pull request #2691: add rowset state
URL: https://github.com/apache/incubator-doris/pull/2691#discussion_r364267503
##########
File path: be/src/olap/rowset/rowset.cpp
##########
@@ -36,7 +37,34 @@ Rowset::Rowset(const TabletSchema *schema,
}
OLAPStatus Rowset::load(bool use_cache) {
- return _load_once.call([this, use_cache] { return do_load_once(use_cache);
});
+ // if the state is ROWSET_UNLOADING it means close() is called
+ // and the rowset is already loaded, and the resource is not closed yet.
+ if (_rowset_state_machine.rowset_state() != ROWSET_UNLOADED) {
+ return OLAP_SUCCESS;
+ }
+ std::string load_log = "";
+ {
+ MutexLock load_lock(&_load_lock);
+ if (_rowset_state_machine.rowset_state() != ROWSET_UNLOADED) {
+ return OLAP_SUCCESS;
+ }
+ RETURN_NOT_OK(_rowset_state_machine.on_load());
+ RETURN_NOT_OK(do_load(use_cache));
+ std::stringstream ss;
+ ss << "rowset is loaded. rowset version:" << start_version() << "-" <<
end_version()
+ << ", state from ROWSET_UNLOADED to ROWSET_LOADED. tabletid:"
+ << _rowset_meta->tablet_id();
+ load_log = ss.str();
+ }
+ if (load_log != "") {
+ LOG(INFO) << load_log;
+ }
+ return OLAP_SUCCESS;
+}
+
+OLAPStatus Rowset::create_reader(std::shared_ptr<RowsetReader>* result) {
+ std::lock_guard<SpinLock> l(_lock);
Review comment:
Is this lock needed?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]