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

feat: enable cache for external tables using a cache control on metrics views #6265

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

k-anshul
Copy link
Member

@k-anshul k-anshul commented Dec 12, 2024

No description provided.

@k-anshul k-anshul self-assigned this Dec 12, 2024
proto/rill/runtime/v1/resources.proto Outdated Show resolved Hide resolved
runtime/compilers/rillv1/parse_metrics_view.go Outdated Show resolved Hide resolved
runtime/compilers/rillv1/parse_metrics_view.go Outdated Show resolved Hide resolved
runtime/metricsview/executor.go Outdated Show resolved Hide resolved
runtime/query.go Show resolved Hide resolved
runtime/query.go Outdated Show resolved Hide resolved
runtime/reconcilers/metrics_view.go Outdated Show resolved Hide resolved
runtime/reconcilers/metrics_view.go Outdated Show resolved Hide resolved
runtime/server/batch_query_test.go Outdated Show resolved Hide resolved
runtime/metricsview/executor.go Outdated Show resolved Hide resolved
runtime/metricsview/executor.go Outdated Show resolved Hide resolved
runtime/query.go Outdated Show resolved Hide resolved
return nil, false, nil
}

hasher := md5.New()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is already being hashed in runtime/resolver.go so could we return the full pointer here?

Copy link
Member Author

Choose a reason for hiding this comment

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

The values were already being hashed in the older implementation :

func (r *metricsResolver) Key() string {

Since the key is now composed of two things (cache_key and query) I thought of just using a md5 hasher.
Do you mean we create a new struct and just return any from CacheKey instead of bytes ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just meant if one way or another it could use the same hasher – e.g. it might return a combined []byte or a *drivers.Result, or accept a io.Writer, or something like that.

It's not an important comment, certainly you shouldn't do anything weird to achieve this (like returning a struct would probably be weird). Just wondered if there was a clean way to have just one hasher.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay. Added another way to compute key without hasher.

runtime/resolvers/metricsview_cache_key.go Outdated Show resolved Hide resolved
runtime/resolvers/metricsview_cache_key.go Outdated Show resolved Hide resolved
runtime/resolvers/metricsview_cache_key.go Outdated Show resolved Hide resolved
runtime/resolvers/metricsview_cache_key.go Outdated Show resolved Hide resolved
runtime/resolvers/metricsview_cache_key.go Outdated Show resolved Hide resolved
runtime/resolvers/sql.go Outdated Show resolved Hide resolved
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