Skip to content

Commit

Permalink
[#25351] CDC: Remove dead code checking txn status in CDC
Browse files Browse the repository at this point in the history
Summary:
There was dead code in cdc producer where we were checking the transaction status of a multi-shard transaction but not really using the result. This is being removed in the diff.
Jira: DB-14567

Test Plan: Jenkins: test regex: .*CDC*

Reviewers: sumukh.phalgaonkar

Reviewed By: sumukh.phalgaonkar

Subscribers: svc_phabricator, ycdcxcluster

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D40745
  • Loading branch information
siddharth2411 committed Dec 18, 2024
1 parent 39088f7 commit 1cd04b8
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/yb/cdc/cdcsdk_producer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,6 @@ using dockv::SchemaPackingStorage;
namespace {
YB_DEFINE_ENUM(OpType, (INSERT)(UPDATE)(DELETE));

Result<TransactionStatusResult> GetTransactionStatus(
const TransactionId& txn_id,
const HybridTime& hybrid_time,
tablet::TransactionParticipant* txn_participant) {
static const std::string reason = "cdc";

std::promise<Result<TransactionStatusResult>> txn_status_promise;
auto future = txn_status_promise.get_future();
auto callback = [&txn_status_promise](Result<TransactionStatusResult> result) {
txn_status_promise.set_value(std::move(result));
};

txn_participant->RequestStatusAt(
{&txn_id, hybrid_time, hybrid_time, 0, &reason, TransactionLoadFlags{}, callback});
future.wait();
return future.get();
}

void SetOperation(RowMessage* row_message, OpType type, const Schema& schema) {
switch (type) {
case OpType::INSERT:
Expand Down Expand Up @@ -2757,7 +2739,6 @@ Status GetChangesForCDCSDK(
break;
}

auto txn_participant = tablet_ptr->transaction_participant();
have_more_messages = HaveMoreMessages(true);

Schema current_schema = *tablet_ptr->metadata()->schema();
Expand Down Expand Up @@ -2842,7 +2823,6 @@ Status GetChangesForCDCSDK(
if (msg->transaction_state().status() == TransactionStatus::APPLYING) {
auto txn_id = VERIFY_RESULT(
FullyDecodeTransactionId(msg->transaction_state().transaction_id()));
auto result = GetTransactionStatus(txn_id, tablet_peer->Now(), txn_participant);

// It is possible for a transaction to have two APPLYs in WAL. This check
// prevents us from streaming the same transaction twice in the same GetChanges
Expand Down

0 comments on commit 1cd04b8

Please sign in to comment.