-
Notifications
You must be signed in to change notification settings - Fork 472
Give a notice when dropping an in-use index #21706
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,90 @@ | ||
# Test various NOTICE expectations. | ||
|
||
send | ||
Query {"query": "create table t(a int, b int)"} | ||
Query {"query": "create index t_idx_a on t(a)"} | ||
Query {"query": "create materialized view mv1 as select * from t where b=7"} | ||
Query {"query": "create view v1 as select * from t union select * from t"} | ||
Query {"query": "create index v1_idx_a on v1(a)"} | ||
Query {"query": "drop index v1_idx_a"} | ||
Query {"query": "drop index t_idx_a"} | ||
Query {"query": "drop materialized view mv1"} | ||
Query {"query": "create index v1_idx_a on v1(a)"} | ||
Query {"query": "create materialized view mv2 as select * from t where a=5"} | ||
Query {"query": "drop index v1_idx_a"} | ||
Query {"query": "drop materialized view mv2"} | ||
Query {"query": "create index t_idx_a on t(a)"} | ||
Query {"query": "create materialized view mv2 as select * from t where a=5"} | ||
Query {"query": "drop index t_idx_a"} | ||
Query {"query": "create index t_idx_a on t(a)"} | ||
Query {"query": "create index v1_idx_a on v1(a)"} | ||
Query {"query": "drop index t_idx_a"} | ||
Query {"query": "drop index v1_idx_a"} | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
ReadyForQuery | ||
---- | ||
CommandComplete {"tag":"CREATE TABLE"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE MATERIALIZED VIEW"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE VIEW"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"DROP INDEX"} | ||
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.mv1. The index will be dropped from the catalog, but it will continue to be maintained and take up resources!"}]} | ||
CommandComplete {"tag":"DROP INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"DROP MATERIALIZED VIEW"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE MATERIALIZED VIEW"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"DROP INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"DROP MATERIALIZED VIEW"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE INDEX"} | ||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
CommandComplete {"tag":"DROP INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"CREATE INDEX"} | ||
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.v1_idx_a. The index will be dropped from the catalog, but it will continue to be maintained and take up resources!"}]} | ||
CommandComplete {"tag":"DROP INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
CommandComplete {"tag":"DROP INDEX"} | ||
ReadyForQuery {"status":"I"} | ||
|
||
# Test setting session variables to nonexistant values | ||
# Scenarios tested: nonexistant values, exstant values, capitalized variables | ||
# double quotes, single quotes, default values | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
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?
Uh oh!
There was an error while loading. Please reload this page.
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
in order to also cover #20725.
Uh oh!
There was an error while loading. Please reload this page.
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!"