Skip to content

Commit 8873f08

Browse files
committed
Merge branch '152-rename-rds-iam-type' into 'master'
fix Database Lab configuration files (#152): * remove excess sections in global config * rename RDS IAM source type * add `--no-owner` option See merge request postgres-ai/database-lab!158
2 parents 2a48523 + a4a8268 commit 8873f08

File tree

7 files changed

+16
-56
lines changed

7 files changed

+16
-56
lines changed

configs/config.example.logical_generic.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ global:
2929
# Database engine. Currently, the only supported option: "postgres".
3030
engine: postgres
3131

32-
# Docker image to perform various tasks, such as:
33-
# - initial data retrieval,
34-
# - continuous data synchronization,
35-
# - pre-processing.
36-
# Default: "official" PostgreSQL image from Docker.
37-
# Alternative: an extended image from the Postgres.ai team,
38-
# containing a number of popular extensions, including those
39-
# RDS provides. See https://postgres.ai/docs/database-lab/supported_databases
40-
dockerImage: "postgres:12-alpine"
41-
4232
# Full path to data directory. This directory must already exist
4333
# before launching Database Lab instance. It may be empty if
4434
# data initialization is configured (see below).

configs/config.example.logical_rds.yml renamed to configs/config.example.logical_rds_iam.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ global:
2929
# Database engine. Currently, the only supported option: "postgres".
3030
engine: postgres
3131

32-
# Docker image to perform various tasks, such as:
33-
# - initial data retrieval,
34-
# - continuous data synchronization,
35-
# - pre-processing.
36-
# Default: "official" PostgreSQL image from Docker.
37-
# Alternative: an extended image from the Postgres.ai team,
38-
# containing a number of popular extensions, including those
39-
# RDS provides. See https://postgres.ai/docs/database-lab/supported_databases
40-
dockerImage: "postgres:12-alpine"
41-
4232
# Full path to data directory. This directory must already exist
4333
# before launching Database Lab instance. It may be empty if
4434
# data initialization is configured (see below).
@@ -146,16 +136,17 @@ retrieval:
146136

147137
# Source of data.
148138
source:
149-
# Source types: "local", "remote", "rds"
150-
type: rds
139+
# Source types: "local", "remote", "rdsIam"
140+
type: rdsIam
141+
151142
# RDS database details for pg_dump
152143
connection:
153144
dbname: test
154145
username: test_user
155146

156147
# Optional definition of RDS data source.
157-
rds:
158-
# RDS policy name.
148+
rdsIam:
149+
# RDS IAM policy name.
159150
iamPolicyName: rds-dblab-retrieval
160151

161152
# AWS Region.

configs/config.example.physical_generic.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ global:
2929
# Database engine. Currently, the only supported option: "postgres".
3030
engine: postgres
3131

32-
# Docker image to perform various tasks, such as:
33-
# - initial data retrieval,
34-
# - continuous data synchronization,
35-
# - pre-processing.
36-
# Default: "official" PostgreSQL image from Docker.
37-
# Alternative: an extended image from the Postgres.ai team,
38-
# containing a number of popular extensions, including those
39-
# RDS provides. See https://postgres.ai/docs/database-lab/supported_databases
40-
dockerImage: "postgres:12-alpine"
41-
4232
# Full path to data directory. This directory must already exist
4333
# before launching Database Lab instance. It may be empty if
4434
# data initialization is configured (see below).

configs/config.example.physical_walg.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ global:
2929
# Database engine. Currently, the only supported option: "postgres".
3030
engine: postgres
3131

32-
# Docker image to perform various tasks, such as:
33-
# - initial data retrieval,
34-
# - continuous data synchronization,
35-
# - pre-processing.
36-
# Default: "official" PostgreSQL image from Docker.
37-
# Alternative: an extended image from the Postgres.ai team,
38-
# containing a number of popular extensions, including those
39-
# RDS provides. See https://postgres.ai/docs/database-lab/supported_databases
40-
dockerImage: "postgres:12-alpine"
41-
4232
# Full path to data directory. This directory must already exist
4333
# before launching Database Lab instance. It may be empty if
4434
# data initialization is configured (see below).

pkg/retrieval/engine/postgres/logical/dump.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const (
4242
// Defines dump source types.
4343
sourceTypeLocal = "local"
4444
sourceTypeRemote = "remote"
45-
sourceTypeRDS = "rds"
45+
sourceTypeRDS = "rdsIam"
4646

4747
// reservePort defines reserve port in case of a local dump.
4848
reservePort = 9999
@@ -79,7 +79,7 @@ type DumpOptions struct {
7979
type Source struct {
8080
Type string `yaml:"type"`
8181
Connection Connection `yaml:"connection"`
82-
RDS *RDSConfig `yaml:"rds"`
82+
RDS *RDSConfig `yaml:"rdsIam"`
8383
}
8484

8585
type dumpJobConfig struct {
@@ -174,12 +174,12 @@ func (d *DumpJob) setupDumper() error {
174174

175175
case sourceTypeRDS:
176176
if d.Source.RDS == nil {
177-
return errors.New("the RDS configuration section must not be empty when using the RDS source type")
177+
return errors.New("the RDS IAM configuration section must not be empty when using the RDS IAM source type")
178178
}
179179

180180
dumper, err := newRDSDumper(d.Source.RDS)
181181
if err != nil {
182-
return errors.Wrap(err, "failed to create an RDS dumper")
182+
return errors.Wrap(err, "failed to create an RDS IAM dumper")
183183
}
184184

185185
d.dumper = dumper
@@ -446,7 +446,8 @@ func (d *DumpJob) buildLogicalDumpCommand() []string {
446446
}
447447

448448
func (d *DumpJob) buildLogicalRestoreCommand() []string {
449-
restoreCmd := []string{"|", "pg_restore", "--username", defaults.Username, "--create", "--dbname", defaults.DBName, "--no-privileges"}
449+
restoreCmd := []string{"|", "pg_restore", "--username", defaults.Username, "--create", "--dbname", defaults.DBName,
450+
"--no-privileges", "--no-owner"}
450451

451452
if d.Restore.ForceInit {
452453
restoreCmd = append(restoreCmd, "--clean", "--if-exists")

pkg/retrieval/engine/postgres/logical/restore.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,12 @@ func (r *RestoreJob) retrieveDataStateAt(ctx context.Context, contID string) (st
282282
}
283283

284284
func (r *RestoreJob) buildLogicalRestoreCommand() []string {
285-
restoreCmd := []string{"pg_restore", "--username", defaults.Username, "--dbname", defaults.DBName, "--create", "--no-privileges"}
285+
restoreCmd := []string{"pg_restore", "--username", defaults.Username, "--dbname", defaults.DBName, "--create",
286+
"--no-privileges", "--no-owner"}
286287

287288
if r.ForceInit {
288289
restoreCmd = append(restoreCmd, "--clean", "--if-exists")
289290
}
290-
//else {
291-
// restoreCmd = append(restoreCmd)
292-
//}
293291

294292
restoreCmd = append(restoreCmd, "--jobs", strconv.Itoa(r.ParallelJobs))
295293

pkg/retrieval/engine/postgres/logical/restore_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ func TestRestoreCommandBuilding(t *testing.T) {
2424
ForceInit: false,
2525
DumpFile: "/tmp/db.dump",
2626
},
27-
Command: []string{"pg_restore", "--username", "postgres", "--dbname", "postgres", "--create", "--no-privileges", "--jobs", "1", "/tmp/db.dump"},
27+
Command: []string{"pg_restore", "--username", "postgres", "--dbname", "postgres", "--create", "--no-privileges", "--no-owner", "--jobs", "1", "/tmp/db.dump"},
2828
},
2929
{
3030
CopyOptions: RestoreOptions{
3131
ParallelJobs: 4,
3232
ForceInit: true,
3333
},
34-
Command: []string{"pg_restore", "--username", "postgres", "--dbname", "postgres", "--create", "--no-privileges", "--clean", "--if-exists", "--jobs", "4", ""},
34+
Command: []string{"pg_restore", "--username", "postgres", "--dbname", "postgres", "--create", "--no-privileges", "--no-owner", "--clean", "--if-exists", "--jobs", "4", ""},
3535
},
3636
{
3737
CopyOptions: RestoreOptions{
@@ -40,7 +40,7 @@ func TestRestoreCommandBuilding(t *testing.T) {
4040
Partial: Partial{Tables: []string{"test", "users"}},
4141
DumpFile: "/tmp/db.dump",
4242
},
43-
Command: []string{"pg_restore", "--username", "postgres", "--dbname", "postgres", "--create", "--no-privileges", "--jobs", "1", "--table", "test", "--table", "users", "/tmp/db.dump"},
43+
Command: []string{"pg_restore", "--username", "postgres", "--dbname", "postgres", "--create", "--no-privileges", "--no-owner", "--jobs", "1", "--table", "test", "--table", "users", "/tmp/db.dump"},
4444
},
4545
}
4646

0 commit comments

Comments
 (0)