fix(store): replace CHECK with error handling (#735)

This commit is contained in:
JinYan Su 2025-08-13 11:29:58 +08:00 committed by GitHub
parent bdc7ffb86d
commit 335d1a1b70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View File

@ -157,10 +157,7 @@ class TransferEngineOperationState : public OperationState {
public:
TransferEngineOperationState(TransferEngine& engine, BatchID batch_id,
size_t batch_size)
: engine_(engine), batch_id_(batch_id), batch_size_(batch_size) {
CHECK(batch_id_ != Transport::INVALID_BATCH_ID)
<< "Invalid batch ID for transfer engine operation";
}
: engine_(engine), batch_id_(batch_id), batch_size_(batch_size) {}
~TransferEngineOperationState() { engine_.freeBatchID(batch_id_); }

View File

@ -203,7 +203,10 @@ ErrorCode Client::InitTransferEngine(const std::string& local_hostname,
auto [hostname, port] = parseHostNameWithPort(local_hostname);
int rc = transfer_engine_.init(metadata_connstring, local_hostname,
hostname, port);
CHECK_EQ(rc, 0) << "Failed to initialize transfer engine";
if (rc != 0) {
LOG(ERROR) << "Failed to initialize transfer engine, rc=" << rc;
return ErrorCode::INTERNAL_ERROR;
}
Transport* transport = nullptr;
if (protocol == "rdma") {

View File

@ -509,6 +509,11 @@ std::optional<TransferFuture> TransferSubmitter::submitTransferEngineOperation(
return std::nullopt;
}
if (batch_id == Transport::INVALID_BATCH_ID) {
LOG(ERROR) << "Invalid batch ID for transfer engine operation";
return std::nullopt;
}
// Create state with transfer engine context - no polling thread
// needed
auto state = std::make_shared<TransferEngineOperationState>(