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

cache: add TTL support #1

Merged
merged 8 commits into from
Jan 6, 2022

Conversation

GiedriusS
Copy link

Adds TTL support to galaxycache as per this pull request:
thanos-community/galaxycache#1

Signed-off-by: Giedrius Statkevičius [email protected]

With these changes:

Running tool: /bin/go test -timeout 30s -run ^TestStoreGatewayGroupCache$ github.com/thanos-io/thanos/test/e2e

ok  	github.com/thanos-io/thanos/test/e2e	17.022s

config, err := parseGroupcacheConfig(conf)
if err != nil {
return nil, err
}

return NewGroupcacheWithConfig(logger, reg, config, basepath, r, bucket)
return NewGroupcacheWithConfig(logger, reg, config, basepath, r, bucket, isTSDBChunkFile, isMetaFile, isBlocksRootDir, MetaFileExistsTTL, MetafileDoesntExistTTL, MetafileContentTTL, ChunkObjectAttrsTTL, ChunkSubrangeTTL, BlocksIterTTL)
Copy link
Author

Choose a reason for hiding this comment

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

It would be cool if our struct had an interface like this to avoid passing so many parameters:
https://github.com/thanos-io/thanos/blob/main/pkg/store/cache/caching_bucket_factory.go#L109-L114

if isBlocksRootDir(parsedData.Name) {
return dest.UnmarshalBinary(encodedList, time.Now().Add(BlocksIterTTL))
}
panic("caching bucket layer must not call on unconfigured paths")
Copy link
Owner

Choose a reason for hiding this comment

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

I was under the impression we should never use panic. Shouldn't we be returning an error instead of panicking?

Copy link
Author

Choose a reason for hiding this comment

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

I think that using panics to check for logic bugs in code is one of the very few valid use cases for it 😄

@akanshat
Copy link
Owner

@GiedriusS Can you please rebase and resolve the conflict?

Adds TTL support to galaxycache as per this pull request:
thanos-community/galaxycache#1

Signed-off-by: Giedrius Statkevičius <[email protected]>
@GiedriusS
Copy link
Author

@akanshat rebased 👼 hopefully we can work on improving the interface now! Then we could merge this ❤️

@GiedriusS
Copy link
Author

Let's merge this now as well? @akanshat :shipit:

@akanshat akanshat merged commit a8ba37f into akanshat:groupcache_caching_bucket Jan 6, 2022
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