Skip to content

Commit

Permalink
registry: Remove from custom_type_dependencies when removing expr
Browse files Browse the repository at this point in the history
In order to maintain the invariant that everything in the values of
`ExprRegistry::custom_type_dependencies` references a query that exists,
we need to remove queries from those values when removing expressions.

Release-Note-Core: Fixed an issue where ReadySet would crash when
  replicating an ALTER TYPE statement referencing a type that was
  mentioned in a column of a dropped table.
Fixes: ENG-2763
Change-Id: I7e425d32a2c887466814b0cc06a997b8d49fc361
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/4594
Tested-by: Buildkite CI
Reviewed-by: Nick Marino <nick@readyset.io>
  • Loading branch information
glittershark committed Mar 27, 2023
1 parent d267232 commit abacf64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion readyset-psql/tests/fallback.rs
Expand Up @@ -681,7 +681,6 @@ async fn rename_column_then_create_view() {

#[tokio::test(flavor = "multi_thread")]
#[serial]
#[ignore = "ENG-2763 Test causes server panic and hangs due to known bug"]
async fn alter_enum_after_drop() {
readyset_tracing::init_test_logging();

Expand Down
4 changes: 4 additions & 0 deletions readyset-server/src/controller/sql/registry.rs
Expand Up @@ -512,6 +512,10 @@ impl ExprRegistry {
self.expressions.remove(dependency_id);
}
}
for deps in self.custom_type_dependencies.values_mut() {
deps.remove(&query_id);
}

// If we have only removed a reused cache, there is nothing else to clean up because the
// expression does not exist in the graph.
if removed_reused_cache.any(|name| expr_aliases.contains(&name)) {
Expand Down

0 comments on commit abacf64

Please sign in to comment.