Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions tx_service/include/tx_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <cstdint>
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <unordered_set>
Expand Down Expand Up @@ -675,6 +676,7 @@ struct AsyncOp : public TransactionOperation
void Reset();

std::function<void(AsyncOp<ResultType> &async_op)> op_func_;
std::optional<int> timeout_secs_{10};

// hd_result_ represents the async result, and op_func_ should finish it
// after completes its work.
Expand Down
5 changes: 4 additions & 1 deletion tx_service/src/tx_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3828,7 +3828,7 @@ void AsyncOp<ResultType>::Forward(TransactionExecution *txm)
}
txm->PostProcess(*this);
}
else if (txm->IsTimeOut())
else if (timeout_secs_.has_value() && txm->IsTimeOut(*timeout_secs_))
{
TX_TRACE_ACTION_WITH_CONTEXT(
this,
Expand Down Expand Up @@ -3858,6 +3858,7 @@ template <typename ResultType>
void AsyncOp<ResultType>::Reset()
{
hd_result_.Reset();
timeout_secs_ = 10;
if (worker_thread_.joinable())
{
worker_thread_.join();
Expand Down Expand Up @@ -4588,6 +4589,7 @@ void SplitFlushRangeOp::Forward(TransactionExecution *txm)
txn,
&hd_res);
};
data_sync_op_.timeout_secs_ = std::nullopt;

LOG(INFO) << "Split Flush transaction data sync, range id "
<< range_info_->PartitionId()
Expand Down Expand Up @@ -7719,6 +7721,7 @@ void DataMigrationOp::Forward(TransactionExecution *txm)
txm->CommitTs(),
&async_op.hd_result_);
};
data_sync_op_.timeout_secs_ = std::nullopt;

ACTION_FAULT_INJECTOR("data_migrate_after_install_dirty");
ForwardToSubOperation(txm, &data_sync_op_);
Expand Down
Loading