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

Bugfix: Deleting a referenced class panics on GQL schema rebuild #2189

Merged
merged 4 commits into from
Sep 12, 2022

Conversation

parkerduckworth
Copy link
Member

@parkerduckworth parkerduckworth commented Sep 8, 2022

When a class is deleted from weaviate which is referenced as a ref prop by another class, and the graphql schema is rebuilt, it panics, resulting in a total loss of GQL provider.

With this patch, all of these offending ref props are skipped during schema rebuild. This means no panic, and all other properties of the class containing these invalid ref prop(s) can still be queried.

What's being changed:

  • Added error ErrRefToNonexistentClass so the local get builder knows with certainty when the *Schema.FindPropertyDataType is failing for this reason
  • When this error is encountered, the GQL schema rebuilding doesn't panic, resulting in a total loss of GQL provider, but skips adding the offending property to the GQL schema and continues building the schema
  • Log a warning in the event of this situation, explaining which property was skipped, for which class, and the name of the nonexistent class that the property references
  • Added tests

Review checklist

  • Documentation has been updated, if necessary. Link to changed documentation:
  • Chaos pipeline run or not necessary. Link to pipeline:
  • All new code is covered by tests where it is reasonable.
  • Performance tests have been run or not necessary.

@codecov
Copy link

codecov bot commented Sep 8, 2022

Codecov Report

Merging #2189 (dd23bcb) into master (579f673) will increase coverage by 0.04%.
The diff coverage is 78.37%.

@@            Coverage Diff             @@
##           master    #2189      +/-   ##
==========================================
+ Coverage   68.27%   68.31%   +0.04%     
==========================================
  Files         495      495              
  Lines       40264    40340      +76     
==========================================
+ Hits        27489    27560      +71     
- Misses      10690    10691       +1     
- Partials     2085     2089       +4     
Flag Coverage Δ
integration 69.67% <ø> (+0.16%) ⬆️
unittests 68.31% <78.37%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...apters/handlers/graphql/local/get/class_builder.go 90.09% <0.00%> (-5.15%) ⬇️
entities/schema/backward_compat.go 85.71% <ø> (ø)
adapters/handlers/rest/embedded_spec.go 100.00% <100.00%> (ø)
entities/backup/descriptor.go 100.00% <100.00%> (ø)
entities/schema/data_types.go 40.27% <100.00%> (ø)
usecases/backup/handler.go 84.44% <100.00%> (+0.26%) ⬆️
entities/schema/schema.go 45.45% <0.00%> (-18.19%) ⬇️
adapters/repos/db/vector/hnsw/flat_search.go 61.76% <0.00%> (-8.83%) ⬇️
adapters/repos/db/shard_write_batch_objects.go 76.60% <0.00%> (-2.34%) ⬇️
usecases/objects/auto_schema.go 88.88% <0.00%> (-1.36%) ⬇️
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@parkerduckworth parkerduckworth merged commit e47f256 into master Sep 12, 2022
@parkerduckworth parkerduckworth deleted the bugfix/WEAVIATE-320-gql-schema-rebuild branch September 12, 2022 15:06
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