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
Add first_seq
to StreamConfig
#4322
Conversation
first_seq
to StreamConfig
for file storefirst_seq
to StreamConfig
ms.mu.Lock() | ||
purged := uint64(len(ms.msgs)) | ||
cb := ms.scb | ||
bytes := int64(ms.state.Bytes) | ||
ms.state.FirstSeq = ms.state.LastSeq + 1 | ||
ms.state.FirstSeq = fseq |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to formalize this in case first is not > last.
So stream of 1-100, purge to 50..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And in that case you can't just wipe the ms.msgs. Or you could error in memory store for partial purge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I'll go with erroring on partial purge, as I think the only alternative is to iterate through the entire ms.msgs
map and check for lower sequences.
Signed-off-by: Neil Twigg <neil@nats.io>
Signed-off-by: Neil Twigg <neil@nats.io>
903360d
to
4d8d019
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
544e4c2
to
89f207c
Compare
Signed-off-by: Neil Twigg <neil@nats.io>
89f207c
to
65cb4b9
Compare
Is this something we want user facing or keep for development? ie. Should I add it to the CLI? |
Customer requested, so probably yes to add in CLI. |
I think we should prevent mirrors being added with custom first sequences as if you make it bigger than the seq of the source stream it will not work - I guess till the source stream reaches that seq? wdyt? |
We should also fail if someone tries to edit this property as it doesnt work anyway |
It should fail if you try to use that option on a stream that is a mirror IMHO. |
This allows specifying
first_seq
in the stream config when creating a stream.Signed-off-by: Neil Twigg neil@nats.io