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

[v23.1.x] txns: fix list txns failure when it's used before find_coordinator #12578

Merged
merged 1 commit into from
Aug 9, 2023
Merged
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
6 changes: 6 additions & 0 deletions src/v/cluster/tx_gateway_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2953,6 +2953,12 @@ ss::future<> tx_gateway_frontend::do_expire_old_tx(

ss::future<tx_gateway_frontend::return_all_txs_res>
tx_gateway_frontend::get_all_transactions() {
if (!_metadata_cache.local().contains(model::tx_manager_nt)) {
if (!co_await try_create_tx_topic()) {
co_return tx_errc::unknown_server_error;
}
}

auto shard = _shard_table.local().shard_for(model::tx_manager_ntp);

if (!shard.has_value()) {
Expand Down
7 changes: 6 additions & 1 deletion tests/rptest/tests/transaction_kafka_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, test_context):
"tx_timeout_delay_ms": 10000000,
"abort_timed_out_transactions_interval_ms":
10000000,
'enable_leader_balancer': False
"enable_leader_balancer": False
})

self.kafka_cli = KafkaCliTools(self.redpanda, "3.0.0")
Expand Down Expand Up @@ -106,6 +106,11 @@ def test_describe_transactions(self):
tpoic_partition = f"{topic}-{partition}"
assert tpoic_partition in expected_partitions

@cluster(num_nodes=3)
def test_empty_list_transactions(self):
txs_info = self.kafka_cli.list_transactions()
assert len(txs_info) == 0

@cluster(num_nodes=3)
def test_list_transactions(self):
producer1 = ck.Producer({
Expand Down