This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 09d41c3479 [fix](log) clarify error msg for tablet writer write 
failure (#14078) (#16954) (#16950)
09d41c3479 is described below

commit 09d41c34791e0caad896772a15970d4e95d3f6d6
Author: zhengyu <freeman.zhang1...@gmail.com>
AuthorDate: Tue Feb 21 19:42:49 2023 +0800

    [fix](log) clarify error msg for tablet writer write failure (#14078) 
(#16954) (#16950)
    
    fmt::format dosen't support non-template object as args, even if it 
implements
    `to_string()` or `operator<<`. so orignal code may cause `false` to be 
printed
    instead of real cause of the failure. So to_string() need to be manually 
invoked.
    
    Signed-off-by: freemandealer <freeman.zhang1...@gmail.com>
---
 be/src/runtime/tablets_channel.cpp | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/be/src/runtime/tablets_channel.cpp 
b/be/src/runtime/tablets_channel.cpp
index 146137c026..c692ca03d8 100644
--- a/be/src/runtime/tablets_channel.cpp
+++ b/be/src/runtime/tablets_channel.cpp
@@ -111,8 +111,11 @@ Status TabletsChannel::close(
             if (_partition_ids.count(it.second->partition_id()) > 0) {
                 auto st = it.second->close();
                 if (!st.ok()) {
-                    LOG(WARNING) << "close tablet writer failed, tablet_id=" 
<< it.first
-                                 << ", transaction_id=" << _txn_id << ", err=" 
<< st;
+                    auto err_msg = fmt::format(
+                            "close tablet writer failed, tablet_id={}, "
+                            "transaction_id={}, err={}",
+                            it.first, _txn_id, st.to_string());
+                    LOG(WARNING) << err_msg;
                     PTabletError* tablet_error = tablet_errors->Add();
                     tablet_error->set_tablet_id(it.first);
                     tablet_error->set_msg(st.to_string());
@@ -247,12 +250,12 @@ Status TabletsChannel::_open_all_writers(const 
PTabletWriterOpenRequest& request
         DeltaWriter* writer = nullptr;
         auto st = DeltaWriter::open(&wrequest, &writer, _load_id);
         if (!st.ok()) {
-            std::stringstream ss;
-            ss << "open delta writer failed, tablet_id=" << tablet.tablet_id()
-               << ", txn_id=" << _txn_id << ", partition_id=" << 
tablet.partition_id()
-               << ", err=" << st;
-            LOG(WARNING) << ss.str();
-            return Status::InternalError(ss.str());
+            auto err_msg = fmt::format(
+                    "open delta writer failed, tablet_id={}"
+                    ", txn_id={}, partition_id={}, err={}",
+                    tablet.tablet_id(), _txn_id, tablet.partition_id(), 
st.to_string());
+            LOG(WARNING) << err_msg;
+            return Status::InternalError(err_msg);
         }
         {
             std::lock_guard<SpinLock> l(_tablet_writers_lock);
@@ -338,7 +341,7 @@ Status TabletsChannel::add_batch(const 
TabletWriterAddRequest& request,
         if (!st.ok()) {
             auto err_msg =
                     fmt::format("tablet writer write failed, tablet_id={}, 
txn_id={}, err={}",
-                                tablet_to_rowidxs_it.first, _txn_id, st);
+                                tablet_to_rowidxs_it.first, _txn_id, 
st.to_string());
             LOG(WARNING) << err_msg;
             PTabletError* error = tablet_errors->Add();
             error->set_tablet_id(tablet_to_rowidxs_it.first);
@@ -381,7 +384,7 @@ void TabletsChannel::flush_memtable_async(int64_t 
tablet_id) {
         auto err_msg = fmt::format(
                 "tablet writer failed to reduce mem consumption by flushing 
memtable, "
                 "tablet_id={}, txn_id={}, err={}",
-                tablet_id, _txn_id, st);
+                tablet_id, _txn_id, st.to_string());
         LOG(WARNING) << err_msg;
         iter->second->cancel_with_status(st);
         _broken_tablets.insert(iter->second->tablet_id());
@@ -409,7 +412,7 @@ void TabletsChannel::wait_flush(int64_t tablet_id) {
         auto err_msg = fmt::format(
                 "tablet writer failed to reduce mem consumption by flushing 
memtable, "
                 "tablet_id={}, txn_id={}, err={}",
-                tablet_id, _txn_id, st);
+                tablet_id, _txn_id, st.to_string());
         LOG(WARNING) << err_msg;
         iter->second->cancel_with_status(st);
         _broken_tablets.insert(iter->second->tablet_id());


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

Reply via email to