mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-15 00:50:22 -06:00
PR Feedback
This commit is contained in:
4
go/libraries/doltcore/env/environment.go
vendored
4
go/libraries/doltcore/env/environment.go
vendored
@@ -95,6 +95,10 @@ type DoltEnv struct {
|
||||
UserPassConfig *creds.DoltCredsForPass
|
||||
}
|
||||
|
||||
// IncompleteEnv returns a DoltEnv that is incomplete. There are cases where we want to know that the structure
|
||||
// of and database is correct on disk, but don't want to actually load the database.
|
||||
//
|
||||
// Callers of this method should not expect the returned DoltEnv to be useful as a database for running queries.
|
||||
func IncompleteEnv(FS filesys.Filesys) *DoltEnv {
|
||||
return &DoltEnv{
|
||||
Version: doltversion.Version,
|
||||
|
||||
11
go/libraries/doltcore/env/multi_repo_env.go
vendored
11
go/libraries/doltcore/env/multi_repo_env.go
vendored
@@ -54,6 +54,8 @@ type MultiRepoEnv struct {
|
||||
dialProvider dbfactory.GRPCDialProvider
|
||||
}
|
||||
|
||||
// StorageMetadataMap is a map of table file and archive paths to their metadata. It is used to surface specific
|
||||
// information about the storage of a database without loading the storage files themselves.
|
||||
type StorageMetadataMap map[string]nbs.StorageMetadata
|
||||
|
||||
func (sms StorageMetadataMap) ArchiveFilesPresent() bool {
|
||||
@@ -84,16 +86,17 @@ func GetMultiEnvStorageMetadata(dataDirFS filesys.Filesys) (StorageMetadataMap,
|
||||
|
||||
dir := filepath.Base(path)
|
||||
|
||||
newFs, er2 := dataDirFS.WithWorkingDir(dir)
|
||||
if er2 != nil {
|
||||
newFs, err := dataDirFS.WithWorkingDir(dir)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
path, er2 = newFs.Abs("")
|
||||
if er2 != nil {
|
||||
path, err = newFs.Abs("")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
envName := getRepoRootDir(path, string(os.PathSeparator))
|
||||
|
||||
// For an incomplete environment, the .Valid() check basically just checks if there is a .dolt directory.
|
||||
falseEnv := IncompleteEnv(newFs)
|
||||
if !falseEnv.Valid() {
|
||||
return false
|
||||
|
||||
@@ -85,7 +85,7 @@ func NewServer(args ServerArgs) (*Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
if storageMetadata.ArchiveFilesPresent() {
|
||||
return nil, errors.New("archive files present")
|
||||
return nil, errors.New("archive files present. Please run `dolt archive --revert` before running the server.")
|
||||
}
|
||||
|
||||
s := new(Server)
|
||||
|
||||
@@ -52,7 +52,7 @@ func UnArchive(ctx context.Context, cs chunks.ChunkStore, smd StorageMetadata, p
|
||||
for id, ogcs := range oldgen {
|
||||
if arc, ok := ogcs.(archiveChunkSource); ok {
|
||||
orginTfId := revertMap[id]
|
||||
exists, err := smd.LoseOldGenTableExists(orginTfId)
|
||||
exists, err := smd.oldGenTableExists(orginTfId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ func (sm *StorageMetadata) RevertMap() map[hash.Hash]hash.Hash {
|
||||
return revertMap
|
||||
}
|
||||
|
||||
func (sm *StorageMetadata) LoseOldGenTableExists(id hash.Hash) (bool, error) {
|
||||
func (sm *StorageMetadata) oldGenTableExists(id hash.Hash) (bool, error) {
|
||||
path := filepath.Join(sm.root, ".dolt", "noms", "oldgen", id.String())
|
||||
_, err := os.Stat(path)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user