Skip to content

Commit 26ddfad

Browse files
mangalaman93ashish-goswami
authored andcommitted
Use /tmp dir to store temporary index (#4766)
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)
1 parent 2e41128 commit 26ddfad

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

posting/index.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"io/ioutil"
2525
"math"
2626
"os"
27+
"path/filepath"
2728
"sync/atomic"
2829
"time"
2930

@@ -512,7 +513,8 @@ func (r *rebuilder) Run(ctx context.Context) error {
512513
// All the temp indexes go into the following directory. We delete the whole
513514
// directory after the indexing step is complete. This deletes any other temp
514515
// indexes that may have been left around in case defer wasn't executed.
515-
tmpParentDir := "dgraph_index"
516+
// TODO(Aman): If users are not happy, we could add a flag to choose this dir.
517+
tmpParentDir := filepath.Join(os.TempDir(), "dgraph_index")
516518

517519
// We write the index in a temporary badger first and then,
518520
// merge entries before writing them to p directory.

0 commit comments

Comments
 (0)