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

Limit the combined directories and files per allocation #676

Merged
merged 6 commits into from
May 20, 2022

Conversation

avanaur
Copy link
Contributor

@avanaur avanaur commented May 10, 2022

Changes

Add new max_dirs_files config (default 1000) to limit the number of files and directories per allocation.

The check is applied on file actions that will create new file such as

  • create directory
  • file upload
  • copy file
  • new file (think same as file upload)

The check occurs first before any file ref changes. It is not too restrictive in a sense that it will not consider how many new refs a file action will make. As long as current total combined files and dirs are below limit, the whole file action will be allowed to go.

Fixes

Fixes #639

Tests

Tasks to complete before merging PR:

  • Ensure system tests are passing. If not Run them manually to check for any regressions 📋
  • Do any new system tests need added to test this change? do any existing system tests need updated? If so create a PR at 0chain/system_test
  • Merge your system tests PR to master AFTER merging this PR

Associated PRs (Link as appropriate):

  • 0chain:
  • gosdk:
  • system_test:
  • zboxcli:
  • zwalletcli:
  • Other: ...

@avanaur avanaur requested review from lpoli, cnlangzi and peterlimg and removed request for lpoli and cnlangzi May 10, 2022 21:13
@avanaur avanaur marked this pull request as ready for review May 10, 2022 21:13
@avanaur avanaur requested a review from cnlangzi May 10, 2022 21:14
Copy link
Member

@peterlimg peterlimg left a comment

Choose a reason for hiding this comment

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

lgtm

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2022

Codecov Report

Merging #676 (d329463) into staging (d8e9a4f) will increase coverage by 1.88%.
The diff coverage is 44.11%.

@@             Coverage Diff             @@
##           staging     #676      +/-   ##
===========================================
+ Coverage    22.02%   23.91%   +1.88%     
===========================================
  Files           69       69              
  Lines         7933     7967      +34     
===========================================
+ Hits          1747     1905     +158     
+ Misses        5924     5779     -145     
- Partials       262      283      +21     
Flag Coverage Δ
Unit-Tests 23.91% <44.11%> (+1.88%) ⬆️

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

Impacted Files Coverage Δ
.../0chain.net/blobbercore/reference/referencepath.go 0.00% <0.00%> (ø)
...chain.net/blobbercore/allocation/copyfilechange.go 46.42% <62.50%> (+46.42%) ⬆️
....net/blobbercore/allocation/file_changer_upload.go 47.72% <62.50%> (+47.72%) ⬆️
...0chain.net/blobbercore/allocation/newfilechange.go 27.41% <62.50%> (+27.41%) ⬆️

Continue to review full report at Codecov.

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

@cnlangzi cnlangzi merged commit da3feeb into staging May 20, 2022
@cnlangzi cnlangzi deleted the feature/limit-dirs-files-alloc branch May 20, 2022 23:44
@service-0chain
Copy link
Collaborator

Manual system tests [cancelled] with the following config

config value
tests skipped FALSE
system-tests master
gosdk NOT OVERRIDDEN
zboxcli staging
zwalletcli staging
0chain staging
blobber staging
authorizer staging
0box staging
0block staging
0dns staging
explorer master
0proxy staging
0search staging

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.

Limit the number of dirs and files an allocation could have
5 participants