Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
hust-hhb committed Jan 10, 2025
1 parent d9535df commit 702e8c6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
8 changes: 6 additions & 2 deletions be/src/cloud/cloud_meta_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ Status retry_rpc(std::string_view op_name, const Request& req, Response* res,
res->status().msg());
} else if (res->status().code() ==
MetaServiceCode::KV_TXN_CONFLICT_RETRY_EXCEEDED_MAX_TIMES) {
return Status::Error<ErrorCode::TXN_CONFLICT, false>("failed to {}: {}", op_name,
res->status().msg());
return Status::Error<ErrorCode::DELETE_BITMAP_LOCK_ERROR, false>(
"failed to {}: {}", op_name, res->status().msg());
} else if (res->status().code() != MetaServiceCode::KV_TXN_CONFLICT) {
return Status::Error<ErrorCode::INTERNAL_ERROR, false>("failed to {}: {}", op_name,
res->status().msg());
Expand All @@ -397,6 +397,10 @@ Status retry_rpc(std::string_view op_name, const Request& req, Response* res,
}

if (++retry_times > config::meta_service_rpc_retry_times) {
if (res->status().code() == MetaServiceCode::LOCK_CONFLICT) {
return Status::Error<ErrorCode::DELETE_BITMAP_LOCK_ERROR, false>(
"failed to {}: {}", op_name, res->status().msg());
}
break;
}

Expand Down
3 changes: 1 addition & 2 deletions be/src/cloud/cloud_schema_change_job.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ Status CloudSchemaChangeJob::_convert_historical_rowsets(const SchemaChangeParam
std::srand(static_cast<unsigned int>(std::time(nullptr)));
int random_value = std::rand() % 100;
if (random_value < 50) {
LOG(INFO) << "test txn conflict";
return Status::Error<ErrorCode::TXN_CONFLICT>("test txn conflict");
return Status::Error<ErrorCode::DELETE_BITMAP_LOCK_ERROR>("test txn conflict");
}
});
auto st = _cloud_storage_engine.meta_mgr().commit_tablet_job(job, &finish_resp);
Expand Down
1 change: 0 additions & 1 deletion be/src/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ namespace ErrorCode {
TStatusError(NOT_MASTER, true); \
TStatusError(OBTAIN_LOCK_FAILED, false); \
TStatusError(SNAPSHOT_EXPIRED, false); \
TStatusError(TXN_CONFLICT, false); \
TStatusError(DELETE_BITMAP_LOCK_ERROR, false);
// E error_name, error_code, print_stacktrace
#define APPLY_FOR_OLAP_ERROR_CODES(E) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,10 +580,12 @@ protected void runRunningJob() throws AlterCancelException {
for (AgentTask task : tasks) {
int maxFailedTimes = 0;
if (Config.isCloudMode() && Config.enable_schema_change_retry_in_cloud_mode) {
if (task.getErrorCode() != null && task.getErrorCode().equals(TStatusCode.TXN_CONFLICT)) {
if (task.getErrorCode() != null && task.getErrorCode()
.equals(TStatusCode.DELETE_BITMAP_LOCK_ERROR)) {
maxFailedTimes = Config.schema_change_max_retry_time;
}
LOG.warn("schema change task failed: {}, maxFailedTimes {}", task.getErrorMsg(), maxFailedTimes);
LOG.warn("schema change task failed: {}, set maxFailedTimes {}", task.getErrorMsg(),
maxFailedTimes);
}
if (task.getFailedTimes() > maxFailedTimes) {
task.setFinished(true);
Expand Down
2 changes: 0 additions & 2 deletions gensrc/thrift/Status.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ enum TStatusCode {

SNAPSHOT_EXPIRED = 75,

TXN_CONFLICT = 76,

// used for cloud
DELETE_BITMAP_LOCK_ERROR = 100,
// Not be larger than 200, see status.h
Expand Down

0 comments on commit 702e8c6

Please sign in to comment.