ydb-platform / ydb-go-sdk

Pure Go native and database/sql driver for YDB
https://ydb.tech
Apache License 2.0
136 stars 71 forks source link

bug: topicWriter.WaitInitInfo and WithWriterSetAutoSeqNo(false) return -1 as LastSeqNum #1011

Closed rekby closed 7 months ago

rekby commented 7 months ago

Bug Report

YDB GO SDK version: 3.55.0

topicWriter.WaitInitInfo(...) always return LastSeqNum == -1 if topicwriter starts with option WithWriterSetAutoSeqNo(false)

size12 commented 7 months ago

Hi, do you think that it is really bug? topicWriter.WaitInitInfo(...) returns InitInfo which contains only LastSeqNum field. This object edits once, when writer initializes.

image

And when topicWriter.WaitInitInfo(...) called, writer will always return same object with same values; Also there is a test, which says that info object should be idempotent

image

I see solution in writing function as example GetLastSeqNo, which will return actual sequence number. What do you think?

klenovda commented 7 months ago

In my case I need to deduplicate messages based on their seqNo, and I'm managing its value myself. At the moment, I'm obtaining information either through the WaitInitInfo() method or the deprecated topicoptions.WithOnWriterFirstConnected() method, where the seqNo is consistently -1.

For my use case, it would be beneficial to have methods like GetLastSeqNo() or GetInfo() implemented.