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
Allow switching from limits-based to interest-based retention in stream update #4361
Conversation
// retention then we will need to check the ack floor of all consumers. | ||
if ocfg.Retention != cfg.Retention && cfg.Retention == InterestPolicy { | ||
toUpdate := make([]*consumer, 0, len(mset.consumers)) | ||
for _, c := range mset.consumers { |
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.
One important piece, if the consumer is retention interest, then its replication factor must be same as stream, so need to adjust that here and add in an R1 consumer to the test above etc.
c.retention = cfg.Retention | ||
c.mu.Unlock() | ||
if c.retention == InterestPolicy { | ||
c.checkStateForInterestStream() |
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.
Nice! I saw this and was confused for a second then realized what you did here..
t.Helper() | ||
if bytes.Equal(a[:], b[:]) { | ||
t.Fatalf("require not equal, but got: %v != %v", a, b) | ||
if a == b { |
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.
Will this do the right thing for 2 different byte slices that have same contents?
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.
The function was previously taking a, b [32]byte
and fixed-size arrays can be compared using ==
, so it will continue to work for what it was being used for.
Trying to pass in slices instead of fixed-size arrays will result in a compile-time error as they are not comparable
.
fc4ea1c
to
8168aa2
Compare
62537ec
to
d752c76
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
…am update Signed-off-by: Neil Twigg <neil@nats.io>
d752c76
to
d7f76da
Compare
This should make it possible to switch from limits-based retention to interest-based retention on an existing stream.
Signed-off-by: Neil Twigg neil@nats.io