Skip to content

Commit 5cba43a

Browse files
committed
fix wrong root dir generation
1 parent b6323f9 commit 5cba43a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

local/snapshot.go

+1
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ func (ln *localNetwork) loadSnapshot(
300300
}
301301
// configure each node data dir
302302
for _, nodeConfig := range networkConfig.NodeConfigs {
303+
delete(nodeConfig.Flags, config.DBPathKey)
303304
nodeConfig.Flags[config.DataDirKey] = filepath.Join(ln.rootDir, nodeConfig.Name)
304305
}
305306
// replace binary path

server/server.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ func (s *server) Start(_ context.Context, req *rpcpb.StartRequest) (*rpcpb.Start
315315
if err != nil {
316316
return nil, err
317317
}
318-
}
319-
rootDataDir = filepath.Join(rootDataDir, networkRootDirPrefix)
320-
rootDataDir, err = utils.MkDirWithTimestamp(rootDataDir)
321-
if err != nil {
322-
return nil, err
318+
rootDataDir = filepath.Join(rootDataDir, networkRootDirPrefix)
319+
rootDataDir, err = utils.MkDirWithTimestamp(rootDataDir)
320+
if err != nil {
321+
return nil, err
322+
}
323323
}
324324

325325
if len(customNodeConfigs) > 0 {
@@ -1335,11 +1335,11 @@ func (s *server) LoadSnapshot(_ context.Context, req *rpcpb.LoadSnapshotRequest)
13351335
if err != nil {
13361336
return nil, err
13371337
}
1338-
}
1339-
rootDataDir = filepath.Join(rootDataDir, networkRootDirPrefix)
1340-
rootDataDir, err = utils.MkDirWithTimestamp(rootDataDir)
1341-
if err != nil {
1342-
return nil, err
1338+
rootDataDir = filepath.Join(rootDataDir, networkRootDirPrefix)
1339+
rootDataDir, err = utils.MkDirWithTimestamp(rootDataDir)
1340+
if err != nil {
1341+
return nil, err
1342+
}
13431343
}
13441344

13451345
pid := int32(os.Getpid())

0 commit comments

Comments
 (0)