Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bulkload): Sometime ingest will hang when encountering write throttling #2157

Merged
merged 3 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/replica/replica_2pc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ void replica::on_client_write(dsn::message_ex *request, bool ignore_throttling)
return;
}

if (static_cast<int32_t>(_primary_states.pc.hp_secondaries.size()) + 1 <
_options->app_mutation_2pc_min_replica_count(_app_info.max_replica_count)) {
response_client_write(request, ERR_NOT_ENOUGH_MEMBER);
return;
}

if (!ignore_throttling && throttle_write_request(request)) {
return;
}

if (request->rpc_code() == dsn::apps::RPC_RRDB_RRDB_BULK_LOAD) {
auto cur_bulk_load_status = _bulk_loader->get_bulk_load_status();
if (cur_bulk_load_status != bulk_load_status::BLS_DOWNLOADED &&
Expand All @@ -209,19 +219,9 @@ void replica::on_client_write(dsn::message_ex *request, bool ignore_throttling)
_bulk_load_ingestion_start_time_ms = dsn_now_ms();
}

if (static_cast<int32_t>(_primary_states.pc.hp_secondaries.size()) + 1 <
_options->app_mutation_2pc_min_replica_count(_app_info.max_replica_count)) {
response_client_write(request, ERR_NOT_ENOUGH_MEMBER);
return;
}

if (!ignore_throttling && throttle_write_request(request)) {
return;
}

LOG_DEBUG_PREFIX("got write request from {}", request->header->from_address);
auto mu = _primary_states.write_queue.add_work(request->rpc_code(), request, this);
if (mu) {
if (mu != nullptr) {
init_prepare(mu, false);
}
}
Expand Down
Loading