Skip to content

Conversation

@fraidev
Copy link
Contributor

@fraidev fraidev commented Apr 9, 2025

Should solve #4325

@fraidev fraidev changed the title wip fix: consumer offset end Apr 9, 2025
@fraidev fraidev force-pushed the fix_consumer_offset_end branch 10 times, most recently from a1f17e9 to 453bda7 Compare April 10, 2025 23:26
@fraidev fraidev marked this pull request as ready for review April 11, 2025 02:01
@fraidev fraidev requested review from digikata and sehz April 11, 2025 02:01
debug!(consumer_id, consumer_offset, "consumer offset");
partition_response.start_offset = consumer_offset + 1;
partition_response.consumer_offset = Some(consumer_offset + 1);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have integration test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some tests at crates/fluvio-test/src/tests/consumer_offsets/ that should cover it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or do you mean another kind of integration test?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's E2E tests, good job on there.

The integration test should go here: https://github.com/infinyon/fluvio/tree/master/crates/fluvio-spu/src/services/public/tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added integration test

@fraidev fraidev force-pushed the fix_consumer_offset_end branch from 453bda7 to 3f426be Compare April 11, 2025 02:33
@fraidev fraidev force-pushed the fix_consumer_offset_end branch from 3f426be to 6b5366b Compare April 11, 2025 02:46

/// Last committed consumer offset
#[fluvio(min_version = 24)]
pub consumer_offset: Option<i64>,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. There is already FetchConsumerOffsetsRequest ? Why is needed here?

Copy link
Contributor Author

@fraidev fraidev Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only requested when the stream is created, we can also change to request FetchConsumerOffsetsRequest there, but it will need 2 requests.

As we were handling consumer offset directly at start_offset of FetchOffsetPartitionResponse, I kept with it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use FetchConsumerOffsetsRequest. otherwise we have to maintain at two different places. Making 2 requests are fine as this is only at beginning.

Copy link
Contributor Author

@fraidev fraidev Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that FetchConsumerOffsetsRequest return all consumers and doesn't have parameters for filtering.
Do you still think that is better use it? If yes, should we add a parameter to filter the replica/consumer_id that we want in the request or in memory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is ok use FetchOffsetsRequest as it has consumer_id as a parameter already.
Also is filtered by replica and consumer_id.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We solve it in the client, so I think it makes sense to return the consumer offset state separately from the start/end of the topic.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem is that semantics is unclear. Maybe then logic should be into the SPU consumer processing not at client.

I would expect that when I get offset, it is valid. SPU should make sure it's always valid

Copy link
Contributor Author

@fraidev fraidev Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, I can change back to just changing the start_offset, but sending in the fetch request the offset (begin, end, ...), and resolve it on SPU.
What do you think?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already has following info:

  /// First readable offset.
    pub start_offset: i64,

    /// Last readable offset
    pub last_stable_offset: i64,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to send two requests on stream creation.
One for topic offset and another one for the consumer_offset.
We're not handling it via forwarding now.

@fraidev fraidev force-pushed the fix_consumer_offset_end branch from 6b5366b to 0c5cc26 Compare April 11, 2025 02:59
@fraidev fraidev requested a review from sehz April 11, 2025 03:06
@fraidev fraidev force-pushed the fix_consumer_offset_end branch 3 times, most recently from d5f240b to eae8f7a Compare April 14, 2025 20:23
@fraidev fraidev force-pushed the fix_consumer_offset_end branch from eae8f7a to 2f40a6d Compare April 15, 2025 02:43
@fraidev fraidev force-pushed the fix_consumer_offset_end branch from 8772bf3 to d9efb09 Compare April 15, 2025 21:23
@fraidev fraidev requested a review from digikata April 15, 2025 21:25
@fraidev fraidev force-pushed the fix_consumer_offset_end branch 2 times, most recently from f772120 to e9e5b74 Compare April 16, 2025 20:30
@fraidev fraidev requested a review from sehz April 16, 2025 21:00
Copy link

@sehz sehz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good job

@fraidev fraidev force-pushed the fix_consumer_offset_end branch from e9e5b74 to 0466704 Compare April 16, 2025 22:38
@fraidev fraidev enabled auto-merge April 16, 2025 22:43
@fraidev fraidev added this pull request to the merge queue Apr 16, 2025
Merged via the queue into fluvio-community:master with commit 369b130 Apr 16, 2025
103 checks passed
@fraidev fraidev deleted the fix_consumer_offset_end branch April 16, 2025 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants