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

Invalidate query compilation cache entries with outdated VIEWs (#1960) #2479

Merged
merged 1 commit into from
Mar 6, 2024

Commits on Mar 6, 2024

  1. Invalidate query compilation cache entries with outdated VIEWs (ydb-p…

    …latform#1960)
    
    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.
    jepett0 committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    4d6c290 View commit details
    Browse the repository at this point in the history