The current implementation of getLastRecord in RecordRepository only works if a topic has more than one record. For topics only one record there is, no result because the code does endOffset - 2 and then performs a single poll. If the partition only contains one record, this logic skips it.
Steps to Reproduce:
- Create a topic with only one partition.
- Produce a single message to that topic.
- Call get /api/{cluster}/topic/last-record for said record
- Empty response returned