SourceLabOrg/kafka-webview

On View page, the "previous button" jump is twice as big as the "next button" jump.

Closed this issue · 1 comments

Hi

I've stumbled a surprising behavior while browsing the View page.
There are 4 buttons at the bottom, including "previous" and "next".

Clicking "next" jump to the next 10 items, meanwhile "previous" jump to the previous 20 items.

It is confirmed by the * 2 in the code:

long newOffset = currentOffset - (clientConfig.getMaxResultsPerPartition() * 2);

It is by design or should it be considered a bug?

Crim commented

I believe this is by design. Imagine the following scenario:

  • Load page 1 from HEAD of the topic. Offsets go from 0 -> 9 (10 entries). Position is now at offset 10.
  • Click Next, page 2 has offsets from 10->19. Position is now at offset 20.

If you click Previous on this page, and subtract 10, you'd get a starting offset of 10, and re-display the same page of messages 10-19. Instead you need to subtract 2x the page size to get the previous page.

Hope this makes sense.