diff --git a/be/src/agent/task_worker_pool.cpp b/be/src/agent/task_worker_pool.cpp index 98f81a70a15833..0ef2325d2f90aa 100644 --- a/be/src/agent/task_worker_pool.cpp +++ b/be/src/agent/task_worker_pool.cpp @@ -531,7 +531,7 @@ void TaskWorkerPool::_alter_tablet(const TAgentTaskRequest& agent_task_req, int6 EngineAlterTabletTask engine_task(agent_task_req.alter_tablet_req_v2); Status sc_status = _env->storage_engine()->execute_task(&engine_task); if (!sc_status.ok()) { - if (sc_status == Status::OLAPInternalError(OLAP_ERR_DATA_QUALITY_ERR)) { + if (sc_status.precise_code() == OLAP_ERR_DATA_QUALITY_ERR) { error_msgs.push_back("The data quality does not satisfy, please check your data. "); } status = Status::DataQualityError("The data quality does not satisfy"); @@ -1734,7 +1734,7 @@ void TaskWorkerPool::_storage_medium_migrate_v2(const TAgentTaskRequest& agent_t EngineStorageMigrationTaskV2 engine_task(agent_task_req.storage_migration_req_v2); Status sc_status = _env->storage_engine()->execute_task(&engine_task); if (!sc_status.ok()) { - if (sc_status == Status::OLAPInternalError(OLAP_ERR_DATA_QUALITY_ERR)) { + if (sc_status.precise_code() == OLAP_ERR_DATA_QUALITY_ERR) { error_msgs.push_back("The data quality does not satisfy, please check your data. "); } status = Status::DataQualityError("The data quality does not satisfy"); diff --git a/be/src/common/status.h b/be/src/common/status.h index 562c61e4800020..c58df454ef0475 100644 --- a/be/src/common/status.h +++ b/be/src/common/status.h @@ -394,7 +394,14 @@ class Status { bool is_end_of_file() const { return code() == TStatusCode::END_OF_FILE; } bool is_not_found() const { return code() == TStatusCode::NOT_FOUND; } bool is_already_exist() const { return code() == TStatusCode::ALREADY_EXIST; } - bool is_io_error() const { return code() == TStatusCode::IO_ERROR; } + bool is_io_error() const { + auto p_code = precise_code(); + return code() == TStatusCode::IO_ERROR || + ((OLAP_ERR_IO_ERROR == p_code || OLAP_ERR_READ_UNENOUGH == p_code) && + errno == EIO) || + OLAP_ERR_CHECKSUM_ERROR == p_code || OLAP_ERR_FILE_DATA_ERROR == p_code || + OLAP_ERR_TEST_FILE_ERROR == p_code || OLAP_ERR_ROWBLOCK_READ_INFO_ERROR == p_code; + } /// @return @c true iff the status indicates Uninitialized. bool is_uninitialized() const { return code() == TStatusCode::UNINITIALIZED; } diff --git a/be/src/http/action/compaction_action.cpp b/be/src/http/action/compaction_action.cpp index dada06b42a618e..fe86f530f93ac3 100644 --- a/be/src/http/action/compaction_action.cpp +++ b/be/src/http/action/compaction_action.cpp @@ -209,7 +209,7 @@ Status CompactionAction::_execute_compaction_callback(TabletSharedPtr tablet, BaseCompaction base_compaction(tablet); res = base_compaction.compact(); if (!res) { - if (res == Status::OLAPInternalError(OLAP_ERR_BE_NO_SUITABLE_VERSION)) { + if (res.precise_code() == OLAP_ERR_BE_NO_SUITABLE_VERSION) { // Ignore this error code. VLOG_NOTICE << "failed to init base compaction due to no suitable version, tablet=" << tablet->full_name(); @@ -223,7 +223,7 @@ Status CompactionAction::_execute_compaction_callback(TabletSharedPtr tablet, CumulativeCompaction cumulative_compaction(tablet); res = cumulative_compaction.compact(); if (!res) { - if (res == Status::OLAPInternalError(OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSION)) { + if (res.precise_code() == OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSION) { // Ignore this error code. VLOG_NOTICE << "failed to init cumulative compaction due to no suitable version," << "tablet=" << tablet->full_name(); diff --git a/be/src/olap/collect_iterator.cpp b/be/src/olap/collect_iterator.cpp index e8ac0ffab21b93..1ce67b6f1200f9 100644 --- a/be/src/olap/collect_iterator.cpp +++ b/be/src/olap/collect_iterator.cpp @@ -383,7 +383,7 @@ inline Status CollectIterator::Level1Iterator::_merge_next(const RowCursor** row if (LIKELY(res.ok())) { _heap->push(_cur_child); _cur_child = _heap->top(); - } else if (res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + } else if (res.precise_code() == OLAP_ERR_DATA_EOF) { // current child has been read, to read next delete _cur_child; if (!_heap->empty()) { @@ -412,7 +412,7 @@ inline Status CollectIterator::Level1Iterator::_normal_next(const RowCursor** ro auto res = _cur_child->next(row, delete_flag); if (LIKELY(res.ok())) { return Status::OK(); - } else if (res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + } else if (res.precise_code() == OLAP_ERR_DATA_EOF) { // current child has been read, to read next delete _cur_child; _children.pop_front(); diff --git a/be/src/olap/data_dir.cpp b/be/src/olap/data_dir.cpp index 0383ca5eb2044f..862d5e02eb2579 100644 --- a/be/src/olap/data_dir.cpp +++ b/be/src/olap/data_dir.cpp @@ -236,7 +236,7 @@ void DataDir::health_check() { if (!res) { LOG(WARNING) << "store read/write test file occur IO Error. path=" << _path_desc.filepath; - if (is_io_error(res)) { + if (res.is_io_error()) { _is_used = false; } } @@ -406,9 +406,8 @@ Status DataDir::load() { const std::string& value) -> bool { Status status = _tablet_manager->load_tablet_from_meta(this, tablet_id, schema_hash, value, false, false, false, false); - if (!status.ok() && - status != Status::OLAPInternalError(OLAP_ERR_TABLE_ALREADY_DELETED_ERROR) && - status != Status::OLAPInternalError(OLAP_ERR_ENGINE_INSERT_OLD_TABLET)) { + if (!status.ok() && status.precise_code() != OLAP_ERR_TABLE_ALREADY_DELETED_ERROR && + status.precise_code() != OLAP_ERR_ENGINE_INSERT_OLD_TABLET) { // load_tablet_from_meta() may return Status::OLAPInternalError(OLAP_ERR_TABLE_ALREADY_DELETED_ERROR) // which means the tablet status is DELETED // This may happen when the tablet was just deleted before the BE restarted, @@ -501,7 +500,7 @@ Status DataDir::load() { rowset_meta->tablet_uid() == tablet->tablet_uid()) { Status publish_status = tablet->add_rowset(rowset, false); if (!publish_status && - publish_status != Status::OLAPInternalError(OLAP_ERR_PUSH_VERSION_ALREADY_EXIST)) { + publish_status.precise_code() != OLAP_ERR_PUSH_VERSION_ALREADY_EXIST) { LOG(WARNING) << "add visible rowset to tablet failed rowset_id:" << rowset->rowset_id() << " tablet id: " << rowset_meta->tablet_id() << " txn id:" << rowset_meta->txn_id() diff --git a/be/src/olap/file_stream.cpp b/be/src/olap/file_stream.cpp index 7dd8a2d6da5b60..54d76d9bac87ac 100644 --- a/be/src/olap/file_stream.cpp +++ b/be/src/olap/file_stream.cpp @@ -118,7 +118,7 @@ Status ReadOnlyFileStream::seek(PositionProvider* position) { res = _assure_data(); if (OLAP_LIKELY(res.ok())) { // assure data will be successful in most case - } else if (res == Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF)) { + } else if (res.precise_code() == OLAP_ERR_COLUMN_STREAM_EOF) { VLOG_TRACE << "file stream eof."; return res; } else { diff --git a/be/src/olap/memtable.cpp b/be/src/olap/memtable.cpp index eba4e7e7338916..3a98d2bfec63d0 100644 --- a/be/src/olap/memtable.cpp +++ b/be/src/olap/memtable.cpp @@ -286,7 +286,7 @@ Status MemTable::_do_flush(int64_t& duration_ns) { SCOPED_RAW_TIMER(&duration_ns); if (_skip_list) { Status st = _rowset_writer->flush_single_memtable(this, &_flush_size); - if (st == Status::OLAPInternalError(OLAP_ERR_FUNC_NOT_IMPLEMENTED)) { + if (st.precise_code() == OLAP_ERR_FUNC_NOT_IMPLEMENTED) { // For alpha rowset, we do not implement "flush_single_memtable". // Flush the memtable like the old way. Table::Iterator it(_skip_list.get()); diff --git a/be/src/olap/push_handler.cpp b/be/src/olap/push_handler.cpp index 9e45c11830fa95..9e1bcaccee6c9b 100644 --- a/be/src/olap/push_handler.cpp +++ b/be/src/olap/push_handler.cpp @@ -185,7 +185,7 @@ Status PushHandler::_do_streaming_ingestion(TabletSharedPtr tablet, const TPushR request.partition_id, tablet_var.tablet, request.transaction_id, load_id, tablet_var.rowset_to_add, false); if (commit_status != Status::OK() && - commit_status != Status::OLAPInternalError(OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST)) { + commit_status.precise_code() != OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST) { res = commit_status; } } diff --git a/be/src/olap/rowset/column_data.cpp b/be/src/olap/rowset/column_data.cpp index 26067417c7a538..889581d8a9f5a3 100644 --- a/be/src/olap/rowset/column_data.cpp +++ b/be/src/olap/rowset/column_data.cpp @@ -70,7 +70,7 @@ Status ColumnData::get_next_block(RowBlock** row_block) { _is_normal_read = true; auto res = _get_block(false); if (!res.ok()) { - if (res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + if (res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "Get next block failed."; } *row_block = nullptr; @@ -165,7 +165,7 @@ Status ColumnData::_find_position_by_short_key(const RowCursor& key, bool find_l RowBlockPosition tmp_pos; auto res = _segment_group->find_short_key(key, &_short_key_cursor, find_last_key, &tmp_pos); if (!res.ok()) { - if (res == Status::OLAPInternalError(OLAP_ERR_INDEX_EOF)) { + if (res.precise_code() == OLAP_ERR_INDEX_EOF) { res = Status::OLAPInternalError(OLAP_ERR_DATA_EOF); } else { LOG(WARNING) << "find row block failed. res = " << res; @@ -185,7 +185,7 @@ Status ColumnData::_find_position_by_full_key(const RowCursor& key, bool find_la RowBlockPosition tmp_pos; auto res = _segment_group->find_short_key(key, &_short_key_cursor, false, &tmp_pos); if (!res.ok()) { - if (res == Status::OLAPInternalError(OLAP_ERR_INDEX_EOF)) { + if (res.precise_code() == OLAP_ERR_INDEX_EOF) { res = Status::OLAPInternalError(OLAP_ERR_DATA_EOF); } else { LOG(WARNING) << "find row block failed. res = " << res; @@ -202,7 +202,7 @@ Status ColumnData::_find_position_by_full_key(const RowCursor& key, bool find_la RowBlockPosition end_position; res = _segment_group->find_short_key(key, &_short_key_cursor, true, &end_position); if (!res.ok()) { - if (res == Status::OLAPInternalError(OLAP_ERR_INDEX_EOF)) { + if (res.precise_code() == OLAP_ERR_INDEX_EOF) { res = Status::OLAPInternalError(OLAP_ERR_DATA_EOF); } else { LOG(WARNING) << "find row block failed. res = " << res; @@ -282,7 +282,7 @@ Status ColumnData::_seek_to_row(const RowCursor& key, bool find_last_key, bool i res = _find_position_by_short_key(key, find_last_key, &position); } if (!res.ok()) { - if (res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + if (res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "Fail to find the key.[res=" << res << " key=" << key.to_string() << " find_last_key=" << find_last_key << "]"; } @@ -299,7 +299,7 @@ Status ColumnData::_seek_to_row(const RowCursor& key, bool find_last_key, bool i } res = _get_block(without_filter); if (!res.ok()) { - if (res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + if (res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "Fail to find the key.[res=" << res << " key=" << key.to_string() << " find_last_key=" << find_last_key << "]"; } @@ -359,11 +359,11 @@ Status ColumnData::prepare_block_read(const RowCursor* start_key, bool find_star _end_block = _current_block; _end_row_index = _read_block->pos(); _end_key_is_set = true; - } else if (res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + } else if (res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "Find end key failed.key=" << end_key->to_string(); return res; } - // res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF) means there is no end key, then we read to + // res.precise_code() == OLAP_ERR_DATA_EOF means there is no end key, then we read to // the end of this ColumnData } set_eof(false); @@ -371,7 +371,7 @@ Status ColumnData::prepare_block_read(const RowCursor* start_key, bool find_star auto res = _seek_to_row(*start_key, !find_start_key, false); if (res.ok()) { *first_block = _read_block.get(); - } else if (res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + } else if (res.precise_code() == OLAP_ERR_DATA_EOF) { _eof = true; *first_block = nullptr; return res; @@ -450,7 +450,7 @@ Status ColumnData::get_first_row_block(RowBlock** row_block) { RowBlockPosition block_pos; Status res = segment_group()->find_first_row_block(&block_pos); if (!res.ok()) { - if (res == Status::OLAPInternalError(OLAP_ERR_INDEX_EOF)) { + if (res.precise_code() == OLAP_ERR_INDEX_EOF) { *row_block = nullptr; _eof = true; return res; @@ -461,7 +461,7 @@ Status ColumnData::get_first_row_block(RowBlock** row_block) { res = _seek_to_block(block_pos, false); if (!res.ok()) { - if (res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + if (res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "seek to block fail. res = " << res; } *row_block = nullptr; @@ -470,7 +470,7 @@ Status ColumnData::get_first_row_block(RowBlock** row_block) { res = _get_block(false); if (!res.ok()) { - if (res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + if (res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "fail to load data to row block. res=" << res << ", version=" << version().first << "-" << version().second; } diff --git a/be/src/olap/rowset/column_reader.cpp b/be/src/olap/rowset/column_reader.cpp index c3598222c71fe1..ee6c7fb1ad1b86 100644 --- a/be/src/olap/rowset/column_reader.cpp +++ b/be/src/olap/rowset/column_reader.cpp @@ -120,7 +120,7 @@ Status StringColumnDirectReader::seek(PositionProvider* position) { // All strings in segment may be empty, so the data stream is EOF and // and length stream is not EOF. - if (res.ok() || Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) == res) { + if (res.ok() || OLAP_ERR_COLUMN_STREAM_EOF == res.precise_code()) { res = _length_reader->seek(position); } @@ -383,7 +383,7 @@ Status StringColumnDictionaryReader::next(char* buffer, uint32_t* length) { Status res = _data_reader->next(&value); // 错误或是EOF if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } @@ -799,7 +799,7 @@ Status TinyColumnReader::seek(PositionProvider* positions) { return res; } res = _data_reader->seek(positions); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek tinyint stream. res = " << res; return res; } @@ -817,7 +817,7 @@ Status TinyColumnReader::next_vector(ColumnVector* column_vector, uint32_t size, MemPool* mem_pool) { Status res = ColumnReader::next_vector(column_vector, size, mem_pool); if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; @@ -844,7 +844,7 @@ Status TinyColumnReader::next_vector(ColumnVector* column_vector, uint32_t size, } _stats->bytes_read += size; - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } @@ -929,13 +929,13 @@ Status DecimalColumnReader::seek(PositionProvider* positions) { return res; } res = _int_reader->seek(positions); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek int stream of decimal. res = " << res; return res; } res = _frac_reader->seek(positions); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek frac stream of decimal. res = " << res; return res; } @@ -966,7 +966,7 @@ Status DecimalColumnReader::next_vector(ColumnVector* column_vector, uint32_t si MemPool* mem_pool) { Status res = ColumnReader::next_vector(column_vector, size, mem_pool); if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; @@ -1093,13 +1093,13 @@ Status LargeIntColumnReader::seek(PositionProvider* positions) { } res = _high_reader->seek(positions); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek high int stream of largeint. res = " << res; return res; } res = _low_reader->seek(positions); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek low int stream of largeint. res = " << res; return res; } @@ -1128,7 +1128,7 @@ Status LargeIntColumnReader::next_vector(ColumnVector* column_vector, uint32_t s MemPool* mem_pool) { Status res = ColumnReader::next_vector(column_vector, size, mem_pool); if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; diff --git a/be/src/olap/rowset/column_reader.h b/be/src/olap/rowset/column_reader.h index 6f3e159315f2e2..a14bf8e4723cfb 100644 --- a/be/src/olap/rowset/column_reader.h +++ b/be/src/olap/rowset/column_reader.h @@ -461,7 +461,7 @@ class IntegerColumnReaderWrapper : public ColumnReader { return res; } res = _reader.seek(positions); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek int stream. res = " << res; return res; } @@ -474,7 +474,7 @@ class IntegerColumnReaderWrapper : public ColumnReader { virtual Status next_vector(ColumnVector* column_vector, uint32_t size, MemPool* mem_pool) { Status res = ColumnReader::next_vector(column_vector, size, mem_pool); if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; @@ -505,7 +505,7 @@ class IntegerColumnReaderWrapper : public ColumnReader { } _stats->bytes_read += sizeof(T) * size; - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; @@ -558,7 +558,7 @@ class FixLengthStringColumnReader : public ColumnReader { return res; } res = _reader.seek(positions); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to read fixed string stream. res = " << res; return res; } @@ -570,7 +570,7 @@ class FixLengthStringColumnReader : public ColumnReader { virtual Status next_vector(ColumnVector* column_vector, uint32_t size, MemPool* mem_pool) { Status res = ColumnReader::next_vector(column_vector, size, mem_pool); if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; @@ -622,7 +622,7 @@ class VarStringColumnReader : public ColumnReader { return res; } res = _reader.seek(position); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek varchar stream. res = " << res; return res; } @@ -635,7 +635,7 @@ class VarStringColumnReader : public ColumnReader { virtual Status next_vector(ColumnVector* column_vector, uint32_t size, MemPool* mem_pool) { Status res = ColumnReader::next_vector(column_vector, size, mem_pool); if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; @@ -706,7 +706,7 @@ class FloatintPointColumnReader : public ColumnReader { return res; } res = _data_stream->seek(position); - if (!res.ok() && Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) != res) { + if (!res.ok() && OLAP_ERR_COLUMN_STREAM_EOF != res.precise_code()) { LOG(WARNING) << "fail to seek float stream. res = " << res; return res; } @@ -732,7 +732,7 @@ class FloatintPointColumnReader : public ColumnReader { Status res = ColumnReader::next_vector(column_vector, size, mem_pool); if (!res.ok()) { - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } return res; @@ -764,7 +764,7 @@ class FloatintPointColumnReader : public ColumnReader { } _stats->bytes_read += sizeof(FLOAT_TYPE) * size; - if (Status::OLAPInternalError(OLAP_ERR_DATA_EOF) == res) { + if (OLAP_ERR_DATA_EOF == res.precise_code()) { _eof = true; } diff --git a/be/src/olap/rowset/rowset_meta_manager.cpp b/be/src/olap/rowset/rowset_meta_manager.cpp index 46e9c6cde52ad7..795a0fb38b1092 100644 --- a/be/src/olap/rowset/rowset_meta_manager.cpp +++ b/be/src/olap/rowset/rowset_meta_manager.cpp @@ -47,7 +47,7 @@ Status RowsetMetaManager::get_rowset_meta(OlapMeta* meta, TabletUid tablet_uid, std::string key = ROWSET_PREFIX + tablet_uid.to_string() + "_" + rowset_id.to_string(); std::string value; Status s = meta->get(META_COLUMN_FAMILY_INDEX, key, &value); - if (s == Status::OLAPInternalError(OLAP_ERR_META_KEY_NOT_FOUND)) { + if (s.precise_code() == OLAP_ERR_META_KEY_NOT_FOUND) { std::string error_msg = "rowset id:" + key + " not found."; LOG(WARNING) << error_msg; return Status::OLAPInternalError(OLAP_ERR_META_KEY_NOT_FOUND); diff --git a/be/src/olap/rowset/segment_reader.cpp b/be/src/olap/rowset/segment_reader.cpp index 639f4e5bc278f4..02b4097cbd29bd 100644 --- a/be/src/olap/rowset/segment_reader.cpp +++ b/be/src/olap/rowset/segment_reader.cpp @@ -795,7 +795,7 @@ Status SegmentReader::_seek_to_block_directly(int64_t block_id, const std::vecto Status res = Status::OK(); PositionProvider position(&_column_indices[cid]->entry(block_id)); if (!(res = _column_readers[cid]->seek(&position))) { - if (Status::OLAPInternalError(OLAP_ERR_COLUMN_STREAM_EOF) == res) { + if (OLAP_ERR_COLUMN_STREAM_EOF == res.precise_code()) { VLOG_TRACE << "Stream EOF. tablet_id=" << _segment_group->get_tablet_id() << ", column_id=" << _column_readers[cid]->column_unique_id() << ", block_id=" << block_id; diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp index 742987f064ac25..871f6bb64a7a38 100644 --- a/be/src/olap/schema_change.cpp +++ b/be/src/olap/schema_change.cpp @@ -1890,7 +1890,7 @@ Status SchemaChangeHandler::_convert_historical_rowsets(const SchemaChangeParams goto PROCESS_ALTER_EXIT; } res = sc_params.new_tablet->add_rowset(new_rowset, false); - if (res == Status::OLAPInternalError(OLAP_ERR_PUSH_VERSION_ALREADY_EXIST)) { + if (res.precise_code() == OLAP_ERR_PUSH_VERSION_ALREADY_EXIST) { LOG(WARNING) << "version already exist, version revert occurred. " << "tablet=" << sc_params.new_tablet->full_name() << ", version='" << rs_reader->version().first << "-" << rs_reader->version().second; diff --git a/be/src/olap/storage_migration_v2.cpp b/be/src/olap/storage_migration_v2.cpp index 5ba4f4b6596d14..4bd59e16b2f8fb 100644 --- a/be/src/olap/storage_migration_v2.cpp +++ b/be/src/olap/storage_migration_v2.cpp @@ -373,7 +373,7 @@ Status StorageMigrationV2Handler::_convert_historical_rowsets( goto PROCESS_ALTER_EXIT; } res = sm_params.new_tablet->add_rowset(new_rowset, false); - if (res == Status::OLAPInternalError(OLAP_ERR_PUSH_VERSION_ALREADY_EXIST)) { + if (res.precise_code() == OLAP_ERR_PUSH_VERSION_ALREADY_EXIST) { LOG(WARNING) << "version already exist, version revert occurred. " << "tablet=" << sm_params.new_tablet->full_name() << ", version='" << rs_reader->version().first << "-" << rs_reader->version().second; diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index 71628cf4c3fefe..fb473cf3d975e3 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -1340,7 +1340,7 @@ Status Tablet::prepare_compaction_and_calculate_permits(CompactionType compactio if (!res.ok()) { set_last_cumu_compaction_failure_time(UnixMillis()); *permits = 0; - if (res != Status::OLAPInternalError(OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSION)) { + if (res.precise_code() != OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSION) { DorisMetrics::instance()->cumulative_compaction_request_failed->increment(1); return Status::InternalError( fmt::format("prepare cumulative compaction with err: {}", res)); @@ -1370,7 +1370,7 @@ Status Tablet::prepare_compaction_and_calculate_permits(CompactionType compactio if (!res.ok()) { set_last_base_compaction_failure_time(UnixMillis()); *permits = 0; - if (res != Status::OLAPInternalError(OLAP_ERR_BE_NO_SUITABLE_VERSION)) { + if (res.precise_code() != OLAP_ERR_BE_NO_SUITABLE_VERSION) { DorisMetrics::instance()->base_compaction_request_failed->increment(1); return Status::InternalError( fmt::format("prepare base compaction with err: {}", res)); diff --git a/be/src/olap/tablet_meta_manager.cpp b/be/src/olap/tablet_meta_manager.cpp index f704532e73b247..4193c5588fe532 100644 --- a/be/src/olap/tablet_meta_manager.cpp +++ b/be/src/olap/tablet_meta_manager.cpp @@ -57,7 +57,7 @@ Status TabletMetaManager::get_meta(DataDir* store, TTabletId tablet_id, TSchemaH std::string key = key_stream.str(); std::string value; Status s = meta->get(META_COLUMN_FAMILY_INDEX, key, &value); - if (s == Status::OLAPInternalError(OLAP_ERR_META_KEY_NOT_FOUND)) { + if (s.precise_code() == OLAP_ERR_META_KEY_NOT_FOUND) { LOG(WARNING) << "tablet_id:" << tablet_id << ", schema_hash:" << schema_hash << " not found."; return Status::OLAPInternalError(OLAP_ERR_META_KEY_NOT_FOUND); diff --git a/be/src/olap/task/engine_batch_load_task.cpp b/be/src/olap/task/engine_batch_load_task.cpp index 5123db1d146b3e..eddd8c8b9b3e29 100644 --- a/be/src/olap/task/engine_batch_load_task.cpp +++ b/be/src/olap/task/engine_batch_load_task.cpp @@ -261,7 +261,7 @@ Status EngineBatchLoadTask::_process() { Status push_status = _push(_push_req, _tablet_infos); time_t push_finish = time(nullptr); LOG(INFO) << "Push finish, cost time: " << (push_finish - push_begin); - if (push_status == Status::OLAPInternalError(OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST)) { + if (push_status.precise_code() == OLAP_ERR_PUSH_TRANSACTION_ALREADY_EXIST) { status = Status::OK(); } else if (push_status != Status::OK()) { status = push_status; diff --git a/be/src/olap/task/engine_clone_task.cpp b/be/src/olap/task/engine_clone_task.cpp index e49472f5f68bbb..5fcdd86e1fb0b3 100644 --- a/be/src/olap/task/engine_clone_task.cpp +++ b/be/src/olap/task/engine_clone_task.cpp @@ -247,7 +247,7 @@ void EngineCloneTask::_set_tablet_info(Status status, bool is_new_tablet) { Status drop_status = StorageEngine::instance()->tablet_manager()->drop_tablet( _clone_req.tablet_id, _clone_req.schema_hash); if (drop_status != Status::OK() && - drop_status != Status::OLAPInternalError(OLAP_ERR_TABLE_NOT_FOUND)) { + drop_status.precise_code() != OLAP_ERR_TABLE_NOT_FOUND) { // just log LOG(WARNING) << "drop stale cloned table failed! tablet id: " << _clone_req.tablet_id; diff --git a/be/src/olap/task/engine_publish_version_task.cpp b/be/src/olap/task/engine_publish_version_task.cpp index cdfde3a3cb0b93..de4d6449f2d549 100644 --- a/be/src/olap/task/engine_publish_version_task.cpp +++ b/be/src/olap/task/engine_publish_version_task.cpp @@ -98,7 +98,7 @@ Status EnginePublishVersionTask::finish() { // add visible rowset to tablet publish_status = tablet->add_inc_rowset(rowset); if (publish_status != Status::OK() && - publish_status != Status::OLAPInternalError(OLAP_ERR_PUSH_VERSION_ALREADY_EXIST)) { + publish_status.precise_code() != OLAP_ERR_PUSH_VERSION_ALREADY_EXIST) { LOG(WARNING) << "fail to add visible rowset to tablet. rowset_id=" << rowset->rowset_id() << ", tablet_id=" << tablet_info.tablet_id << ", txn_id=" << transaction_id << ", res=" << publish_status; diff --git a/be/src/olap/tuple_reader.cpp b/be/src/olap/tuple_reader.cpp index 63e214576d031e..f4e5e1d16ac68b 100644 --- a/be/src/olap/tuple_reader.cpp +++ b/be/src/olap/tuple_reader.cpp @@ -55,7 +55,7 @@ Status TupleReader::_init_collect_iter(const ReaderParams& read_params, for (auto& rs_reader : rs_readers) { RETURN_NOT_OK(rs_reader->init(&_reader_context)); Status res = _collect_iter.add_child(rs_reader); - if (!res.ok() && res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + if (!res.ok() && res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "failed to add child to iterator, err=" << res; return res; } @@ -110,7 +110,7 @@ Status TupleReader::_direct_next_row(RowCursor* row_cursor, MemPool* mem_pool, O } direct_copy_row(row_cursor, *_next_key); auto res = _collect_iter.next(&_next_key, &_next_delete_flag); - if (UNLIKELY(!res.ok() && res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (UNLIKELY(!res.ok() && res.precise_code() != OLAP_ERR_DATA_EOF)) { return res; } return Status::OK(); @@ -124,7 +124,7 @@ Status TupleReader::_direct_agg_key_next_row(RowCursor* row_cursor, MemPool* mem } init_row_with_others(row_cursor, *_next_key, mem_pool, agg_pool); auto res = _collect_iter.next(&_next_key, &_next_delete_flag); - if (UNLIKELY(!res.ok() && res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (UNLIKELY(!res.ok() && res.precise_code() != OLAP_ERR_DATA_EOF)) { return res; } if (_need_agg_finalize) { @@ -143,7 +143,7 @@ Status TupleReader::_agg_key_next_row(RowCursor* row_cursor, MemPool* mem_pool, int64_t merged_count = 0; do { auto res = _collect_iter.next(&_next_key, &_next_delete_flag); - if (UNLIKELY(res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (UNLIKELY(res.precise_code() == OLAP_ERR_DATA_EOF)) { break; } @@ -188,7 +188,7 @@ Status TupleReader::_unique_key_next_row(RowCursor* row_cursor, MemPool* mem_poo direct_copy_row(row_cursor, *_next_key); // skip the lower version rows; auto res = _collect_iter.next(&_next_key, &_next_delete_flag); - if (LIKELY(res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (LIKELY(res.precise_code() != OLAP_ERR_DATA_EOF)) { if (UNLIKELY(!res.ok())) { LOG(WARNING) << "next failed: " << res; return res; diff --git a/be/src/olap/utils.h b/be/src/olap/utils.h index 612d3ac455fa29..b84fe024ce1ecc 100644 --- a/be/src/olap/utils.h +++ b/be/src/olap/utils.h @@ -217,16 +217,6 @@ class Errno { static __thread char _buf[BUF_SIZE]; }; -inline bool is_io_error(Status status) { - return (((Status::OLAPInternalError(OLAP_ERR_IO_ERROR) == status || - Status::OLAPInternalError(OLAP_ERR_READ_UNENOUGH) == status) && - errno == EIO) || - Status::OLAPInternalError(OLAP_ERR_CHECKSUM_ERROR) == status || - Status::OLAPInternalError(OLAP_ERR_FILE_DATA_ERROR) == status || - Status::OLAPInternalError(OLAP_ERR_TEST_FILE_ERROR) == status || - Status::OLAPInternalError(OLAP_ERR_ROWBLOCK_READ_INFO_ERROR) == status); -} - #define ENDSWITH(str, suffix) ((str).rfind(suffix) == (str).size() - strlen(suffix)) // 检查int8_t, int16_t, int32_t, int64_t的值是否溢出 diff --git a/be/src/tools/meta_tool.cpp b/be/src/tools/meta_tool.cpp index 52ee67b6629187..60b56b35cbf7ff 100644 --- a/be/src/tools/meta_tool.cpp +++ b/be/src/tools/meta_tool.cpp @@ -114,7 +114,7 @@ void get_meta(DataDir* data_dir) { std::string value; Status s = TabletMetaManager::get_json_meta(data_dir, FLAGS_tablet_id, FLAGS_schema_hash, &value); - if (s == doris::Status::OLAPInternalError(doris::OLAP_ERR_META_KEY_NOT_FOUND)) { + if (s.precise_code() == doris::OLAP_ERR_META_KEY_NOT_FOUND) { std::cout << "no tablet meta for tablet_id:" << FLAGS_tablet_id << ", schema_hash:" << FLAGS_schema_hash << std::endl; return; diff --git a/be/src/vec/olap/block_reader.cpp b/be/src/vec/olap/block_reader.cpp index 78056d8fb89866..3f352793b3ebf2 100644 --- a/be/src/vec/olap/block_reader.cpp +++ b/be/src/vec/olap/block_reader.cpp @@ -55,7 +55,7 @@ Status BlockReader::_init_collect_iter(const ReaderParams& read_params, for (auto& rs_reader : rs_readers) { RETURN_NOT_OK(rs_reader->init(&_reader_context)); Status res = _vcollect_iter.add_child(rs_reader); - if (!res.ok() && res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + if (!res.ok() && res.precise_code() != OLAP_ERR_DATA_EOF) { LOG(WARNING) << "failed to add child to iterator, err=" << res; return res; } @@ -67,7 +67,7 @@ Status BlockReader::_init_collect_iter(const ReaderParams& read_params, _vcollect_iter.build_heap(*valid_rs_readers); if (_vcollect_iter.is_merge()) { auto status = _vcollect_iter.current_row(&_next_row); - _eof = status == Status::OLAPInternalError(OLAP_ERR_DATA_EOF); + _eof = status.precise_code() == OLAP_ERR_DATA_EOF; } return Status::OK(); @@ -172,10 +172,10 @@ Status BlockReader::init(const ReaderParams& read_params) { Status BlockReader::_direct_next_block(Block* block, MemPool* mem_pool, ObjectPool* agg_pool, bool* eof) { auto res = _vcollect_iter.next(block); - if (UNLIKELY(!res.ok() && res != Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (UNLIKELY(!res.ok() && res.precise_code() != OLAP_ERR_DATA_EOF)) { return res; } - *eof = res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF); + *eof = res.precise_code() == OLAP_ERR_DATA_EOF; return Status::OK(); } @@ -201,7 +201,7 @@ Status BlockReader::_agg_key_next_block(Block* block, MemPool* mem_pool, ObjectP while (true) { auto res = _vcollect_iter.next(&_next_row); - if (UNLIKELY(res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (UNLIKELY(res.precise_code() == OLAP_ERR_DATA_EOF)) { *eof = true; break; } @@ -252,7 +252,7 @@ Status BlockReader::_unique_key_next_block(Block* block, MemPool* mem_pool, Obje // in UNIQUE_KEY highest version is the final result, there is no need to // merge the lower versions auto res = _vcollect_iter.next(&_next_row); - if (UNLIKELY(res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (UNLIKELY(res.precise_code() == OLAP_ERR_DATA_EOF)) { *eof = true; break; } diff --git a/be/src/vec/olap/vcollect_iterator.cpp b/be/src/vec/olap/vcollect_iterator.cpp index de0a0625abe059..1fc853294f527e 100644 --- a/be/src/vec/olap/vcollect_iterator.cpp +++ b/be/src/vec/olap/vcollect_iterator.cpp @@ -323,7 +323,7 @@ Status VCollectIterator::Level1Iterator::_merge_next(IteratorRowRef* ref) { if (LIKELY(res.ok())) { _heap->push(_cur_child); _cur_child = _heap->top(); - } else if (res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + } else if (res.precise_code() == OLAP_ERR_DATA_EOF) { // current child has been read, to read next delete _cur_child; if (!_heap->empty()) { @@ -358,7 +358,7 @@ Status VCollectIterator::Level1Iterator::_normal_next(IteratorRowRef* ref) { if (LIKELY(res.ok())) { _ref = *ref; return Status::OK(); - } else if (res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + } else if (res.precise_code() == OLAP_ERR_DATA_EOF) { // current child has been read, to read next delete _cur_child; _children.pop_front(); @@ -390,7 +390,7 @@ Status VCollectIterator::Level1Iterator::_merge_next(Block* block) { } ++target_block_row; auto res = _merge_next(&cur_row); - if (UNLIKELY(res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF))) { + if (UNLIKELY(res.precise_code() == OLAP_ERR_DATA_EOF)) { if (target_block_row > 0) { return Status::OK(); } else { @@ -411,7 +411,7 @@ Status VCollectIterator::Level1Iterator::_normal_next(Block* block) { auto res = _cur_child->next(block); if (LIKELY(res.ok())) { return Status::OK(); - } else if (res == Status::OLAPInternalError(OLAP_ERR_DATA_EOF)) { + } else if (res.precise_code() == OLAP_ERR_DATA_EOF) { // current child has been read, to read next delete _cur_child; _children.pop_front();