Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private Long currentOffset(TopicPartition topicPartition) {
public Map<TopicPartition, OffsetAndMetadata> currentOffsets() {
Map<TopicPartition, OffsetAndMetadata> snapshot = Maps.newHashMapWithExpectedSize(currentOffsets.size());
currentOffsets.forEach((topicPartition, offset) -> {
if (offset > 0) {
if (offset >= 0) {
snapshot.put(topicPartition,
new OffsetAndMetadata(offset, Optional.empty(), null));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,10 @@ public void offsetTest() throws Exception {

// offset is 0 for the first written record
assertEquals(sink.currentOffset(topicName, partition), 0);
// current offsets map returned by the PulsarKafkaSinkTaskContext should contain the record with offset 0
assertEquals(
sink.taskContext.currentOffsets().get(new TopicPartition(topicName, partition)).offset(), 0
);

entryId.set(1);
sink.write(record);
Expand Down