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(Dgraph): Throttle number of files to open while schema update #7480

Merged
merged 3 commits into from
Mar 3, 2021

Conversation

vmrajas
Copy link
Contributor

@vmrajas vmrajas commented Feb 24, 2021

Motivation:
Currently, while doing GraphQL schema update, many files are opened simultaneously for the purpose of indexing predicates. This may create a problem and throw error, "Too many open files" if ulimit is not set properly.
This PR fixes this and puts a limit on the number of threads which create and open files.

Note that this is only meant to address this problem on an empty database. The error may still be thrown (with lower frequency) if the schema update is done on a large dataset.

Testing:

  1. Added e2e test.
  2. Tested locally with a large schema (around 4000 indexed fields)

This change is Reviewable

dgraph/cmd/bulk/run.go Outdated Show resolved Hide resolved
maxOpenFileLimit = 1024
}
glog.Infof("Max open files limit: %d", maxOpenFileLimit)
// Badger opens around 7 files for indexing per predicate.
Copy link
Contributor

Choose a reason for hiding this comment

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

How did you calculate the number 7?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR to address the error of "Too many open files" on empty database. I arrived at this number to account for the files, MANIFEST, LOCK, KEYREGISTRY, DISCARD, 00001.mem and 00001.vlog

Copy link
Contributor

@jarifibrahim jarifibrahim left a comment

Choose a reason for hiding this comment

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

This wouldn't solve the problem. Please see my comment.

worker/mutation.go Show resolved Hide resolved
@vmrajas vmrajas merged commit bfcce46 into master Mar 3, 2021
@vmrajas vmrajas deleted the DGRAPH-3028 branch March 3, 2021 12:07
aman-bansal pushed a commit that referenced this pull request Mar 9, 2021
)

* Throttle number of threads while schema update

* Fix windows build

* Fix test and address Naman's comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/graphql Issues related to GraphQL support on Dgraph.
Development

Successfully merging this pull request may close these issues.

4 participants