mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-26 03:30:09 -05:00
Cleaning up more debug hacks
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/dolthub/go-mysql-server/sql"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/dbfactory"
|
||||
"github.com/dolthub/dolt/go/libraries/utils/errors"
|
||||
@@ -57,8 +56,6 @@ func (dd *droppedDatabaseManager) DropDatabase(ctx *sql.Context, name string, dr
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Errorf("DEBUG: Entering droppedDatabaseManager::DropDatabase('%s', '%s')", name, dropDbLoc)
|
||||
|
||||
isRootDatabase := false
|
||||
// if the database is in the directory itself, we remove '.dolt' directory rather than
|
||||
// the whole directory itself because it can have other databases that are nested.
|
||||
@@ -95,14 +92,10 @@ func (dd *droppedDatabaseManager) DropDatabase(ctx *sql.Context, name string, dr
|
||||
base = dbfactory.DirToDBName(file)
|
||||
destinationDirectory = filepath.Join(dir, base)
|
||||
|
||||
logrus.Errorf("DEBUG: Preparing to move dropped database ...")
|
||||
|
||||
if err := dd.prepareToMoveDroppedDatabase(ctx, destinationDirectory); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Errorf("DEBUG: About to move directory ...")
|
||||
|
||||
return dd.fs.MoveDir(dropDbLoc, destinationDirectory)
|
||||
}
|
||||
|
||||
|
||||
@@ -230,13 +230,15 @@ func (gcs *GenerationalNBS) Close() error {
|
||||
two, ok2 := gcs.newGen.p.(*chunkJournal)
|
||||
if ok1 && ok2 && one.Name() == two.Name() {
|
||||
logrus.Errorf("GenerationalNBS::Close() - old and new gen have the SAME chunk journal file location!!!!")
|
||||
// TODO: Testing if this happens... might be indicative of a test setup configuration error?
|
||||
panic("GenerationalNBS::Close() - old and new gen have the SAME chunk journal file location!!!!")
|
||||
}
|
||||
}
|
||||
|
||||
logrus.Errorf("GenerationalNBS::Close() - oldGen...")
|
||||
oErr := gcs.oldGen.Close()
|
||||
logrus.Errorf("GenerationalNBS::Close() - newGen...")
|
||||
nErr := gcs.newGen.Close() // newGen.Close() triggers the windows "file already closed" error
|
||||
nErr := gcs.newGen.Close()
|
||||
|
||||
if oErr != nil {
|
||||
return oErr
|
||||
|
||||
@@ -22,11 +22,9 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/dolthub/fslock"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/dolthub/dolt/go/store/chunks"
|
||||
"github.com/dolthub/dolt/go/store/hash"
|
||||
@@ -400,13 +398,6 @@ func (j *chunkJournal) Close() (err error) {
|
||||
err = cerr // keep first error
|
||||
}
|
||||
|
||||
// TODO: Add note about windows system call impl difference
|
||||
if err != nil && strings.Contains(err.Error(), "file already closed") {
|
||||
logrus.Errorf("chunkJournal::Close() - ERROR (type: %T): %s", err, err.Error())
|
||||
// TODO: Commenting this out so that tests continue failing while we keep debugging
|
||||
//err = nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/dolthub/swiss"
|
||||
@@ -508,12 +507,10 @@ func (wr *journalWriter) Close() (err error) {
|
||||
defer wr.lock.Unlock()
|
||||
|
||||
if wr.journal == nil {
|
||||
logrus.Errorf("journal writer has already been closed! no-op...")
|
||||
logrus.Warn("journal writer has already been closed")
|
||||
return nil
|
||||
}
|
||||
|
||||
logrus.Errorf("entering journalWriter::Close() - File: %s", wr.journal.Name())
|
||||
|
||||
if err = wr.flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -522,26 +519,15 @@ func (wr *journalWriter) Close() (err error) {
|
||||
}
|
||||
if cerr := wr.journal.Sync(); cerr != nil {
|
||||
err = cerr
|
||||
logrus.Errorf("journalWriter::Close() - Error from wr.journal.Sync(): %s", err.Error())
|
||||
}
|
||||
|
||||
if cerr := wr.journal.Close(); cerr != nil {
|
||||
logrus.Errorf("journalWriter::Close() - ERROR (type: %T): %s", err, err.Error())
|
||||
|
||||
// TODO: If the error contains "file already closed" then just log the error, but don't return it
|
||||
// however... it seems like we'd still have an error from wr.journal.Sync()
|
||||
if strings.Contains(cerr.Error(), "file already closed") {
|
||||
logrus.Warnf("journalWriter::Close() unable to close journal: %s ", cerr.Error())
|
||||
// TODO: enable this else block
|
||||
//} else {
|
||||
err = cerr
|
||||
}
|
||||
err = cerr
|
||||
} else {
|
||||
// Nil out the journal after the file has been closed, so that it's obvious it's been closed
|
||||
wr.journal = nil
|
||||
}
|
||||
|
||||
// Nil out the journal after the file has been closed, so that it's obvious it's been closed
|
||||
wr.journal = nil
|
||||
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
// A rangeIndex maps chunk addresses to read Ranges in the chunk journal file.
|
||||
|
||||
Reference in New Issue
Block a user