yiguolei commented on a change in pull request #1576: Change cumulative compaction for decoupling storage from compution URL: https://github.com/apache/incubator-doris/pull/1576#discussion_r310427251
########## File path: be/src/olap/base_compaction.cpp ########## @@ -40,487 +39,264 @@ using std::vector; namespace doris { -OLAPStatus BaseCompaction::init(TabletSharedPtr tablet, bool is_manual_trigger) { - // 表在首次查询或PUSH等操作时,会被加载到内存 - // 如果表没有被加载,表明该表上目前没有任何操作,所以不进行BE操作 - if (!tablet->init_succeeded()) { - return OLAP_ERR_INPUT_PARAMETER_ERROR; - } - - LOG(INFO) << "init base compaction handler. [tablet=" << tablet->full_name() << "]"; +static bool rowset_comparator(const RowsetSharedPtr& left, const RowsetSharedPtr& right) { + return left->end_version() < right->end_version(); +} - _tablet = tablet; +BaseCompaction::BaseCompaction(TabletSharedPtr tablet) + : _tablet(tablet), + _base_locked(false), + _input_rowsets_size(0), + _input_row_num(0) + { } - // 1. 尝试取得base compaction的锁 - if (!_try_base_compaction_lock()) { - LOG(WARNING) << "another base compaction is running. tablet=" << tablet->full_name(); - return OLAP_ERR_BE_TRY_BE_LOCK_ERROR; +BaseCompaction::~BaseCompaction() { + if (_base_locked) { + _tablet->release_base_compaction_lock(); Review comment: It's too trick to add a variable _base_locked to indicate whether base compaction lock is owned. It's better to add a scoped mutex like migration lock. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org For additional commands, e-mail: dev-h...@doris.apache.org