Alina Shestakova created SAMZA-2802:
---------------------------------------
Summary: Error in fetch metadata of empty topic
Key: SAMZA-2802
URL: https://issues.apache.org/jira/browse/SAMZA-2802
Project: Samza
Issue Type: Bug
Components: kafka
Environment: pr [https://github.com/apache/samza/pull/1710]
In this PR if-else block was added to don't subtract 1 from the ending offset
when its equal to the beginning offset.
Reporter: Alina Shestakova
In the situation when a topic is empty, but not new (begin offset == end offset
!= 0) in _fetchTopicPartitionsMetadata_ we subtract 1 from the end offset:
{{newestOffsets.put(KafkaUtil.toSystemStreamPartition(this.systemName,
topicPartition), String.valueOf(offset - 1L));}}
and later in {_}validateRestoreOffsets{_}:
{code:java}
String startingOffset = restoreOffsets.startingOffset;
String endingOffset = restoreOffsets.endingOffset;
if (endingOffset != null) {
Preconditions.checkState(systemAdmin.offsetComparator(endingOffset,
startingOffset) >= 0, String.format("Ending offset: %s must be equal to or
greater than starting offset: %s", endingOffset, startingOffset));
} {code}
{{ }}
we get endingOffset < startingOffset because of subtraction of 1 in
{_}fetchTopicPartitionsMetadata{_}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)