Skip to content

Commit

Permalink
delete repeat func
Browse files Browse the repository at this point in the history
  • Loading branch information
amorynan committed Jul 30, 2024
1 parent bba3b4f commit 0cc86a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
23 changes: 0 additions & 23 deletions be/src/common/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,3 @@ inline const std::string& Exception::to_string() const {
return Status::Error<false>(e.code(), e.to_string()); \
} \
} while (0);

#define HANDLE_ERROR_IF_CATCH_EXCEPTION_OR_RETURN_ERROR(stmt, handle_error) \
do { \
try { \
doris::enable_thread_catch_bad_alloc++; \
Defer defer {[&]() { doris::enable_thread_catch_bad_alloc--; }}; \
{ \
Status _status_ = (stmt); \
if (UNLIKELY(!_status_.ok())) { \
handle_error(); \
return _status_; \
} \
} \
} catch (const doris::Exception& e) { \
handle_error(); \
if (e.code() == doris::ErrorCode::MEM_ALLOC_FAILED) { \
return Status::MemoryLimitExceeded(fmt::format( \
"PreCatch error code:{}, {}, __FILE__:{}, __LINE__:{}, __FUNCTION__:{}", \
e.code(), e.to_string(), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
} \
return Status::Error<false>(e.code(), e.to_string()); \
} \
} while (0);
11 changes: 5 additions & 6 deletions be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,14 @@ Status CompactionMixin::execute_compact() {
data_dir->disks_compaction_score_increment(permits);
data_dir->disks_compaction_num_increment(1);

auto record_compaction_stats = [&]() {
auto record_compaction_stats = [&](const doris::Exception& ex) {
_tablet->compaction_count.fetch_add(1, std::memory_order_relaxed);
data_dir->disks_compaction_score_increment(-permits);
data_dir->disks_compaction_num_increment(-1);
};

HANDLE_ERROR_IF_CATCH_EXCEPTION_OR_RETURN_ERROR(execute_compact_impl(permits),
record_compaction_stats);
record_compaction_stats();
HANDLE_EXCEPTION_IF_CATCH_EXCEPTION(execute_compact_impl(permits), record_compaction_stats);
record_compaction_stats(doris::Exception());

if (enable_compaction_checksum) {
EngineChecksumTask checksum_task(_engine, _tablet->tablet_id(), _tablet->schema_hash(),
Expand Down Expand Up @@ -1183,8 +1182,8 @@ Status CloudCompactionMixin::execute_compact_impl(int64_t permits) {
Status CloudCompactionMixin::execute_compact() {
TEST_INJECTION_POINT("Compaction::do_compaction");
int64_t permits = get_compaction_permits();
HANDLE_ERROR_IF_CATCH_EXCEPTION_OR_RETURN_ERROR(execute_compact_impl(permits),
[&]() { garbage_collection(); });
HANDLE_EXCEPTION_IF_CATCH_EXCEPTION(execute_compact_impl(permits),
[&](const doris::Exception& ex) { garbage_collection(); });
_load_segment_to_cache();
return Status::OK();
}
Expand Down

0 comments on commit 0cc86a7

Please sign in to comment.