github-actions[bot] commented on code in PR #16258:
URL: https://github.com/apache/doris/pull/16258#discussion_r1095448710


##########
be/src/olap/tablet.cpp:
##########
@@ -1650,12 +1658,94 @@ Status Tablet::cooldown() {
     return Status::OK();
 }
 
+bool Tablet::get_cooldown_delete_id(TUniqueId* cooldown_delete_id) {
+    std::unique_lock delete_lock(_cooldown_delete_lock, std::try_to_lock);
+    if (!delete_lock.owns_lock()) {
+        LOG(WARNING) << "Failed to own delete_lock. tablet=" << tablet_id();
+        return false;
+    }
+    if (!_cooldown_delete_flag && _cooldown_delete_files.size() > 0) {
+        *cooldown_delete_id = _cooldown_delete_id;
+        return true;
+    }
+    return false;
+}
+
+void Tablet::enable_cooldown_flag(const TUniqueId& cooldown_delete_id) {
+    std::unique_lock delete_lock(_cooldown_delete_lock, std::try_to_lock);
+    if (!delete_lock.owns_lock()) {
+        LOG(WARNING) << "Failed to own delete_lock. tablet=" << tablet_id();
+        return;
+    }
+    if (cooldown_delete_id == _cooldown_delete_id) {
+        _cooldown_delete_flag = true;
+    }
+}
+
+bool Tablet::need_deal_cooldown_delete() {
+    return _cooldown_delete_flag

Review Comment:
   warning: method 'need_deal_cooldown_delete' can be made const 
[readability-make-member-function-const]
   
   ```suggestion
   ::need_deal_cooldown_delete() const {
   ```
   
   be/src/olap/tablet.h:299:
   ```diff
   -     bool need_deal_cooldown_delete();
   +     bool need_deal_cooldown_delete() const;
   ```
   



##########
be/src/olap/tablet.cpp:
##########
@@ -1650,12 +1658,94 @@
     return Status::OK();
 }
 
+bool Tablet::get_cooldown_delete_id(TUniqueId* cooldown_delete_id) {
+    std::unique_lock delete_lock(_cooldown_delete_lock, std::try_to_lock);
+    if (!delete_lock.owns_lock()) {
+        LOG(WARNING) << "Failed to own delete_lock. tablet=" << tablet_id();
+        return false;
+    }
+    if (!_cooldown_delete_flag && _cooldown_delete_files.size() > 0) {
+        *cooldown_delete_id = _cooldown_delete_id;
+        return true;
+    }
+    return false;
+}
+
+void Tablet::enable_cooldown_flag(const TUniqueId& cooldown_delete_id) {
+    std::unique_lock delete_lock(_cooldown_delete_lock, std::try_to_lock);
+    if (!delete_lock.owns_lock()) {
+        LOG(WARNING) << "Failed to own delete_lock. tablet=" << tablet_id();
+        return;
+    }
+    if (cooldown_delete_id == _cooldown_delete_id) {
+        _cooldown_delete_flag = true;
+    }
+}
+
+bool Tablet::need_deal_cooldown_delete() {
+    return _cooldown_delete_flag
+            || time(NULL) - _last_cooldown_delete_time >= 
config::cooldown_delete_interval_time_sec;

Review Comment:
   warning: use nullptr [modernize-use-nullptr]
   
   ```suggestion
      return _cooldown_delete_flagnullptr
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to