platoneko commented on code in PR #16813:
URL: https://github.com/apache/doris/pull/16813#discussion_r1126766010


##########
be/src/olap/tablet.cpp:
##########
@@ -1772,11 +1796,31 @@ Status check_version_continuity(const 
std::vector<RowsetMetaSharedPtr>& rs_metas
     return Status::OK();
 }
 
-Status Tablet::write_cooldown_meta() {
+// It's guaranteed the write cooldown meta task would be invoked at the end 
unless BE crashes
+// one tablet would at most have one async task to be done
+void Tablet::async_write_cooldown_meta() {
+    WriteCooldownMetaExecutors::GetInstance()->submit(tablet_id(), [this]() {

Review Comment:
   Seems that it's not a good idea to provide a member function 
`Tablet::async_write_cooldown_meta`, just write a static function and copy 
tablet's shared ptr, call `tablet->write_cooldown_meta` in this function, and 
call it executor's `submit`:
   ```
   static void write_cooldown_meta(MPSC mpsc, TabletSPtr tablet) {
     // erase from queueing set
     auto st = tablet->write_cooldown_meta();
     if (st.ok()) return;
     // log error
     if (!st.is<ABORTED>())
       mpsc->submit(std::bind(write_cooldown_meta, mpsc, tablet));
   }
   
   void submit(const TabletSPtr& tablet) {
       // calculate which mpsc to push
       // insert to queueing set
       mpsc->submit(std::bind(write_cooldown_meta, mpsc, tablet));
   }
   ```



-- 
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]

Reply via email to