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

read replica partitions report incorrect kafka max offset #16259

Closed
andrwng opened this issue Jan 23, 2024 · 0 comments · Fixed by #16263
Closed

read replica partitions report incorrect kafka max offset #16259

andrwng opened this issue Jan 23, 2024 · 0 comments · Fixed by #16263
Labels
area/cloud-storage Shadow indexing subsystem kind/bug Something isn't working

Comments

@andrwng
Copy link
Contributor

andrwng commented Jan 23, 2024

Version & Environment

Redpanda version: (use rpk version): dev

for metrics:

sm::make_gauge(
"max_offset",
[this] {
auto log_offset = _partition.high_watermark();
auto translator = _partition.get_offset_translator_state();
try {
return translator->from_log_offset(log_offset);
} catch (std::runtime_error& e) {
// Offset translation will throw if nothing was committed
// to the partition or if the offset is outside the
// translation range for any other reason.
return model::offset(-1);
}
},

vs for kafka endpoint:
model::offset high_watermark() const final {
if (_partition->is_read_replica_mode_enabled()) {
if (_partition->cloud_data_available()) {
return _partition->next_cloud_offset();
} else {
return model::offset(0);
}
}
return _translator->from_log_offset(_partition->high_watermark());
}

This branch to determine whether we're a read replica should take place for both the Kafka endpoint and the metrics endpoint, seeing as how users may want to track max offset via metrics. The latter is not happening today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cloud-storage Shadow indexing subsystem kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant