redpanda-data / redpanda

Redpanda is a streaming data platform for developers. Kafka API compatible. 10x faster. No ZooKeeper. No JVM!
https://redpanda.com
9.51k stars 580 forks source link

Rpk should be able to fetch records with negative offset value for RRR topic #9812

Open daisukebe opened 1 year ago

daisukebe commented 1 year ago

Version & Environment

Redpanda version: (use rpk version): latest (rev b2cdb2e)

What went wrong?

RRR = Remote Read Replica

Consuming with a negative offsets in rpk doesn't work. It's hanging at this PollFetches call: https://github.com/redpanda-data/redpanda/blob/b2cdb2e/src/go/rpk/pkg/cli/cmd/topic/consume.go#L158

Works

rpk topic consume test
rpk topic consume test -o 10

Doesn't work

rpk topic consume test -o -3

Here's the debug log

18:37:34.374 [INFO] immediate metadata update triggered; why: querying metadata for consumer initialization
18:37:34.374 [DEBUG] opening connection to broker; addr: localhost:9093, broker: seed 0
18:37:34.375 [DEBUG] connection opened to broker; addr: localhost:9093, broker: seed 0
18:37:34.375 [DEBUG] issuing api versions request; broker: seed 0, version: 3
18:37:34.375 [DEBUG] wrote ApiVersions v3; broker: seed 0, bytes_written: 31, write_wait: 24.04µs, time_to_write: 11.351µs, err: <nil>
18:37:34.375 [DEBUG] read ApiVersions v3; broker: seed 0, bytes_read: 289, read_wait: 16.486µs, time_to_read: 35.518µs, err: <nil>
18:37:34.375 [DEBUG] connection initialized successfully; addr: localhost:9093, broker: seed 0
18:37:34.375 [DEBUG] wrote Metadata v7; broker: seed 0, bytes_written: 28, write_wait: 793.191µs, time_to_write: 15.015µs, err: <nil>
18:37:34.375 [DEBUG] read Metadata v7; broker: seed 0, bytes_read: 137, read_wait: 18.695µs, time_to_read: 20.47µs, err: <nil>
18:37:34.375 [INFO] assigning partitions; why: new assignments from direct consumer, how: assigning everything new, keeping current assignment, input: test[0{-1-3 e-1 ce0}]
18:37:34.375 [DEBUG] assign requires loading offsets
18:37:34.375 [DEBUG] offsets to load broker; broker: 1, load: {map[test:map[0:{-1-3 e-1 ce1}]] map[]}
18:37:34.375 [DEBUG] opening connection to broker; addr: 0.0.0.0:9093, broker: 1
18:37:34.375 [DEBUG] connection opened to broker; addr: 0.0.0.0:9093, broker: 1
18:37:34.375 [DEBUG] issuing api versions request; broker: 1, version: 3
18:37:34.375 [DEBUG] wrote ApiVersions v3; broker: 1, bytes_written: 31, write_wait: 3.199µs, time_to_write: 11.607µs, err: <nil>
18:37:34.375 [DEBUG] read ApiVersions v3; broker: 1, bytes_read: 289, read_wait: 9.368µs, time_to_read: 37.938µs, err: <nil>
18:37:34.375 [DEBUG] connection initialized successfully; addr: 0.0.0.0:9093, broker: 1
18:37:34.375 [DEBUG] wrote ListOffsets v4; broker: 1, bytes_written: 52, write_wait: 149.994µs, time_to_write: 5.023µs, err: <nil>
18:37:34.375 [DEBUG] wrote ListOffsets v4; broker: 1, bytes_written: 52, write_wait: 159.872µs, time_to_write: 2.768µs, err: <nil>
18:37:34.375 [DEBUG] read ListOffsets v4; broker: 1, bytes_read: 52, read_wait: 14.976µs, time_to_read: 31.045µs, err: <nil>
18:37:34.375 [DEBUG] read ListOffsets v4; broker: 1, bytes_read: 52, read_wait: 50.875µs, time_to_read: 9.219µs, err: <nil>
18:37:34.375 [DEBUG] handled list results; broker: 1, using: map[test:map[0:{15 1}]], reloading: map[]
18:37:34.375 [DEBUG] opening connection to broker; addr: 0.0.0.0:9093, broker: 1
18:37:34.375 [DEBUG] connection opened to broker; addr: 0.0.0.0:9093, broker: 1
18:37:34.375 [DEBUG] connection initialized successfully; addr: 0.0.0.0:9093, broker: 1
18:37:34.375 [DEBUG] wrote Fetch v11; broker: 1, bytes_written: 90, write_wait: 82.648µs, time_to_write: 9.946µs, err: <nil>

What should have happened instead?

Should be able to consume the latest 3 offsets in the above example

How to reproduce the issue?

  1. Create a RRR topic
  2. Consume with -o -3 in rpk

JIRA Link: CORE-1239

twmb commented 1 year ago

Relabeling as redpanda bug; this works locally against a non-rrr topic.

github-actions[bot] commented 2 months ago

This issue hasn't seen activity in 3 months. If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in two weeks.