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

Use /tmp dir to store temporary index #4766

Merged
merged 2 commits into from
Feb 17, 2020
Merged

Use /tmp dir to store temporary index #4766

merged 2 commits into from
Feb 17, 2020

Conversation

mangalaman93
Copy link
Member

@mangalaman93 mangalaman93 commented Feb 13, 2020

Fixes #4600
While running dgraph as systemd service, we may not have permissions to create a folder in the current directory. Now, we instead use /tmp dir to store the temporary index solving the permission denied error.


This change is Reviewable

Docs Preview: Dgraph Preview

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @mangalaman93 and @manishrjain)


posting/index.go, line 515 at r1 (raw file):

	// directory after the indexing step is complete. This deletes any other temp
	// indexes that may have been left around in case defer wasn't executed.
	tmpParentDir := filepath.Join(os.TempDir(), "dgraph_index")

Consider using https://golang.org/pkg/io/ioutil/#TempDir to avoid issues if multiple are going on or the temp folder is not properly deleted.

Copy link
Member Author

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @manishrjain and @martinmr)


posting/index.go, line 515 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…

Consider using https://golang.org/pkg/io/ioutil/#TempDir to avoid issues if multiple are going on or the temp folder is not properly deleted.

That is what we are using if you see below. Just keeping everything in one folder though so that if we are looking for the directory for debugging or something, it would be easier to find.

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @martinmr)


posting/index.go, line 515 at r1 (raw file):

Previously, mangalaman93 (Aman Mangal) wrote…

That is what we are using if you see below. Just keeping everything in one folder though so that if we are looking for the directory for debugging or something, it would be easier to find.

Add a TODO here: If we get a complaint, we could move this to a flag, so a user can specify what the tmp dir should be.

Fixes #4600
While running dgraph as systemd service, we may not have permissions
to create a folder in the current directory. Now, we instead use /tmp
dir to store the temporary index solving the permission denied error.
Copy link
Member Author

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @martinmr)


posting/index.go, line 515 at r1 (raw file):

Previously, manishrjain (Manish R Jain) wrote…

Add a TODO here: If we get a complaint, we could move this to a flag, so a user can specify what the tmp dir should be.

Done.

@mangalaman93 mangalaman93 merged commit 8bf9046 into master Feb 17, 2020
@mangalaman93 mangalaman93 deleted the aman/4600 branch February 17, 2020 14:57
ashish-goswami pushed a commit that referenced this pull request Jun 25, 2020
Fixes #4600
While running dgraph as systemd service, we may not have permissions
to create a folder in the current directory. Now, we instead use /tmp
dir to store the temporary index solving the permission denied error.

(cherry picked from commit 8bf9046)
ashish-goswami added a commit that referenced this pull request Jul 9, 2020
Fixes #4600
While running dgraph as systemd service, we may not have permissions
to create a folder in the current directory. Now, we instead use /tmp
dir to store the temporary index solving the permission denied error.

(cherry picked from commit 8bf9046)

Co-authored-by: Aman Mangal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Reindexing error permission denied
3 participants