-
Notifications
You must be signed in to change notification settings - Fork 3.9k
rfc: how to upgrade clusters with enhanced view descriptors #17502
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
base: master
Are you sure you want to change the base?
Conversation
@danhhz if there are any considerations I'm missing about bulk I/O here, please chime in. |
8d610d0
to
bc0ed1d
Compare
bc0ed1d
to
b51f72a
Compare
Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. docs/RFCS/view_dependencies.md, line 200 at r1 (raw file):
I think we should do something like this, but instead of triggering it when the first node is started with 1.2 (as currently happens for the Comments from Reviewable |
I'm sorry for letting this slip, @knz. I'll be happy to take a look at it if you or anyone else gets the drive to finish it. |
it would be nice, also Toby has some thoughts on this topic. I'd be glad to receive more detailed technical input. However with my EOY schedule it will need to wait post-1.2 unfortunately. |
With the cluster migration system that's in place, this doesn't seem impossible to do. There are two pieces, namely getting onto the new version that uses the new views and, perhaps more difficult, getting to a point where the old code can be removed. Let's assume the new views are introduced in v1.5 (for sake of the example). So a cluster is running v1.4 before being upgraded, happily using the old views. To upgrade, the operator restarts the binary into v1.5 one after another. As long as the cluster version remains at 1.4, the new nodes will assume that all views follow the old code, i.e. have the SQL statement in the descriptor. In particular, creating a new view will create an old-style one. When the operator issues For creating new views, this just means that the code needs to be feature gated like this: func dummyCreateView() {
if !settings.IsActive(cluster.VersionBetterViews) {
return createOldStyleView()
}
return createBetterView()
} Upgrading the existing views comes with the slight problem that there's not necessarily anything that would trigger it today. This isn't really a problem until we want to get rid of the old code, which is discussed next. We can remove the old code once we know for a fact that a) no old view remains and b) no old view will be created in the future. b) is easier, but still not trivial. Nodes at a) is annoying but similarly solvable. Taking b) into account, we want to make sure that when the cluster is upgraded from v1.5 to v1.6, it does not leave an old-style view behind. So we want to add a pre-accept hook to the func bootServer() {
s := &Server{}
s.st.Version.RegisterPreHook(func(_ irrelevantStuff) error {
return s.sqlServer.upgradeAllOldStyleViews()
})
} Similarly, of course, we would upgrade any old view that is being touched so that views that are used are typically upgraded eagerly (so that users see the benefits on 1.5, not later): func codeThatReadsAView(view View) {
doStuff(view)
if isOldStyle(view) {
triggerConversionInBackground(view)
}
} So in short we have the following behavior:
For testing, the following plan comes to mind:
|
@mgartner @postamar @chengxiong-ruan same question as the other one. Can you check if there's anything salvageable here before i close this. Thanks |
Needed to solve #10023 / #10083.
Complement to #17501.