liaoxin01 commented on code in PR #39045:
URL: https://github.com/apache/doris/pull/39045#discussion_r1731187443
##########
be/src/olap/rowset/beta_rowset_writer.cpp:
##########
@@ -514,26 +514,27 @@ Status
BetaRowsetWriter::_rename_compacted_indices(int64_t begin, int64_t end, u
return Status::OK();
}
-// return true if there isn't any flying segcompaction, otherwise return false
-bool BetaRowsetWriter::_check_and_set_is_doing_segcompaction() {
- return !_is_doing_segcompaction.exchange(true);
-}
-
Status BetaRowsetWriter::_segcompaction_if_necessary() {
Status status = Status::OK();
- // leave _check_and_set_is_doing_segcompaction as the last condition
- // otherwise _segcompacting_cond will never get notified
+ // if not doing segcompaction, just check segment number
if (!config::enable_segcompaction || !_context.enable_segcompaction ||
!_context.tablet_schema->cluster_key_idxes().empty() ||
- _context.tablet_schema->num_variant_columns() > 0 ||
- !_check_and_set_is_doing_segcompaction()) {
+ _context.tablet_schema->num_variant_columns() > 0) {
+ return _check_segment_number_limit(_num_segment);
+ }
+ // leave _is_doing_segcompaction as the last condition
+ // otherwise _segcompacting_cond will never get notified
+ if (_is_doing_segcompaction.exchange(true)) {
return status;
}
if (_segcompaction_status.load() != OK) {
status = Status::Error<SEGCOMPACTION_FAILED>(
"BetaRowsetWriter::_segcompaction_if_necessary meet invalid
state, error code: {}",
_segcompaction_status.load());
- } else if ((_num_segment - _segcompacted_point) >=
config::segcompaction_batch_size) {
+ } else {
+ status = _check_segment_number_limit(_segcompacted_point);
Review Comment:
Why use _segcompacted_point instead of _num_segcompacted ?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]