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

[Storage Refactor] Refactor Approvals #6868

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zhangchiqing
Copy link
Member

@zhangchiqing zhangchiqing commented Jan 10, 2025

This PR refactors the approvals storage from badger transaction to badger batch updates.

It is to prepare for switching from badger to pebble.

Referrals:
#6381
#6466

@zhangchiqing zhangchiqing changed the base branch from master to leo/db-ops-dbstore January 10, 2025 18:38
@zhangchiqing zhangchiqing force-pushed the leo/storage-refactor-approvals branch from 43bfcd3 to cc06a44 Compare January 10, 2025 18:41
Base automatically changed from leo/db-ops-dbstore to master January 13, 2025 19:55
@zhangchiqing zhangchiqing force-pushed the leo/storage-refactor-approvals branch from 90051e1 to a4bfe1f Compare January 15, 2025 16:24
@zhangchiqing zhangchiqing marked this pull request as ready for review January 15, 2025 16:24
@zhangchiqing zhangchiqing requested a review from a team as a code owner January 15, 2025 16:24
@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 68.38710% with 49 lines in your changes missing coverage. Please review.

Project coverage is 41.20%. Comparing base (b740fc0) to head (a4bfe1f).

Files with missing lines Patch % Lines
storage/store/cache.go 66.21% 24 Missing and 1 partial ⚠️
storage/store/approvals.go 80.28% 10 Missing and 4 partials ⚠️
storage/operation/approvals.go 0.00% 8 Missing ⚠️
cmd/verification_builder.go 0.00% 1 Missing ⚠️
engine/testutil/nodes.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6868      +/-   ##
==========================================
+ Coverage   41.11%   41.20%   +0.08%     
==========================================
  Files        2116     2117       +1     
  Lines      185749   185822      +73     
==========================================
+ Hits        76378    76566     +188     
+ Misses     102954   102841     -113     
+ Partials     6417     6415       -2     
Flag Coverage Δ
unittests 41.20% <68.38%> (+0.08%) ⬆️

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.

Copy link
Contributor

@peterargue peterargue left a comment

Choose a reason for hiding this comment

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

added a few comments about docs, but othewise looks good.

return fmt.Errorf("could not lookup result approval ID: %w", err)
}

// no approval found, index the approval
Copy link
Contributor

Choose a reason for hiding this comment

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

should this go after the error conditional completes on line 79?


type Cache[K comparable, V any] struct {
metrics module.CacheMetrics
// nolint:unused
Copy link
Contributor

Choose a reason for hiding this comment

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

is this needed? looks like limit is used

"github.com/onflow/flow-go/storage"
)

// nolint:unused
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need all of these nolint directives? seems like they will become out of date quickly.

}

// Get will try to retrieve the resource from cache first, and then from the
// injected. During normal operations, the following error returns are expected:
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the injected referring to here?

}

// Get will try to retrieve the resource from cache first, and then from the
// injected. During normal operations, the following error returns are expected:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: it's easier to find the error part when it starts on a new line

Suggested change
// injected. During normal operations, the following error returns are expected:
// injected.
// During normal operations, the following error returns are expected:

return resource, nil
}

func (c *Cache[K, V]) Remove(key K) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add docs for this method too?

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.

3 participants