From 7e3bb1ef41fddf03fb5cb0b4958010b30ff42202 Mon Sep 17 00:00:00 2001 From: Teng Ma Date: Wed, 22 Apr 2026 20:57:49 +0800 Subject: [PATCH] [Store] Remove unreachable INVALID_BATCH_ID check after freeBatchID In submitTransfer and mp_submitTransfer, batch_id is validated once at function entry. On submission failure the batch is freed and the function returns immediately. A second INVALID_BATCH_ID guard placed after that error path is unreachable dead code and should be removed. --- mooncake-store/src/transfer_task.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/mooncake-store/src/transfer_task.cpp b/mooncake-store/src/transfer_task.cpp index 03d5cf9e98..e47262f146 100644 --- a/mooncake-store/src/transfer_task.cpp +++ b/mooncake-store/src/transfer_task.cpp @@ -637,11 +637,6 @@ std::optional TransferSubmitter::submitTransfer( return std::nullopt; } - if (batch_id == INVALID_BATCH_ID) { // 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( @@ -666,20 +661,11 @@ std::optional TransferSubmitter::mp_submitTransfer( if (!s.ok()) { LOG(ERROR) << "Failed to submit all transfers, error code is " << s.code(); - // Note: batch_id will be freed by TransferEngineOperationState - // destructor if we create the state object, otherwise we need to free - // it here engine_.freeBatchID(batch_id); return std::nullopt; } - if (batch_id == INVALID_BATCH_ID) { // 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 + // Create state with transfer engine context - no polling thread needed auto state = std::make_shared( engine_, batch_id, batch_size);