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

YQ-3684 fix screts not found error handling #9822

Conversation

GrigoriyPA
Copy link
Collaborator

Changelog entry

...

Changelog category

  • New feature
  • Experimental feature
  • Improvement
  • Performance improvement
  • Bugfix
  • Backward incompatible change
  • Documentation (changelog entry is not required)
  • Not for changelog (changelog entry is not required)

Additional information

...

jepett0 and others added 30 commits March 6, 2024 16:23
…latform#1960) (ydb-platform#2479)

KIKIMR-21002

In this PR we add the following algorithm for invalidating cache entries for outdated VIEWs:

1. Store path ids and schema versions of the views that were used in the query in the cache entries, so they can be accessed later.
2. Whenever we retrieve a compilation result from cache, send a request for SchemeCache to check if the schema version of the views used in this query (if any) has not changed since we compiled this query.
3. Send a recompilation request if any view is outdated.

There are two important things to note about this solution:

- We make a SchemeCache request for each repeated query and there is a lot of these in an OLTP-focused database like YDB. However, we have already been sending these request for preliminary (this is not the last check of schema version mismatch (at least for tables)) cache invalidation for tables, so views should not incur an additional performance impact here.
- This solution does not guarantee strong consistency for queries using views, because query cache invalidation will not happen instantly after the view definition is updated. The node should get an update from the SchemeCache, which takes some time.
…ment (ydb-platform#2049) (ydb-platform#2595)

Based on: ydb-platform#2049

KIKIMR-20891

CREATE VIEW statement parses (and validates) the select statement saved in the view. It should be parsed in a context isolated from the statements executed before the CREATE VIEW statement (we haven't decided yet on the exact scope of the context of the view's select statement, see [KIKIMR-20656](https://st.yandex-team.ru/KIKIMR-20656)). It is pretty obvious that one should be able to execute the following statement in one go ("one go" = one press of a "run" button in YDB UI):
```sql
-- create view NecessaryInnerView with (security_invoker = true) as select 1;
-- create view ContextTestingView with (security_invoker = true) as select * from `/local/NecessaryInnerView`; -- where `/local/...` is your cluster name

drop view ContextTestingView;
create view ContextTestingView with (security_invoker = true) as select * from `/local/NecessaryInnerView`;
```

However, executing both drop view and create view in one go currently produces and error:
```
DropObject is not yet implemented for intent determination transformer
```
which indicates that the context of the inner query:
```sql
select * from `/local/NecessaryInnerView`
```
is polluted by the previous:
```sql
drop view ContextTestingView;
```
statement.

This problem is fixed by using an empty parsing context for parsing view's inner select statement during handling of CREATE VIEW statement.
Co-authored-by: Daniil Cherednik <dcherednik@ydb.tech>
Co-authored-by: spuchin <spuchin@ydb.tech>
GrigoriyPA and others added 20 commits August 19, 2024 08:08
)

Co-authored-by: Andrey Neporada <aneporada@ydb.tech>
@GrigoriyPA GrigoriyPA requested review from a team as code owners September 26, 2024 16:13
Copy link

🔴 Unable to merge your PR into the base branch. Please rebase or merge it with the base branch.

@GrigoriyPA GrigoriyPA closed this Sep 26, 2024
@GrigoriyPA GrigoriyPA deleted the merge-to-ydb-stable-YQ-3684-fix-screts-not-found-error branch September 26, 2024 16:13
@GrigoriyPA GrigoriyPA restored the merge-to-ydb-stable-YQ-3684-fix-screts-not-found-error branch September 26, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet