File tree Expand file tree Collapse file tree 4 files changed +47
-7
lines changed
Filter options
pkg/retrieval/engine/postgres Expand file tree Collapse file tree 4 files changed +47
-7
lines changed
Original file line number Diff line number Diff line change @@ -161,6 +161,12 @@ retrieval:
161
161
# Maximum number of health check retries.
162
162
maxRetries : 200
163
163
164
+ # Adjust PostgreSQL configuration of the sync container.
165
+ configs :
166
+ shared_buffers : 1GB
167
+ shared_preload_libraries : " pg_stat_statements"
168
+ work_mem : " 100MB"
169
+
164
170
# Set environment variables here. See https://www.postgresql.org/docs/current/libpq-envars.html
165
171
envs :
166
172
PGUSER : " postgres"
@@ -210,12 +216,18 @@ retrieval:
210
216
# Worker limit for parallel queries.
211
217
maxParallelWorkers : 2
212
218
219
+ # Adjust PostgreSQL configuration of the promotion container.
220
+ configs :
221
+ shared_buffers : 1GB
222
+ shared_preload_libraries : " pg_stat_statements"
223
+ work_mem : " 100MB"
224
+
213
225
# It is possible to define a pre-precessing script. For example, "/tmp/scripts/custom.sh".
214
226
# Default: empty string (no pre-processing defined).
215
227
# This can be used for scrubbing eliminating PII data, to define data masking, etc.
216
228
preprocessingScript : " "
217
229
218
- # Adjust PostgreSQL configuration
230
+ # Adjust PostgreSQL configuration of the snapshot.
219
231
configs :
220
232
# In order to match production plans with Database Lab plans set parameters related to Query Planning as on production.
221
233
shared_buffers : 1GB
Original file line number Diff line number Diff line change @@ -161,6 +161,12 @@ retrieval:
161
161
# Maximum number of health check retries.
162
162
maxRetries : 200
163
163
164
+ # Adjust PostgreSQL configuration of the sync container.
165
+ configs :
166
+ shared_buffers : 1GB
167
+ shared_preload_libraries : " pg_stat_statements"
168
+ work_mem : " 100MB"
169
+
164
170
# Passes custom environment variables to the Docker container with the restoring tool.
165
171
envs :
166
172
WALG_GS_PREFIX : " gs://{BUCKET}/{SCOPE}"
@@ -200,12 +206,18 @@ retrieval:
200
206
# Worker limit for parallel queries.
201
207
maxParallelWorkers : 2
202
208
209
+ # Adjust PostgreSQL configuration of the promotion container.
210
+ configs :
211
+ shared_buffers : 1GB
212
+ shared_preload_libraries : " pg_stat_statements"
213
+ work_mem : " 100MB"
214
+
203
215
# It is possible to define a pre-precessing script. For example, "/tmp/scripts/custom.sh".
204
216
# Default: empty string (no pre-processing defined).
205
217
# This can be used for scrubbing eliminating PII data, to define data masking, etc.
206
218
preprocessingScript : " "
207
219
208
- # Adjust PostgreSQL configuration
220
+ # Adjust PostgreSQL configuration of the snapshot.
209
221
configs :
210
222
# In order to match production plans with Database Lab plans set parameters related to Query Planning as on production.
211
223
shared_buffers : 1GB
Original file line number Diff line number Diff line change @@ -78,8 +78,9 @@ type CopyOptions struct {
78
78
79
79
// Sync describes sync instance options.
80
80
type Sync struct {
81
- Enabled bool `yaml:"enabled"`
82
- HealthCheck HealthCheck `yaml:"healthCheck"`
81
+ Enabled bool `yaml:"enabled"`
82
+ HealthCheck HealthCheck `yaml:"healthCheck"`
83
+ Configs map [string ]string `yaml:"configs"`
83
84
}
84
85
85
86
// HealthCheck describes health check options of a sync instance.
@@ -249,6 +250,13 @@ func (r *RestoreJob) Run(ctx context.Context) (err error) {
249
250
return errors .Wrap (err , "failed to adjust by init parameters" )
250
251
}
251
252
253
+ // Apply sync instance configs.
254
+ if syncConfig := r .CopyOptions .Sync .Configs ; len (syncConfig ) > 0 {
255
+ if err := configuration .NewCorrectorWithExtraConfig (syncConfig ).ApplyExtraConf (dataDir ); err != nil {
256
+ return errors .Wrap (err , "cannot update sync instance configs" )
257
+ }
258
+ }
259
+
252
260
log .Msg ("Configuration has been finished" )
253
261
254
262
return nil
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ type Promotion struct {
91
91
DockerImage string `yaml:"dockerImage"`
92
92
HealthCheck HealthCheck `yaml:"healthCheck"`
93
93
QueryPreprocessing QueryPreprocessing `yaml:"queryPreprocessing"`
94
+ Configs map [string ]string `yaml:"configs"`
94
95
}
95
96
96
97
// HealthCheck describes health check options of a promotion.
@@ -389,9 +390,11 @@ func (p *PhysicalInitial) promoteInstance(ctx context.Context, clonePath string)
389
390
return errors .Wrap (err , "failed to enforce configs" )
390
391
}
391
392
392
- // Apply users configs.
393
- if err := applyUsersConfigs (p .options .Configs , path .Join (clonePath , "postgresql.conf" )); err != nil {
394
- return err
393
+ // Apply promotion configs.
394
+ if syncConfig := p .options .Promotion .Configs ; len (syncConfig ) > 0 {
395
+ if err := configuration .NewCorrectorWithExtraConfig (syncConfig ).ApplyExtraConf (clonePath ); err != nil {
396
+ return errors .Wrap (err , "cannot update promotion configs" )
397
+ }
395
398
}
396
399
397
400
pgVersion , err := tools .DetectPGVersion (clonePath )
@@ -517,6 +520,11 @@ func (p *PhysicalInitial) promoteInstance(ctx context.Context, clonePath string)
517
520
return err
518
521
}
519
522
523
+ // Apply users configs.
524
+ if err := applyUsersConfigs (p .options .Configs , path .Join (clonePath , "postgresql.conf" )); err != nil {
525
+ return err
526
+ }
527
+
520
528
return nil
521
529
}
522
530
You can’t perform that action at this time.
0 commit comments