Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: move crash and stateproof DB defaults to hot dir #5817

Merged
merged 8 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ func TestEnsureAndResolveGenesisDirs_hierarchy(t *testing.T) {
require.DirExists(t, paths.TrackerGenesisDir)
require.Equal(t, cold+"/myGenesisID", paths.BlockGenesisDir)
require.DirExists(t, paths.BlockGenesisDir)
require.Equal(t, cold+"/myGenesisID", paths.CrashGenesisDir)
require.Equal(t, hot+"/myGenesisID", paths.CrashGenesisDir)
require.DirExists(t, paths.CrashGenesisDir)
require.Equal(t, cold+"/myGenesisID", paths.StateproofGenesisDir)
require.Equal(t, hot+"/myGenesisID", paths.StateproofGenesisDir)
require.DirExists(t, paths.StateproofGenesisDir)
require.Equal(t, cold+"/myGenesisID", paths.CatchpointGenesisDir)
require.DirExists(t, paths.CatchpointGenesisDir)
Expand Down
12 changes: 6 additions & 6 deletions config/localTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ type Local struct {
CatchpointDir string `version[31]:""`
// StateproofDir is an optional directory to store stateproof data.
// For isolation, the node will create a subdirectory in this location, named by the genesis-id of the network.
// If not specified, the node will use the ColdDataDir.
// If not specified, the node will use the HotDataDir.
StateproofDir string `version[31]:""`
// CrashDBDir is an optional directory to store the crash database.
// For isolation, the node will create a subdirectory in this location, named by the genesis-id of the network.
// If not specified, the node will use the ColdDataDir.
// If not specified, the node will use the HotDataDir
CrashDBDir string `version[31]:""`

// LogFileDir is an optional directory to store the log, node.log
Expand Down Expand Up @@ -829,23 +829,23 @@ func (cfg *Local) EnsureAndResolveGenesisDirs(rootDir, genesisID string) (Resolv
} else {
resolved.CatchpointGenesisDir = resolved.ColdGenesisDir
}
// if StateproofDir is not set, use ColdDataDir
// if StateproofDir is not set, use HotDataDir
if cfg.StateproofDir != "" {
resolved.StateproofGenesisDir, err = ensureAbsGenesisDir(cfg.StateproofDir, genesisID)
if err != nil {
return ResolvedGenesisDirs{}, err
}
} else {
resolved.StateproofGenesisDir = resolved.ColdGenesisDir
resolved.StateproofGenesisDir = resolved.HotGenesisDir
}
// if CrashDBDir is not set, use ColdDataDir
// if CrashDBDir is not set, use HotDataDir
if cfg.CrashDBDir != "" {
resolved.CrashGenesisDir, err = ensureAbsGenesisDir(cfg.CrashDBDir, genesisID)
if err != nil {
return ResolvedGenesisDirs{}, err
}
} else {
resolved.CrashGenesisDir = resolved.ColdGenesisDir
resolved.CrashGenesisDir = resolved.HotGenesisDir
}
return resolved, nil
}
Expand Down
6 changes: 3 additions & 3 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ func TestConfiguredDataDirs(t *testing.T) {
require.FileExists(t, filepath.Join(testDirHot, genesis.ID(), "ledger.tracker.sqlite"))

// confirm the stateproof db in the genesis dir of hot data dir
require.FileExists(t, filepath.Join(testDirCold, genesis.ID(), "stateproof.sqlite"))
require.FileExists(t, filepath.Join(testDirHot, genesis.ID(), "stateproof.sqlite"))

// confirm cold data dir exists and contains a genesis dir
require.DirExists(t, filepath.Join(testDirCold, genesis.ID()))
Expand All @@ -609,8 +609,8 @@ func TestConfiguredDataDirs(t *testing.T) {
// confirm the partregistry is in the genesis dir of cold data dir
require.FileExists(t, filepath.Join(testDirCold, genesis.ID(), "partregistry.sqlite"))

// confirm the partregistry is in the genesis dir of cold data dir
require.FileExists(t, filepath.Join(testDirCold, genesis.ID(), "crash.sqlite"))
// confirm the agreement crash DB is in the genesis dir of hot data dir
require.FileExists(t, filepath.Join(testDirHot, genesis.ID(), "crash.sqlite"))
}

// TestConfiguredResourcePaths tests to see that when TrackerDbFilePath, BlockDbFilePath, StateproofDir, and CrashFilePath are set, underlying resources are created in the correct locations
Expand Down