Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in CommitRecords? #64

Closed
vtolstov opened this issue Aug 22, 2021 · 6 comments
Closed

bug in CommitRecords? #64

vtolstov opened this issue Aug 22, 2021 · 6 comments

Comments

@vtolstov
Copy link
Contributor

https://pkg.go.dev/github.com/twmb/franz-go/pkg/kgo#Client.CommitRecords

GROUP           TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                               HOST            CLIENT-ID
test            test            14         113803          113804          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            6          70845           70846           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            17         83443           83444           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            20         92923           92924           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            29         115043          115044          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            23         91864           91865           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            24         163181          163182          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            11         126313          126314          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            10         26007           26008           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            28         49406           49407           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            19         189287          189288          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            0          143943          143944          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            7          47460           47461           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            18         293857          293858          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            22         78649           78650           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            25         130283          130284          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            5          139839          139840          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            8          229405          229406          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            1          177599          177600          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            26         143427          143428          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            27         227426          227427          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            13         48765           48766           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            4          205139          205140          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            30         217249          217250          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            16         118387          118388          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            9          183699          183700          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            3          227301          227302          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            21         91192           91193           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            12         180762          180763          1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            32         88184           88185           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            15         38668           38669           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            2          77828           77829           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
test            test            31         26093           26094           1               test-f556d15a-12a5-433d-af67-fe107b303a6b /172.18.0.1     test
@vtolstov
Copy link
Contributor Author

as you see lag always 1 and after i'm restart test last record always processed.

@vtolstov
Copy link
Contributor Author

i have such issue in other kafka driver (segmentio/kafka-go) when commit current record offset and not next offset.
https://kafka.apache.org/22/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html#:~:text=Note%3A%20The%20committed%20offset%20should,of%20the%20last%20message%20processed

can you check this? or i have may be error in my code (but i dont think so)
https://github.com/unistack-org/micro-broker-kgo/blob/master/kgo.go#L486 (this is my code, i'm simply run CommitRecords)

@vtolstov
Copy link
Contributor Author

@twmb i think you need to https://github.com/twmb/franz-go/blob/v0.10.1/pkg/kgo/consumer_group.go#L1687 add +1 to offset from record. in this case you don't have lag with 1 message and not double process last message each time

@vtolstov
Copy link
Contributor Author

i'm check my proposed solution and after r.Offset + 1 in 1687 lag goes to 0 and messages after restart not double processed

@vtolstov
Copy link
Contributor Author

fix #65

@twmb
Copy link
Owner

twmb commented Aug 22, 2021

Thank you, very obvious bug, great catch!

@twmb twmb closed this as completed Aug 22, 2021
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

No branches or pull requests

2 participants