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

fix: Ignore badger path if in-memory #2967

Merged

Conversation

ONLYUSEmePHONE
Copy link
Contributor

Relevant issue(s)

Resolves #2964

Description

Small change that now only sets the badger options Dir and ValueDir to the path parameter if the badger option InMemory is not true.

The crash was happening because badger expects the two Dir values to be nil if InMemory is true.

I chose this fix because it's very simple and requires the least changes. The bulk of the problem is that the datastore.badger.path config value gets set to data by default regardless of whether datastore.store is set to memory and this value gets passed as the path parameter. I didn't think it would be nice to change any of the upstream logic or the signature of the NewDatastore function.

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?

Running standard test suite and using both commands provided in #2964 .

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

  • Debian Linux

@ONLYUSEmePHONE ONLYUSEmePHONE changed the title update: only add badger options Dir and ValueDir if the options InMem… fix: only add badger options Dir and ValueDir if the options InMem… Aug 28, 2024
Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

@ONLYUSEmePHONE Hey, and welcome to our codebase!

Thank you very much for this fix, it solves the bigger problem, and is very minimal as you noted in the description :)

@AndrewSisley AndrewSisley added bug Something isn't working area/cli Related to the CLI binary labels Aug 28, 2024
@AndrewSisley AndrewSisley added this to the DefraDB v0.14 milestone Aug 28, 2024
…ory is not true when creating a new badger datastore
@AndrewSisley AndrewSisley force-pushed the fix/badger-inmemory-crash branch from 72aa29e to 9c9a772 Compare August 28, 2024 14:43
@AndrewSisley
Copy link
Contributor

FYI: I'm going to update the PR title, hope you don't mind - we have a 60 character limit (I also rebased onto the latest, also a requirement for merge)

@AndrewSisley AndrewSisley changed the title fix: only add badger options Dir and ValueDir if the options InMem… fix: Ignore badger path if in-memory Aug 28, 2024
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.35%. Comparing base (2d1702c) to head (9ae49f5).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2967      +/-   ##
===========================================
+ Coverage    79.34%   79.35%   +0.01%     
===========================================
  Files          326      326              
  Lines        24768    24769       +1     
===========================================
+ Hits         19651    19655       +4     
+ Misses        3704     3702       -2     
+ Partials      1413     1412       -1     
Flag Coverage Δ
all-tests 79.35% <100.00%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
datastore/badger/v4/datastore.go 81.37% <100.00%> (+0.05%) ⬆️

... and 14 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 2d1702c...9ae49f5. Read the comment docs.

@AndrewSisley AndrewSisley merged commit fdf4047 into sourcenetwork:develop Aug 28, 2024
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to the CLI binary bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

defradb start ... --store memory errors
2 participants