Skip to content

Commit

Permalink
Deprecate Lotman.DbLocation in favor of Lotman.LotHome
Browse files Browse the repository at this point in the history
Sarthak pointed out that elsewhere in Pelican, `DbLocation` params point
to the the name of an actual file, not the base directory for a file. So as
not to break that convention, I'm renaming this Lotman key to match the name
Lotman actually uses to refer to the path.
  • Loading branch information
jhiemstrawisc committed Feb 10, 2025
1 parent 5d5ac56 commit 565a9e3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ func SetServerDefaults(v *viper.Viper) error {
v.SetDefault(param.Registry_DbLocation.GetName(), "/var/lib/pelican/registry.sqlite")
v.SetDefault(param.Director_DbLocation.GetName(), "/var/lib/pelican/director.sqlite")
// The lotman db will actually take this path and create the lot at /path/.lot/lotman_cpp.sqlite
v.SetDefault(param.Lotman_DbLocation.GetName(), "/var/lib/pelican")
v.SetDefault(param.Lotman_LotHome.GetName(), "/var/lib/pelican")
v.SetDefault(param.Monitoring_DataLocation.GetName(), "/var/lib/pelican/monitoring/data")
v.SetDefault(param.Shoveler_QueueDirectory.GetName(), "/var/spool/pelican/shoveler/queue")
v.SetDefault(param.Shoveler_AMQPTokenLocation.GetName(), "/etc/pelican/shoveler-token")
Expand All @@ -1023,7 +1023,7 @@ func SetServerDefaults(v *viper.Viper) error {
v.SetDefault(param.Registry_DbLocation.GetName(), filepath.Join(configDir, "ns-registry.sqlite"))
v.SetDefault(param.Director_DbLocation.GetName(), filepath.Join(configDir, "director.sqlite"))
// Lotdb will live at <configDir>/.lot/lotman_cpp.sqlite
v.SetDefault(param.Lotman_DbLocation.GetName(), configDir)
v.SetDefault(param.Lotman_LotHome.GetName(), configDir)
v.SetDefault(param.Monitoring_DataLocation.GetName(), filepath.Join(configDir, "monitoring/data"))
v.SetDefault(param.Shoveler_QueueDirectory.GetName(), filepath.Join(configDir, "shoveler/queue"))
v.SetDefault(param.Shoveler_AMQPTokenLocation.GetName(), filepath.Join(configDir, "shoveler-token"))
Expand Down
14 changes: 14 additions & 0 deletions docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2886,13 +2886,27 @@ components: ["plugin"]
############################
# LotMan-level configs #
############################
name: Lotman.LotHome
description: |+
The prefix indicating where LotMan should store its lot database. Configured with path `<path>`, the database
will be stored at `<path>/.lot/lotman_cpp.sqlite`.
type: filename
root_default: /var/run/pelican
default: $ConfigBase
components: ["cache"]
---
name: Lotman.DbLocation
description: |+
[Deprecated] `Lotman.DbLocation` is deprecated and will be removed in a future release. Please migrate to
use `Lotman.LotHome` instead.
The prefix indicating where LotMan should store its lot database. For the provided path, the database
will be stored at <path>/.lot/lotman_cpp.sqlite.
type: filename
root_default: /var/run/pelican
default: $ConfigBase
deprecated: true
replacedby: ["Lotman.LotHome"]
components: ["cache"]
---
name: Lotman.LibLocation
Expand Down
2 changes: 1 addition & 1 deletion lotman/lotman_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ func InitLotman(adsFromFed []server_structs.NamespaceAdV2) bool {
purego.RegisterLibFunc(&LotmanGetLotsFromDir, lotmanLib, "lotman_get_lots_from_dir")

// Set the lot_home context -- where the db lives
lotHome := param.Lotman_DbLocation.GetString()
lotHome := param.Lotman_LotHome.GetString()

errMsg := make([]byte, 2048)

Expand Down
2 changes: 1 addition & 1 deletion lotman/lotman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func setupLotmanFromConf(t *testing.T, readConfig bool, name string, discUrl str
tmpPath, err := os.MkdirTemp("", tmpPathPattern)
require.NoError(t, err)

viper.Set("Lotman.DbLocation", tmpPath)
viper.Set("Lotman.LotHome", tmpPath)
success := InitLotman(nsAds)
//reset func
return success, func() {
Expand Down
2 changes: 2 additions & 0 deletions param/parameters.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions param/parameters_struct.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 565a9e3

Please sign in to comment.