Skip to content

Commit

Permalink
Update temp if rename fails using the real datadir
Browse files Browse the repository at this point in the history
  • Loading branch information
macneale4 committed Dec 23, 2024
1 parent 8afb293 commit c8e244c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions go/cmd/dolt/system_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ import (
"os"
"path/filepath"

"github.com/dolthub/dolt/go/libraries/doltcore/dbfactory"
"github.com/dolthub/dolt/go/libraries/doltcore/env"
"github.com/dolthub/dolt/go/libraries/utils/file"
"github.com/dolthub/dolt/go/libraries/utils/filesys"
"github.com/dolthub/dolt/go/store/util/tempfiles"
)

// reconfigIfTempFileMoveFails checks to see if the file system used for the data directory supports moved from TMPDIR.
// If this is not possible, we can't perform automic moves of storage files, so we force the temp dir to be the data dir
// reconfigIfTempFileMoveFails checks to see if the file system used for the data directory supports moves from TMPDIR.
// If this is not possible, we can't perform atomic moves of storage files, so we force the temp dir to be in the datadir
// to assure they are on the same file system.
func reconfigIfTempFileMoveFails(dataDir filesys.Filesys) error {
absP, err := dataDir.Abs("")
Expand All @@ -37,7 +38,7 @@ func reconfigIfTempFileMoveFails(dataDir filesys.Filesys) error {
dotDoltCreated := false
tmpDirCreated := false

doltDir := filepath.Join(absP, ".dolt")
doltDir := filepath.Join(absP, dbfactory.DoltDir)
stat, err := os.Stat(doltDir)
if err != nil {
err := os.MkdirAll(doltDir, os.ModePerm)
Expand Down

0 comments on commit c8e244c

Please sign in to comment.