flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

[Badger] Add universal database operations

Open zhangchiqing opened this issue 1 year ago • 1 comments

This PR implemented the low level database operations that can be shared by both badger and pebble implementation.

Since badger operations will be refactored to use batch updates instead of transactions, this makes the badger db operations and pebble db operations very similar and I managed to unify them.

A separate PR that refactors the approvals will demonstrate how the unified database operations can be used there. (see https://github.com/onflow/flow-go/pull/6466)

This allows us to remove both the badger-specific and pebble-specific database modules, and only keep one universal version, easier to maintain.

zhangchiqing avatar Sep 14 '24 00:09 zhangchiqing

Codecov Report

Attention: Patch coverage is 30.39216% with 355 lines in your changes missing coverage. Please review.

Project coverage is 40.96%. Comparing base (0310dfd) to head (24d65bc).

Files with missing lines Patch % Lines
storage/operation/pebbleimpl/writer.go 0.00% 51 Missing :warning:
storage/operation/badgerimpl/writer.go 0.00% 48 Missing :warning:
storage/operation/badgerimpl/iterator.go 0.00% 47 Missing :warning:
storage/operation/reads.go 69.16% 25 Missing and 12 partials :warning:
storage/operation/dbtest/helper.go 0.00% 31 Missing :warning:
storage/operation/pebbleimpl/iterator.go 0.00% 31 Missing :warning:
utils/unittest/unittest.go 0.00% 27 Missing :warning:
storage/operation/badgerimpl/reader.go 0.00% 22 Missing :warning:
storage/operation/codec.go 27.27% 16 Missing :warning:
storage/operation/pebbleimpl/reader.go 0.00% 16 Missing :warning:
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6465      +/-   ##
==========================================
- Coverage   40.98%   40.96%   -0.02%     
==========================================
  Files        2079     2093      +14     
  Lines      183922   184432     +510     
==========================================
+ Hits        75382    75555     +173     
- Misses     102240   102563     +323     
- Partials     6300     6314      +14     
Flag Coverage Δ
unittests 40.96% <30.39%> (-0.02%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Sep 14 '24 00:09 codecov-commenter