-
Notifications
You must be signed in to change notification settings - Fork 468
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
Give a notice when dropping an in-use index #21706
Conversation
13c7ffc
to
915fe60
Compare
cd8f6e1
to
b257446
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.
Thanks!
index_name, | ||
dependant_objects, | ||
}) => { | ||
write!(f, "The dropped index {index_name} is being used by the following objects: {}. The index will be dropped from the catalog, but it will continue to be maintained and take up resources!", separated(", ", dependant_objects)) |
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.
Should we also say something about the fact that the index will cease to exist on next restart?
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 hint()
for this notice variant mentions this.
We discussed this and this seems the fact that we re-plan during the maintenance window is incidental, so I'm not sure if we should mention this here.
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 hint says
"To free up the resources used by the index, recreate all the above-mentioned objects."
We were thinking with Alex to not emphasize the maintenance window restart too much, because it's just an incidental thing, e.g., it might not occur if there is no release on a certain week. Also, we don't want users waiting for the maintenance window with the replanning, because then if the index disappearing creates a performance problem then we'd get confused whether it was the version upgrade or just an index being dropped.
But I'm planning to open a follow-up PR with adding docs for these notices, and there I will probably mention this anyway.
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 agree about not mentioning the maintenance window here. It would be weird to have the database code make assumptions about how we operate Materialize.
We could mention Materialize restarts in a generic way (which is what Brennan suggested I think) but then there is nothing actionable the user can do with that information, so I don't see how it would be useful.
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 think it's important for the user to be aware that at some point in the future, outside of their control, the objects using this index will become less efficient as they will no longer have access to the index. We don't need to specifically mention maintenance windows, I guess.
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.
Well, I can imagine this happening, unfortunately.
This seems like an anti-pattern. Until we implement plan pinning as a feature that is enabled by default for every installed materialized view and index dataflow, users should not rely on their plans being stable across restarts, especially if they change the environment in the meantime.
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 agree that users should not be relying on this, but unfortunately I think some will rely on it unless we explicitly teach them not to.
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.
Ok, so what should be the wording? This is the current wording:
"The dropped index {index_name} is being used by the following objects: {}. The index will be dropped from the catalog, but it will continue to be maintained and take up resources!"
we could instead have
"The dropped index {index_name} is being used by the following objects (until they are dropped or Materialize is restarted): {}. The index is now dropped from the catalog, but it will continue to be maintained and take up resources!"
What do you all think?
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 suggest
until they are dropped, altered or Materialize is restarted
in order to also cover #20725.
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've opened a PR with the following:
"The dropped index {index_name} is being used by the following objects: {}. The index is now dropped from the catalog, but it will continue to be maintained and take up resources until all dependent objects are dropped, altered, or Materialize is restarted!"
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.
Some minor nits, otherwise looks good.
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE MATERIALIZED VIEW"} | ||
ReadyForQuery {"status":"I"} | ||
NoticeResponse {"fields":[{"typ":"S","value":"NOTICE"},{"typ":"C","value":"01000"},{"typ":"M","value":"The dropped index materialize.public.t_idx_a is being used by the following objects: materialize.public.mv2. The index will be dropped from the catalog, but it will continue to be maintained and take up resources!"}]} |
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'm not sure what the difference in the setup between the two notices is. Can we have one which tests the "index being used in the dataflow maintaining another index" path?
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.
Done
index_name, | ||
dependant_objects, | ||
}) => { | ||
write!(f, "The dropped index {index_name} is being used by the following objects: {}. The index will be dropped from the catalog, but it will continue to be maintained and take up resources!", separated(", ", dependant_objects)) |
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 hint()
for this notice variant mentions this.
We discussed this and this seems the fact that we re-plan during the maintenance window is incidental, so I'm not sure if we should mention this here.
b257446
to
41d348e
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, just a couple nits!
index_name, | ||
dependant_objects, | ||
}) => { | ||
write!(f, "The dropped index {index_name} is being used by the following objects: {}. The index will be dropped from the catalog, but it will continue to be maintained and take up resources!", separated(", ", dependant_objects)) |
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 agree about not mentioning the maintenance window here. It would be weird to have the database code make assumptions about how we operate Materialize.
We could mention Materialize restarts in a generic way (which is what Brennan suggested I think) but then there is nothing actionable the user can do with that information, so I don't see how it would be useful.
41d348e
to
486d068
Compare
486d068
to
daca983
Compare
This is the first step of addressing https://github.com/MaterializeInc/database-issues/issues/6111: We give a notice when the user drops an index that is in use.
I'm planning to open a follow-up PR that will add some documentation about this situation, and will link to that in the notice message.
Note that the computation of
reverse_compute_dependencies
is not very efficient, because it goes through all collections. But we decided with Jan that this is ok, and it's not worth it to make it more complicated for efficiency, because this should still take less than 1 ms, and dropping an index is not performance critical.Motivation
Tips for reviewer
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way), then it is tagged with aT-proto
label.