Skip to content

Commit 540728e

Browse files
committed
feat: add a new field to provide the ability of selecting a specific pool to work with DLE (#306)
1 parent 13716b7 commit 540728e

5 files changed

+23
-0
lines changed

Diff for: configs/config.example.logical_generic.yml

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ poolManager:
9090
# Snapshots with this suffix are considered preliminary. They are not supposed to be accessible to end-users.
9191
preSnapshotSuffix: "_pre"
9292

93+
# Force selection of a working pool inside the `mountDir`.
94+
# It is an empty string by default which means that the standard selection and rotation mechanism will be applied.
95+
selectedPool: ""
96+
9397
# Configure database containers
9498
databaseContainer: &db_container
9599
# Database Lab provisions thin clones using Docker containers and uses auxiliary containers.

Diff for: configs/config.example.logical_rds_iam.yml

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ poolManager:
9090
# Snapshots with this suffix are considered preliminary. They are not supposed to be accessible to end-users.
9191
preSnapshotSuffix: "_pre"
9292

93+
# Force selection of a working pool inside the `mountDir`.
94+
# It is an empty string by default which means that the standard selection and rotation mechanism will be applied.
95+
selectedPool: ""
96+
9397
# Configure database containers
9498
databaseContainer: &db_container
9599
# Database Lab provisions thin clones using Docker containers and uses auxiliary containers.

Diff for: configs/config.example.physical_generic.yml

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ poolManager:
9090
# Snapshots with this suffix are considered preliminary. They are not supposed to be accessible to end-users.
9191
preSnapshotSuffix: "_pre"
9292

93+
# Force selection of a working pool inside the `mountDir`.
94+
# It is an empty string by default which means that the standard selection and rotation mechanism will be applied.
95+
selectedPool: ""
96+
9397
# Configure PostgreSQL containers
9498
databaseContainer: &db_container
9599
# Database Lab provisions thin clones using Docker containers and uses auxiliary containers.

Diff for: configs/config.example.physical_walg.yml

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ poolManager:
9090
# Snapshots with this suffix are considered preliminary. They are not supposed to be accessible to end-users.
9191
preSnapshotSuffix: "_pre"
9292

93+
# Force selection of a working pool inside the `mountDir`.
94+
# It is an empty string by default which means that the standard selection and rotation mechanism will be applied.
95+
selectedPool: ""
96+
9397
# Configure PostgreSQL containers
9498
databaseContainer: &db_container
9599
# Database Lab provisions thin clones using Docker containers and uses auxiliary containers.

Diff for: internal/provision/pool/pool_manager.go

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package pool
66

77
import (
88
"container/list"
9+
"fmt"
910
"os"
1011
"path"
1112
"sync"
@@ -46,6 +47,7 @@ type Config struct {
4647
SocketSubDir string `yaml:"socketSubDir"`
4748
ObserverSubDir string `yaml:"observerSubDir"`
4849
PreSnapshotSuffix string `yaml:"preSnapshotSuffix"`
50+
SelectedPool string `yaml:"selectedPool"`
4951
}
5052

5153
// NewPoolManager creates a new pool manager.
@@ -266,6 +268,11 @@ func (pm *Manager) examineEntries(entries []os.DirEntry) (map[string]FSManager,
266268

267269
log.Msg("Discovering: ", dataPath)
268270

271+
if pm.cfg.SelectedPool != "" && pm.cfg.SelectedPool != entry.Name() {
272+
log.Msg(fmt.Sprintf("Skip the entry %q as it doesn't match with the selected pool %s", entry.Name(), pm.cfg.SelectedPool))
273+
continue
274+
}
275+
269276
fsType, err := pm.getFSInfo(dataPath)
270277
if err != nil {
271278
log.Msg("failed to get a filesystem info: ", err.Error())

0 commit comments

Comments
 (0)