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: Make fetcher calculate docFetches and fieldFetches #1713

Merged
merged 5 commits into from
Jul 27, 2023

Conversation

islamaliev
Copy link
Contributor

Relevant issue(s)

Resolves #1636 and #1637

Description

With this change the calculation of stats for fetching documents is moved to fetcher.

This was necessary because each call to fetcher.FetchNext... could potentially perform multiple doc fetches.
But scanNode (previously responsible for this) would just increment by 1.
Moreover, scanNode would incorrectly count end of fetching (returned nil doc) as 1 as well.

Also this fix introduces another (probably more important) metric fieldFetches which better indicates
the execution cost because it much closer correlates with number of IO operations, as eace document's
field is stored in a separate KV pair.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

Integration tests

Specify the platform(s) on which this was tested:

  • MacOS

@islamaliev islamaliev added bug Something isn't working feature New feature or request area/planner Related to the planner system labels Jul 26, 2023
@islamaliev islamaliev added this to the DefraDB v0.6 milestone Jul 26, 2023
@islamaliev islamaliev requested review from jsimnz and shahzadlone July 26, 2023 16:08
@islamaliev islamaliev self-assigned this Jul 26, 2023
@islamaliev islamaliev changed the title fix: Make fetcher responsible for calculating execution stats fix: Make fetcher calculate execution stats Jul 26, 2023
@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Patch coverage: 65.17% and project coverage change: +0.10% 🎉

Comparison is base (7f6cc67) 75.32% compared to head (730364f) 75.42%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1713      +/-   ##
===========================================
+ Coverage    75.32%   75.42%   +0.10%     
===========================================
  Files          208      208              
  Lines        21727    21745      +18     
===========================================
+ Hits         16364    16399      +35     
+ Misses        4217     4206      -11     
+ Partials      1146     1140       -6     
Flag Coverage Δ
all-tests 75.42% <65.17%> (+0.10%) ⬆️

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

Files Changed Coverage Δ
lens/fetcher.go 50.37% <35.48%> (-0.75%) ⬇️
db/fetcher/fetcher.go 75.36% <76.60%> (+2.45%) ⬆️
db/collection_get.go 81.25% <100.00%> (ø)
db/collection_index.go 97.46% <100.00%> (ø)
planner/scan.go 91.41% <100.00%> (+1.62%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f6cc67...730364f. Read the comment docs.

db/fetcher/fetcher.go Outdated Show resolved Hide resolved
@islamaliev islamaliev force-pushed the fix/islam/doc-fetched branch from afd5ddf to bff4048 Compare July 27, 2023 09:32
@islamaliev islamaliev requested a review from fredcarle July 27, 2023 09:33
Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

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

I would argue this isn't a fix, this is either a refactor or feat.

Thanks for bringing back the granularity of fetching datapoints :) left some comments.

planner/scan.go Outdated Show resolved Hide resolved
db/fetcher/fetcher.go Outdated Show resolved Hide resolved
db/fetcher/fetcher.go Outdated Show resolved Hide resolved
db/fetcher/fetcher.go Outdated Show resolved Hide resolved
@islamaliev islamaliev force-pushed the fix/islam/doc-fetched branch from bff4048 to 730364f Compare July 27, 2023 15:59
@islamaliev islamaliev requested a review from shahzadlone July 27, 2023 15:59
@islamaliev islamaliev changed the title fix: Make fetcher calculate execution stats feat: Make fetcher calculate docFetches and fieldFetches Jul 27, 2023
@islamaliev islamaliev dismissed shahzadlone’s stale review July 27, 2023 16:32

applied all requested changes

@islamaliev islamaliev merged commit afee323 into develop Jul 27, 2023
@islamaliev islamaliev deleted the fix/islam/doc-fetched branch July 27, 2023 16:34
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
…rk#1713)

## Relevant issue(s)

Resolves sourcenetwork#1636 and sourcenetwork#1637

## Description

With this change the calculation of stats for fetching documents is
moved to fetcher.

This was necessary because each call to `fetcher.FetchNext...` could
potentially perform multiple doc fetches.
But scanNode (previously responsible for this) would just increment by 1.
Moreover, scanNode would incorrectly count end of fetching (returned nil
doc) as 1 as well.

Also this fix introduces another (probably more important) metric
`fieldFetches` which better indicates the execution cost because 
it much closer correlates with number of IO operations, as eace 
document's field is stored in a separate KV pair.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/planner Related to the planner system bug Something isn't working feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix docFetched metric for @explain
3 participants