Skip to content

Commit 63bd993

Browse files
committed
opt
1 parent 7b421fe commit 63bd993

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

be/src/agent/task_worker_pool.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,10 +1192,9 @@ void report_tablet_callback(StorageEngine& engine, const ClusterInfo* cluster_in
11921192
// receives this report, it is possible to delete the new tablet.
11931193
LOG(WARNING) << "report version " << report_version << " change to " << s_report_version;
11941194
DorisMetrics::instance()->report_all_tablets_requests_skip->increment(1);
1195+
int64_t expected = 0;
11951196
int64_t current_time = time(nullptr);
1196-
if (s_tablet_report_failure_start_time.load() == 0) {
1197-
s_tablet_report_failure_start_time.store(current_time);
1198-
}
1197+
s_tablet_report_failure_start_time.compare_exchange_strong(expected, current_time);
11991198
DorisMetrics::instance()->tablet_report_continuous_failure_duration_s->set_value(
12001199
current_time - s_tablet_report_failure_start_time);
12011200
return;
@@ -1237,10 +1236,9 @@ void report_tablet_callback(StorageEngine& engine, const ClusterInfo* cluster_in
12371236
report_tablet_total << 1;
12381237
if (!succ) [[unlikely]] {
12391238
report_tablet_failed << 1;
1239+
int64_t expected = 0;
12401240
int64_t current_time = time(nullptr);
1241-
if (s_tablet_report_failure_start_time.load() == 0) {
1242-
s_tablet_report_failure_start_time.store(current_time);
1243-
}
1241+
s_tablet_report_failure_start_time.compare_exchange_strong(expected, current_time);
12441242
DorisMetrics::instance()->tablet_report_continuous_failure_duration_s->set_value(
12451243
current_time - s_tablet_report_failure_start_time);
12461244
} else {

0 commit comments

Comments
 (0)