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

[refactor][storage][badger]Refactored the prefilling of cache to reader #6575

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

Conversation

Manik2708
Copy link
Contributor

Which problem is this PR solving?

Comment: #6376 (comment)

Description of the changes

  • Refactoring the cache prefill to reader

How was this change tested?

  • Unit and e2e tests

Checklist

@Manik2708 Manik2708 requested a review from a team as a code owner January 20, 2025 19:08
@dosubot dosubot bot added the storage/badger Issues related to badger storage label Jan 20, 2025
Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.24%. Comparing base (04b1ea4) to head (855be18).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6575   +/-   ##
=======================================
  Coverage   96.23%   96.24%           
=======================================
  Files         373      373           
  Lines       21406    21404    -2     
=======================================
  Hits        20600    20600           
+ Misses        614      612    -2     
  Partials      192      192           
Flag Coverage Δ
badger_v1 10.62% <39.28%> (-0.02%) ⬇️
badger_v2 2.77% <0.00%> (+<0.01%) ⬆️
cassandra-4.x-v1-manual 16.59% <0.00%> (+<0.01%) ⬆️
cassandra-4.x-v2-auto 2.71% <0.00%> (+<0.01%) ⬆️
cassandra-4.x-v2-manual 2.71% <0.00%> (+<0.01%) ⬆️
cassandra-5.x-v1-manual 16.59% <0.00%> (+<0.01%) ⬆️
cassandra-5.x-v2-auto 2.71% <0.00%> (+<0.01%) ⬆️
cassandra-5.x-v2-manual 2.71% <0.00%> (+<0.01%) ⬆️
elasticsearch-6.x-v1 20.36% <0.00%> (+<0.01%) ⬆️
elasticsearch-7.x-v1 20.45% <0.00%> (+0.01%) ⬆️
elasticsearch-8.x-v1 20.60% <0.00%> (+<0.01%) ⬆️
elasticsearch-8.x-v2 2.76% <0.00%> (+<0.01%) ⬆️
grpc_v1 12.16% <0.00%> (+0.01%) ⬆️
grpc_v2 9.03% <0.00%> (+<0.01%) ⬆️
kafka-3.x-v1 10.32% <0.00%> (+<0.01%) ⬆️
kafka-3.x-v2 2.77% <0.00%> (+<0.01%) ⬆️
memory_v2 2.77% <0.00%> (+<0.01%) ⬆️
opensearch-1.x-v1 20.49% <0.00%> (+0.01%) ⬆️
opensearch-2.x-v1 20.49% <0.00%> (+0.01%) ⬆️
opensearch-2.x-v2 2.77% <0.00%> (+<0.01%) ⬆️
tailsampling-processor 0.51% <0.00%> (+<0.01%) ⬆️
unittests 95.09% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Manik2708 <[email protected]>
Comment on lines +667 to +676
if _, found := r.cache.operations[service]; !found {
r.cache.operations[service] = make(map[string]uint64)
}

if v, found := r.cache.operations[service][operationName]; found {
if v > keyTTL {
continue
}
}
r.cache.operations[service][operationName] = keyTTL
Copy link
Member

Choose a reason for hiding this comment

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

you now went the other way - reader knows too much about the cache. There should be a clear API boundary between reader and cache, e.g. all the reader should be doing here is something like cache.add(service, operation). Just because the cache is in the same package doesn't mean the reader should be accessing its private fields like that.

@yurishkuro
Copy link
Member

please provide better description of the changes in the PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants