Skip to content

[CORE-10026] kafka: Support fetch v12#26926

Closed
BenPope wants to merge 3 commits intoredpanda-data:devfrom
BenPope:core-10026/kafka_fetch_v12
Closed

[CORE-10026] kafka: Support fetch v12#26926
BenPope wants to merge 3 commits intoredpanda-data:devfrom
BenPope:core-10026/kafka_fetch_v12

Conversation

@BenPope
Copy link
Copy Markdown
Member

@BenPope BenPope commented Jul 21, 2025

Support Fetch v12

I wonder if the fetch should issue a linearizable_barrier before returning the epoch, as is done for list_offsets?

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.2.x
  • v25.1.x
  • v24.3.x
  • v24.2.x

Release Notes

  • none

BenPope added 3 commits July 21, 2025 20:27
Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
Populate the current leader id and epoch under certain error conditions.

Signed-off-by: Ben Pope <ben@redpanda.com>
@BenPope BenPope requested review from a team, ballard26 and michael-redpanda and removed request for a team July 21, 2025 19:31
@vbotbuildovich
Copy link
Copy Markdown
Collaborator

CI test results

test results on build#69375
test_class test_method test_arguments test_kind job_url test_status passed reason
CloudStorageTimingStressTest test_cloud_storage {"cleanup_policy": "compact,delete"} ducktape https://buildkite.com/redpanda/redpanda/builds/69375#01982ea9-26a5-4d5f-b389-c3e941f066af FLAKY 18/21 upstream reliability is '97.70114942528735'. current run reliability is '85.71428571428571'. drift is 11.98686 and the allowed drift is set to 50. The test should PASS
FeaturesMultiNodeTest test_license_upload_and_query ducktape https://buildkite.com/redpanda/redpanda/builds/69375#01982ea9-26a8-418f-9c5c-a7426a85d331 FLAKY 16/21 upstream reliability is '98.48101265822785'. current run reliability is '76.19047619047619'. drift is 22.29054 and the allowed drift is set to 50. The test should PASS
DatalakeE2ETests test_json_schema_unicode {"catalog_type": "rest_hadoop", "cloud_storage_type": 1, "query_engine": "trino"} ducktape https://buildkite.com/redpanda/redpanda/builds/69375#01982ea9-26a7-444a-8420-62668b7dbf24 FLAKY 19/21 upstream reliability is '98.46491228070175'. current run reliability is '90.47619047619048'. drift is 7.98872 and the allowed drift is set to 50. The test should PASS
RandomNodeOperationsTest test_node_operations {"cloud_storage_type": 1, "compaction_mode": "adjacent_merge", "enable_failures": false, "mixed_versions": false, "with_iceberg": false} ducktape https://buildkite.com/redpanda/redpanda/builds/69375#01982ea9-26a7-444a-8420-62668b7dbf24 FLAKY 20/21 upstream reliability is '99.62121212121212'. current run reliability is '95.23809523809523'. drift is 4.38312 and the allowed drift is set to 50. The test should PASS
RandomNodeOperationsTest test_node_operations {"cloud_storage_type": 1, "compaction_mode": "adjacent_merge", "enable_failures": false, "mixed_versions": true, "with_iceberg": false} ducktape https://buildkite.com/redpanda/redpanda/builds/69375#01982ea9-26a9-4125-9cec-7d89942e6ebd FLAKY 20/21 upstream reliability is '100.0'. current run reliability is '95.23809523809523'. drift is 4.7619 and the allowed drift is set to 50. The test should PASS

@BenPope BenPope requested a review from IoannisRP July 22, 2025 12:15
@dotnwat
Copy link
Copy Markdown
Member

dotnwat commented Jul 23, 2025

I wonder if the fetch should issue a linearizable_barrier before returning the epoch, as is done for list_offsets?

@redpanda-data/core-replication

Comment on lines +63 to +66
template<std::ranges::input_range R>
auto enumerate(R&& range) {
return std::views::zip(std::views::iota(size_t{0}), std::forward<R>(range));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this std::ranges::enumerate_view?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this std::ranges::enumerate_view?

Yes, good spot. (our libc++ doesn't have it), but I'll remove it as I'm not using it any more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +93 to +100
return needs_updated_leader(err)
.and_then([&](auto err) {
return get_leader_id_and_epoch(md_cache, ktp)
.transform([&](auto leader) {
return kafka::read_result(err, std::move(leader));
});
})
.value_or(kafka::read_result(err));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting use of the optional utilities.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting use of the optional utilities.

Yeah, I'm not convinced!

Suggested change
return needs_updated_leader(err)
.and_then([&](auto err) {
return get_leader_id_and_epoch(md_cache, ktp)
.transform([&](auto leader) {
return kafka::read_result(err, std::move(leader));
});
})
.value_or(kafka::read_result(err));
if (needs_updated_leader(err)) {
if (auto leader = get_leader_id_and_epoch(md_cache, ktp); leader) {
return kafka::read_result(err, std::move(leader));
}
}
return kafka::read_result(err);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean, it's your code. I am happy with the proposed changes. 👍

@bashtanov
Copy link
Copy Markdown
Contributor

I wonder if the fetch should issue a linearizable_barrier before returning the epoch, as is done for list_offsets?

Without linearizable_barrier we may return stale data, i.e. an epoch (=term) that ceased to be correct at some point before we started serving the client request.

@mmaslankaprv
Copy link
Copy Markdown
Member

I think it is fine not to issue the linearizable barrier. The term may only be stale, but it will not be stale if the replica serving a request is current leader. In other words there will be no inconsistency between the term and the leader_id

@BenPope
Copy link
Copy Markdown
Member Author

BenPope commented Jul 28, 2025

I think it is fine not to issue the linearizable barrier. The term may only be stale, but it will not be stale if the replica serving a request is current leader. In other words there will be no inconsistency between the term and the leader_id

I'd come to the same conclusion, but I appreciate the confirmation.

@BenPope
Copy link
Copy Markdown
Member Author

BenPope commented Jul 28, 2025

Moving to closed, in favour of #26968

@BenPope BenPope closed this Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants