-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[FIXED] Allow compress after restart #6444
Conversation
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
This mean that a 2.8.x system can not upgrade to 2.11 directly? |
Correct, would need to upgrade to 2.9.x or 2.10.x first. |
@kozlovic WDYT here? |
It seems acceptable to me to say we only support upgrading from 2.9 onward |
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
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.
@kozlovic WDYT here?
I usually try to keep backward compatibility as much as possible, but it is not un-heard of having to upgrade to intermediate versions in situations like that. 2.8.x in term of version number does not look that old, but it is true that it is several years old now and hopefully users have upgraded.
My only question would be, if users don't know and go from 2.8- to latest, in a rolling upgraded, will that mess-up datastores or simply that the nodes will fail to communicate? If it is the later, it is ok, they will realize that there is an issue and hopefully can quickly realize (from release notes) that they need to do incremental update. If the former, then that's not good.
} | ||
|
||
// Threshold for compression. | ||
// TODO(dlc) - Eventually make configurable. | ||
const compressThreshold = 8192 // 8k | ||
|
||
// If allowed and contents over the threshold we will compress. | ||
func encodeStreamMsgAllowCompress(subject, reply string, hdr, msg []byte, lseq uint64, ts int64, sourced bool, compressOK bool) []byte { | ||
func encodeStreamMsgAllowCompress(subject, reply string, hdr, msg []byte, lseq uint64, ts int64, sourced bool) []byte { |
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.
I would have then removed this function and keep the original encodeStreamMsg()
, except that encodeStreamMsg()
could have the comment that says that if the content is over the threshold, it will be compressed.
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.
I believe they will not be able to sync until all servers upgraded, should not do any data corruption.
A replicated stream can compress the data in proposals/catchup if all servers support it. However, if a stream already exists and the servers restart then compression would not be enabled, even though all servers support it.
This was due to the
compressOK
flag only being set upon becoming leader, which meant that if a quorum of servers comes online and the leader is elected before the final server comes online, compression will not be enabled until there is another leader election.We could re-calculate
compressOK
when a server comes online, but that could be expensive depending on the amount of servers and streams involved. Since compression has been added in v2.9.0 this means that all supported versions already support compression and there's no need to check. (Only 2.8.4 or earlier don't support it, but those are not supported versions anymore anyway and are ~3 years old at this point) So it's just simpler to clean it up and ensure compression can be used.Signed-off-by: Maurice van Veen github@mauricevanveen.com