diff --git a/src/v/archival/ntp_archiver_service.cc b/src/v/archival/ntp_archiver_service.cc index 24aec8974c566..c43e3db4208bb 100644 --- a/src/v/archival/ntp_archiver_service.cc +++ b/src/v/archival/ntp_archiver_service.cc @@ -1471,7 +1471,7 @@ ntp_archiver::do_schedule_single_upload( auto base = upload.starting_offset; auto log = _parent.log(); auto delta = base - model::offset_cast(log->from_log_offset(base)); - auto delta_offset_next = log->delta( + auto delta_offset_next = log->offset_delta( model::next_offset(upload.final_offset)); // The upload is successful only if the segment, and tx_range are @@ -2927,7 +2927,7 @@ ss::future ntp_archiver::do_upload_local( auto base = upload.starting_offset; auto log = _parent.log(); auto delta = base - model::offset_cast(log->from_log_offset(base)); - auto delta_offset_next = log->delta( + auto delta_offset_next = log->offset_delta( model::next_offset(upload.final_offset)); auto archiver_term = _start_term; diff --git a/src/v/raft/consensus.cc b/src/v/raft/consensus.cc index 800574934ff9f..510f7452b58b0 100644 --- a/src/v/raft/consensus.cc +++ b/src/v/raft/consensus.cc @@ -2462,7 +2462,7 @@ consensus::do_write_snapshot(model::offset last_included_index, iobuf&& data) { .latest_configuration = *config, .cluster_time = clock_type::time_point::min(), .log_start_delta = offset_translator_delta( - _log->delta(model::next_offset(last_included_index))()), + _log->offset_delta(model::next_offset(last_included_index))()), }; return details::persist_snapshot( diff --git a/src/v/raft/recovery_stm.cc b/src/v/raft/recovery_stm.cc index d8bbc996755e2..d60b9eb3d8cf0 100644 --- a/src/v/raft/recovery_stm.cc +++ b/src/v/raft/recovery_stm.cc @@ -490,7 +490,7 @@ recovery_stm::take_on_demand_snapshot(model::offset last_included_offset) { .last_included_term = *term, .latest_configuration = std::move(*cfg), .log_start_delta = offset_translator_delta( - _ptr->log()->delta(model::next_offset(last_included_offset))), + _ptr->log()->offset_delta(model::next_offset(last_included_offset))), }; co_await writer.write_metadata(reflection::to_iobuf(std::move(metadata))); diff --git a/src/v/raft/tests/raft_reconfiguration_test.cc b/src/v/raft/tests/raft_reconfiguration_test.cc index 0ebb56eddeae2..797cd89178250 100644 --- a/src/v/raft/tests/raft_reconfiguration_test.cc +++ b/src/v/raft/tests/raft_reconfiguration_test.cc @@ -145,14 +145,15 @@ void assert_offset_translator_state_is_consistent( std::vector deltas; for (model::offset o : boost::irange(start_offset, dirty_offset)) { - deltas.push_back(first_raft->log()->delta(o)); + deltas.push_back(first_raft->log()->offset_delta(o)); } for (auto it = std::next(nodes.begin()); it != nodes.end(); ++it) { auto idx = 0; for (model::offset o : boost::irange(start_offset, dirty_offset)) { - ASSERT_EQ(it->second->raft()->log()->delta(o), deltas[idx++]); + ASSERT_EQ( + it->second->raft()->log()->offset_delta(o), deltas[idx++]); } } } diff --git a/src/v/storage/disk_log_impl.cc b/src/v/storage/disk_log_impl.cc index 6f7f66fa6fb94..afa85f7a4bf71 100644 --- a/src/v/storage/disk_log_impl.cc +++ b/src/v/storage/disk_log_impl.cc @@ -1425,7 +1425,7 @@ bool disk_log_impl::is_new_log() const { && os.start_offset == not_initialized; } -model::offset_delta disk_log_impl::delta(model::offset o) const { +model::offset_delta disk_log_impl::offset_delta(model::offset o) const { return model::offset_delta{_offset_translator.state()->delta(o)}; } diff --git a/src/v/storage/disk_log_impl.h b/src/v/storage/disk_log_impl.h index d0eab3d4a1bd3..f1baceca065c0 100644 --- a/src/v/storage/disk_log_impl.h +++ b/src/v/storage/disk_log_impl.h @@ -116,7 +116,7 @@ class disk_log_impl final : public log { return _offset_translator.state(); } raft::offset_translator& offset_translator() { return _offset_translator; } - model::offset_delta delta(model::offset) const final; + model::offset_delta offset_delta(model::offset) const final; model::offset from_log_offset(model::offset) const final; model::offset to_log_offset(model::offset) const final; model::offset find_last_term_start_offset() const final; diff --git a/src/v/storage/log.h b/src/v/storage/log.h index 0e68ef4c23a29..8394dade42e3f 100644 --- a/src/v/storage/log.h +++ b/src/v/storage/log.h @@ -99,7 +99,7 @@ class log { virtual ss::future> timequery(timequery_config) = 0; - // Prefer to use delta() or from/to_log_offset(). + // Prefer to use offset_delta() or from/to_log_offset(). // TODO: remove direct access to the translator state and instead rely on // the translation/delta interface. virtual ss::lw_shared_ptr @@ -107,7 +107,7 @@ class log { // Returns the offset delta for a given offset. This can be used for // example to translate a Raft offset to a data offset. - virtual model::offset_delta delta(model::offset) const = 0; + virtual model::offset_delta offset_delta(model::offset) const = 0; // Translate the given log offset into a data offset. virtual model::offset from_log_offset(model::offset) const = 0;