Skip to content
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

coord,sql: fix some table buglets #3992

Merged
merged 3 commits into from
Aug 20, 2020
Merged

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Aug 19, 2020

The first commit is a follow-up from #3982 which I forgot to push before merging. The second commit ensures that a table's default index is not dropped, which came up in #3982 and is tracked in MaterializeInc/database-issues#1213. The third commit is another table bug I discovered that I didn't bother filing an issue for.

I believe the only remaining issue before marking tables non-experimental is MaterializeInc/database-issues#1226. We're good to go after this, I believe!


This change is Reviewable

///
/// Panics if `id` does not exist, or if `id` is not an object on which
/// indexes can be built.
pub fn default_index_for(&self, id: GlobalId) -> Option<GlobalId> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is much clearer, thanks!

Is the selection of the default index something we plan on improving later on?

@@ -2026,7 +2026,7 @@ where
return;
}
// A valid index is any index on `id` that is known to the dataflow
// layer, as indicated by its presence in `self.indexes`.
// layer, as indicated by its presence in `self.indexes`.s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The s snuck back in!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh! Thanks!

@@ -976,7 +988,20 @@ impl Catalog {
}]
}
Op::DropItem(id) => {
if !self.get_by_id(&id).item().is_temporary() {
let entry = self.get_by_id(&id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@@ -1806,6 +1806,16 @@ fn handle_insert(
match source {
InsertSource::Query(query) => {
let table = scx.catalog.get_item(&scx.resolve_item(table_name)?);
if table.id().is_system() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - nice catch!

...without dropping the table too, at least. Unlike sources, where an
unmaterialized source is reasonable, tables are implicitly always
materialized, since Materialize is the source of truth.

Fix #3905.
@benesch benesch merged commit cb8ad93 into MaterializeInc:main Aug 20, 2020
@benesch benesch deleted the table-buglets branch August 20, 2020 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants