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

panxiaolei 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 1188d88a108 [Chore](status) catch some error status on storage (#27132)
1188d88a108 is described below

commit 1188d88a1082160bf7ba5a5ea74de004ca9eaf3a
Author: Pxl <[email protected]>
AuthorDate: Fri Nov 17 12:00:39 2023 +0800

    [Chore](status) catch some error status on storage (#27132)
    
    catch some error status on storage
---
 be/src/olap/reader.cpp                                     | 12 ++++--------
 be/src/olap/rowset/beta_rowset.cpp                         |  4 ++--
 be/src/olap/rowset/rowset_meta_manager.cpp                 |  4 ++--
 be/src/olap/rowset/segcompaction.cpp                       |  2 +-
 be/src/olap/rowset/segment_creator.cpp                     |  2 +-
 .../olap/rowset/segment_v2/bloom_filter_index_reader.cpp   |  2 +-
 be/src/olap/storage_engine.cpp                             |  6 +++---
 be/src/olap/tablet.cpp                                     |  2 +-
 be/src/olap/tablet_manager.cpp                             | 14 +++++++-------
 9 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/be/src/olap/reader.cpp b/be/src/olap/reader.cpp
index dfc99e58ce1..90fda737998 100644
--- a/be/src/olap/reader.cpp
+++ b/be/src/olap/reader.cpp
@@ -510,12 +510,8 @@ Status TabletReader::_init_conditions_param(const 
ReaderParams& read_params) {
 
     // Function filter push down to storage engine
     auto is_like_predicate = [](ColumnPredicate* _pred) {
-        if (dynamic_cast<LikeColumnPredicate<TYPE_CHAR>*>(_pred) != nullptr ||
-            dynamic_cast<LikeColumnPredicate<TYPE_STRING>*>(_pred) != nullptr) 
{
-            return true;
-        }
-
-        return false;
+        return dynamic_cast<LikeColumnPredicate<TYPE_CHAR>*>(_pred) != nullptr 
||
+               dynamic_cast<LikeColumnPredicate<TYPE_STRING>*>(_pred) != 
nullptr;
     };
 
     for (const auto& filter : read_params.function_filters) {
@@ -531,8 +527,8 @@ Status TabletReader::_init_conditions_param(const 
ReaderParams& read_params) {
             auto gram_bf_size = tablet_index->get_gram_bf_size();
             auto gram_size = tablet_index->get_gram_size();
 
-            
static_cast<void>(segment_v2::BloomFilter::create(segment_v2::NGRAM_BLOOM_FILTER,
-                                                              &ng_bf, 
gram_bf_size));
+            
RETURN_IF_ERROR(segment_v2::BloomFilter::create(segment_v2::NGRAM_BLOOM_FILTER, 
&ng_bf,
+                                                            gram_bf_size));
             NgramTokenExtractor _token_extractor(gram_size);
 
             if (_token_extractor.string_like_to_bloom_filter(pattern.data(), 
pattern.length(),
diff --git a/be/src/olap/rowset/beta_rowset.cpp 
b/be/src/olap/rowset/beta_rowset.cpp
index b332d0e212d..5bc4a16e8b8 100644
--- a/be/src/olap/rowset/beta_rowset.cpp
+++ b/be/src/olap/rowset/beta_rowset.cpp
@@ -180,7 +180,7 @@ Status BetaRowset::remove() {
                     LOG(WARNING) << st.to_string();
                     success = false;
                 } else {
-                    
static_cast<void>(segment_v2::InvertedIndexSearcherCache::instance()->erase(
+                    
RETURN_IF_ERROR(segment_v2::InvertedIndexSearcherCache::instance()->erase(
                             inverted_index_file));
                 }
             }
@@ -238,7 +238,7 @@ Status BetaRowset::link_files_to(const std::string& dir, 
RowsetId new_rowset_id,
                     InvertedIndexDescriptor::get_index_file_name(dst_path, 
index_id);
             bool need_to_link = true;
             if (_schema->skip_write_index_on_load()) {
-                
static_cast<void>(local_fs->exists(inverted_index_src_file_path, 
&need_to_link));
+                RETURN_IF_ERROR(local_fs->exists(inverted_index_src_file_path, 
&need_to_link));
                 if (!need_to_link) {
                     LOG(INFO) << "skip create hard link to not existed file="
                               << inverted_index_src_file_path;
diff --git a/be/src/olap/rowset/rowset_meta_manager.cpp 
b/be/src/olap/rowset/rowset_meta_manager.cpp
index ab938687690..26876ea7197 100644
--- a/be/src/olap/rowset/rowset_meta_manager.cpp
+++ b/be/src/olap/rowset/rowset_meta_manager.cpp
@@ -444,7 +444,7 @@ Status RowsetMetaManager::traverse_rowset_metas(
                                              const std::string& value) -> bool 
{
         std::vector<std::string> parts;
         // key format: rst_uuid_rowset_id
-        static_cast<void>(split_string<char>(key, '_', &parts));
+        RETURN_IF_ERROR(split_string<char>(key, '_', &parts));
         if (parts.size() != 3) {
             LOG(WARNING) << "invalid rowset key:" << key << ", splitted size:" 
<< parts.size();
             return true;
@@ -452,7 +452,7 @@ Status RowsetMetaManager::traverse_rowset_metas(
         RowsetId rowset_id;
         rowset_id.init(parts[2]);
         std::vector<std::string> uid_parts;
-        static_cast<void>(split_string<char>(parts[1], '-', &uid_parts));
+        RETURN_IF_ERROR(split_string<char>(parts[1], '-', &uid_parts));
         TabletUid tablet_uid(uid_parts[0], uid_parts[1]);
         return func(tablet_uid, rowset_id, value);
     };
diff --git a/be/src/olap/rowset/segcompaction.cpp 
b/be/src/olap/rowset/segcompaction.cpp
index 21bfcf0da82..e3eeeb0201b 100644
--- a/be/src/olap/rowset/segcompaction.cpp
+++ b/be/src/olap/rowset/segcompaction.cpp
@@ -144,7 +144,7 @@ Status 
SegcompactionWorker::_delete_original_segments(uint32_t begin, uint32_t e
                         fs->delete_file(idx_path),
                         strings::Substitute("Failed to delete file=$0", 
idx_path));
                 // Erase the origin index file cache
-                
static_cast<void>(InvertedIndexSearcherCache::instance()->erase(idx_path));
+                
RETURN_IF_ERROR(InvertedIndexSearcherCache::instance()->erase(idx_path));
             }
         }
     }
diff --git a/be/src/olap/rowset/segment_creator.cpp 
b/be/src/olap/rowset/segment_creator.cpp
index 5eabc2cc237..043fcff876a 100644
--- a/be/src/olap/rowset/segment_creator.cpp
+++ b/be/src/olap/rowset/segment_creator.cpp
@@ -265,7 +265,7 @@ int64_t SegmentFlusher::Writer::max_row_to_add(size_t 
row_avg_size_in_bytes) {
 }
 
 Status SegmentCreator::init(const RowsetWriterContext& rowset_writer_context) {
-    static_cast<void>(_segment_flusher.init(rowset_writer_context));
+    RETURN_IF_ERROR(_segment_flusher.init(rowset_writer_context));
     return Status::OK();
 }
 
diff --git a/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp 
b/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp
index 297762362bb..c9b74c034ee 100644
--- a/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/bloom_filter_index_reader.cpp
@@ -63,7 +63,7 @@ Status BloomFilterIndexIterator::read_bloom_filter(rowid_t 
ordinal,
     DCHECK(num_to_read == num_read);
     // construct bloom filter
     StringRef value = column->get_data_at(0);
-    static_cast<void>(
+    RETURN_IF_ERROR(
             
BloomFilter::create(_reader->_bloom_filter_index_meta->algorithm(), bf, 
value.size));
     RETURN_IF_ERROR((*bf)->init(value.data, value.size,
                                 
_reader->_bloom_filter_index_meta->hash_strategy()));
diff --git a/be/src/olap/storage_engine.cpp b/be/src/olap/storage_engine.cpp
index d714420b358..1e01dbf2ad7 100644
--- a/be/src/olap/storage_engine.cpp
+++ b/be/src/olap/storage_engine.cpp
@@ -330,7 +330,7 @@ Status 
StorageEngine::get_all_data_dir_info(std::vector<DataDirInfo>* data_dir_i
         std::lock_guard<std::mutex> l(_store_lock);
         for (auto& it : _store_map) {
             if (need_update) {
-                static_cast<void>(it.second->update_capacity());
+                RETURN_IF_ERROR(it.second->update_capacity());
             }
             path_map.emplace(it.first, it.second->get_dir_info());
         }
@@ -426,7 +426,7 @@ Status StorageEngine::_check_all_root_path_cluster_id() {
 
     // write cluster id into cluster_id_path if get effective cluster id 
success
     if (_effective_cluster_id != -1 && !_is_all_cluster_id_exist) {
-        static_cast<void>(set_cluster_id(_effective_cluster_id));
+        RETURN_IF_ERROR(set_cluster_id(_effective_cluster_id));
     }
 
     return Status::OK();
@@ -768,7 +768,7 @@ Status StorageEngine::start_trash_sweep(double* usage, bool 
ignore_guard) {
     }
 
     // clear expire incremental rowset, move deleted tablet to trash
-    static_cast<void>(_tablet_manager->start_trash_sweep());
+    RETURN_IF_ERROR(_tablet_manager->start_trash_sweep());
 
     // clean rubbish transactions
     _clean_unused_txns();
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index cfd71abff14..aed65ee231f 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -2646,7 +2646,7 @@ Status Tablet::_get_segment_column_iterator(
             .stats = stats,
             .io_ctx = io::IOContext {.reader_type = ReaderType::READER_QUERY},
     };
-    static_cast<void>((*column_iterator)->init(opt));
+    RETURN_IF_ERROR((*column_iterator)->init(opt));
     return Status::OK();
 }
 
diff --git a/be/src/olap/tablet_manager.cpp b/be/src/olap/tablet_manager.cpp
index a49deea3606..fe4da023735 100644
--- a/be/src/olap/tablet_manager.cpp
+++ b/be/src/olap/tablet_manager.cpp
@@ -173,14 +173,14 @@ Status TabletManager::_add_tablet_unlocked(TTabletId 
tablet_id, const TabletShar
     // During restore process, snapshot loader
     // replaced the old tablet's rowset with new rowsets, but the tablet path 
is reused, if drop files
     // here, the new rowset's file will also be dropped, so use keep files here
-    bool keep_files = force ? true : false;
+    bool keep_files = force;
     if (force ||
         (new_version > old_version || (new_version == old_version && new_time 
>= old_time))) {
         // check if new tablet's meta is in store and add new tablet's meta to 
meta store
         res = _add_tablet_to_map_unlocked(tablet_id, tablet, update_meta, 
keep_files,
                                           true /*drop_old*/, profile);
     } else {
-        static_cast<void>(tablet->set_tablet_state(TABLET_SHUTDOWN));
+        RETURN_IF_ERROR(tablet->set_tablet_state(TABLET_SHUTDOWN));
         tablet->save_meta();
         COUNTER_UPDATE(ADD_CHILD_TIMER(profile, "SaveMeta", "AddTablet"),
                        static_cast<int64_t>(watch.reset()));
@@ -562,7 +562,7 @@ Status TabletManager::_drop_tablet_unlocked(TTabletId 
tablet_id, TReplicaId repl
         // If update meta directly here, other thread may override the meta
         // and the tablet will be loaded at restart time.
         // To avoid this exception, we first set the state of the tablet to 
`SHUTDOWN`.
-        static_cast<void>(to_drop_tablet->set_tablet_state(TABLET_SHUTDOWN));
+        RETURN_IF_ERROR(to_drop_tablet->set_tablet_state(TABLET_SHUTDOWN));
         // We must record unused remote rowsets path info to OlapMeta before 
tablet state is marked as TABLET_SHUTDOWN in OlapMeta,
         // otherwise if BE shutdown after saving tablet state, these remote 
rowsets path info will lost.
         if (is_drop_table_or_partition) {
@@ -967,7 +967,7 @@ Status TabletManager::load_tablet_from_dir(DataDir* store, 
TTabletId tablet_id,
     // should change tablet uid when tablet object changed
     tablet_meta->set_tablet_uid(std::move(tablet_uid));
     std::string meta_binary;
-    static_cast<void>(tablet_meta->serialize(&meta_binary));
+    RETURN_IF_ERROR(tablet_meta->serialize(&meta_binary));
     RETURN_NOT_OK_STATUS_WITH_WARN(
             load_tablet_from_meta(store, tablet_id, schema_hash, meta_binary, 
true, force, restore,
                                   true),
@@ -1094,7 +1094,7 @@ Status TabletManager::start_trash_sweep() {
                 if (exists) {
                     // take snapshot of tablet meta
                     auto meta_file_path = fmt::format("{}/{}.hdr", 
tablet_path, (*it)->tablet_id());
-                    
static_cast<void>((*it)->tablet_meta()->save(meta_file_path));
+                    
RETURN_IF_ERROR((*it)->tablet_meta()->save(meta_file_path));
                     LOG(INFO) << "start to move tablet to trash. " << 
tablet_path;
                     Status rm_st = 
(*it)->data_dir()->move_to_trash(tablet_path);
                     if (!rm_st.ok()) {
@@ -1104,8 +1104,8 @@ Status TabletManager::start_trash_sweep() {
                     }
                 }
                 // remove tablet meta
-                static_cast<void>(TabletMetaManager::remove((*it)->data_dir(), 
(*it)->tablet_id(),
-                                                            
(*it)->schema_hash()));
+                RETURN_IF_ERROR(TabletMetaManager::remove((*it)->data_dir(), 
(*it)->tablet_id(),
+                                                          
(*it)->schema_hash()));
                 LOG(INFO) << "successfully move tablet to trash. "
                           << "tablet_id=" << (*it)->tablet_id()
                           << ", schema_hash=" << (*it)->schema_hash()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to