gavinchou commented on code in PR #45206:
URL: https://github.com/apache/doris/pull/45206#discussion_r1881978664
##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -2193,6 +2169,73 @@ void
MetaServiceImpl::get_delete_bitmap_update_lock(google::protobuf::RpcControl
msg = ss.str();
return;
}
+
+ bool require_tablet_stats =
+ request->has_require_compaction_stats() ?
request->require_compaction_stats() : false;
+ if (require_tablet_stats) {
+ // this request is from fe when it commits txn for MOW table, we send
the compaction stats
+ // along with the GetDeleteBitmapUpdateLockResponse which will be sent
to BE later to let
+ // BE eliminate unnecessary sync_rowsets() calls if possible
+
+ // 1. hold the delete bitmap update lock in MS(update
lock_info.lock_id to current load's txn id)
+ // 2. read tablets' stats
+ // 3. check whether we still hold the delete bitmap update lock
+ // these steps can be done in different fdb txns
+
+ err = txn_kv_->create_txn(&txn);
+ if (err != TxnErrorCode::TXN_OK) {
+ code = cast_as<ErrCategory::CREATE>(err);
+ msg = "failed to init txn";
+ return;
+ }
+
+ int64_t total_retry = 0;
+ for (const auto& tablet_index : request->tablet_indexes()) {
+ TabletIndexPB idx(tablet_index);
+ TabletStatsPB tablet_stat;
+ int64_t retry = 0;
+ internal_get_tablet_stats(code, msg, txn.get(), instance_id, idx,
tablet_stat, false);
+ while (retry < 3 && total_retry < 20 && code ==
MetaServiceCode::KV_TXN_TOO_OLD) {
+ retry++;
+ total_retry++;
+
+ code = MetaServiceCode::OK;
+ err = txn_kv_->create_txn(&txn);
+ if (err != TxnErrorCode::TXN_OK) {
+ code = cast_as<ErrCategory::CREATE>(err);
+ ss << "failed to init txn when get tablet stats, retry="
<< retry;
+ msg = ss.str();
+ return;
+ }
+ internal_get_tablet_stats(code, msg, txn.get(), instance_id,
idx, tablet_stat,
+ false);
+ LOG(INFO) << "retry get tablet stats, instance_id=" <<
instance_id
+ << ", tablet=" << idx.tablet_id() << ", retry=" <<
retry
+ << ", total_retry=" << total_retry;
+ }
+ if (code != MetaServiceCode::OK) {
+ response->clear_base_compaction_cnts();
Review Comment:
is it necessary?
--
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]