Skip to content

Commit 75cad2d

Browse files
yuhaijun999ketor
authored andcommitted
[feat][br] Added backup region timeout, default is 10 minutes, configurable.
1 parent b8af854 commit 75cad2d

File tree

6 files changed

+11
-4
lines changed

6 files changed

+11
-4
lines changed

src/br/backup_data_base.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ butil::Status BackupDataBase::DoBackupRegionInternal(
302302

303303
DINGO_LOG_IF(INFO, FLAGS_br_log_switch_backup_detail_detail) << name_ << " " << request.DebugString();
304304

305-
status = interaction->SendRequest(service_name, "BackupData", request, response);
305+
status = interaction->SendRequest(service_name, "BackupData", request, response, FLAGS_br_backup_region_timeout_ms);
306306
if (!status.ok()) {
307307
is_need_exit_ = true;
308308
std::string s =

src/br/backup_meta_base.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ butil::Status BackupMetaBase::DoBackupRegionInternal(
296296

297297
DINGO_LOG_IF(INFO, FLAGS_br_log_switch_backup_detail_detail) << request.DebugString();
298298

299-
butil::Status status = interaction->SendRequest(service_name, "BackupMeta", request, response);
299+
butil::Status status =
300+
interaction->SendRequest(service_name, "BackupMeta", request, response, FLAGS_br_backup_region_timeout_ms);
300301
if (!status.ok()) {
301302
is_need_exit_ = true;
302303
std::string s =

src/br/backup_sdk_data.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ butil::Status BackupSdkData::Run() {
226226
int64_t start_time_s = dingodb::Helper::Timestamp();
227227
int64_t end_time_s = start_time_s;
228228
while (true) {
229-
if ((end_time_s - start_time_s) > (FLAGS_br_server_interaction_timeout_ms / 1000 + 5)) {
229+
if ((end_time_s - start_time_s) > (FLAGS_br_backup_region_timeout_ms / 1000 + 5)) {
230230
DINGO_LOG(ERROR) << fmt::format("backup sdk region data timeout : {}s", (end_time_s - start_time_s));
231231
break;
232232
}

src/br/backup_sql_data.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ butil::Status BackupSqlData::Run() {
232232
int64_t start_time_s = dingodb::Helper::Timestamp();
233233
int64_t end_time_s = start_time_s;
234234
while (true) {
235-
if ((end_time_s - start_time_s) > (FLAGS_br_server_interaction_timeout_ms / 1000 + 5)) {
235+
if ((end_time_s - start_time_s) > (FLAGS_br_backup_region_timeout_ms / 1000 + 5)) {
236236
DINGO_LOG(ERROR) << fmt::format("backup sql region data timeout : {}s", (end_time_s - start_time_s));
237237
break;
238238
}

src/br/parameter.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,7 @@ DEFINE_bool(br_restore_index_must_be_exist, false,
133133
DEFINE_bool(br_restore_document_must_be_exist, false,
134134
"br restore document must be exist. default false. if false, document region will not be restore.");
135135

136+
// backup region timeout ms (macro second)
137+
DEFINE_int64(br_backup_region_timeout_ms, 600000, "backup region timeout ms. default 10m");
138+
136139
} // namespace br

src/br/parameter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ DECLARE_bool(br_restore_index_must_be_exist);
177177
// br restore document must be exist
178178
DECLARE_bool(br_restore_document_must_be_exist);
179179

180+
// backup region timeout ms (macro second)
181+
DECLARE_int64(br_backup_region_timeout_ms);
182+
180183
} // namespace br
181184

182185
#endif // DINGODB_BR_PARAMETER_H_

0 commit comments

Comments
 (0)