Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7252a3c

Browse filesBrowse files
committed
Merge branch 'v2.0' into 'master'
port fixes from 2.0 branch See merge request postgres-ai/database-lab!203
2 parents f55e065 + 11c452d commit 7252a3c
Copy full SHA for 7252a3c

File tree

Expand file treeCollapse file tree

3 files changed

+26
-19
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+26
-19
lines changed

‎.gitlab-ci.yml

Copy file name to clipboardExpand all lines: .gitlab-ci.yml
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ build-image-latest-server:
171171
REGISTRY: "${DH_CI_REGISTRY}"
172172
DOCKER_FILE: "Dockerfile.dblab-server"
173173
DOCKER_NAME: "postgresai/dblab-server"
174-
TAGS: "${DOCKER_NAME}:latest,${DOCKER_NAME}:${CI_COMMIT_TAG}"
174+
before_script:
175+
- export LATEST_TAG=$(echo ${CI_COMMIT_TAG%.*}-latest)
176+
- export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CI_COMMIT_TAG}"
175177

176178
build-image-latest-client:
177179
<<: *build_image_definition
@@ -182,7 +184,9 @@ build-image-latest-client:
182184
REGISTRY: "${DH_CI_REGISTRY}"
183185
DOCKER_FILE: "Dockerfile.dblab"
184186
DOCKER_NAME: "postgresai/dblab"
185-
TAGS: "${DOCKER_NAME}:latest,${DOCKER_NAME}:${CI_COMMIT_TAG}"
187+
before_script:
188+
- export LATEST_TAG=$(echo ${CI_COMMIT_TAG%.*}-latest)
189+
- export TAGS="${DOCKER_NAME}:${LATEST_TAG},${DOCKER_NAME}:${CI_COMMIT_TAG}"
186190

187191
build-image-rc-server:
188192
<<: *build_image_definition
@@ -212,4 +216,6 @@ build-image-swagger-latest:
212216
variables:
213217
DOCKER_FILE: "Dockerfile.swagger-ui"
214218
DOCKER_NAME: "registry.gitlab.com/postgres-ai/database-lab/dblab-swagger-ui"
215-
TAGS: "${DOCKER_NAME}:latest"
219+
before_script:
220+
- export LATEST_TAG=$(echo ${CI_COMMIT_TAG%.*}-latest)
221+
- export TAGS="${DOCKER_NAME}:${LATEST_TAG}"

‎pkg/retrieval/engine/postgres/snapshot/physical.go

Copy file name to clipboardExpand all lines: pkg/retrieval/engine/postgres/snapshot/physical.go
+12-11Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ type PhysicalInitial struct {
7676
dbMark *dbmarker.Config
7777
dockerClient *client.Client
7878
scheduler *cron.Cron
79-
scheduleOnce sync.Once
8079
promotionMutex sync.Mutex
8180
}
8281

@@ -188,10 +187,18 @@ func (p *PhysicalInitial) Name() string {
188187
// Run starts the job.
189188
func (p *PhysicalInitial) Run(ctx context.Context) (err error) {
190189
// Start scheduling after initial snapshot.
191-
defer func() {
192-
p.scheduleOnce.Do(p.startScheduler(ctx))
193-
}()
190+
defer p.startScheduler(ctx)()
191+
192+
if p.options.SkipStartSnapshot {
193+
log.Msg("Skip taking a snapshot at the start")
194+
195+
return nil
196+
}
194197

198+
return p.run(ctx)
199+
}
200+
201+
func (p *PhysicalInitial) run(ctx context.Context) (err error) {
195202
select {
196203
case <-ctx.Done():
197204
if p.scheduler != nil {
@@ -204,12 +211,6 @@ func (p *PhysicalInitial) Run(ctx context.Context) (err error) {
204211
default:
205212
}
206213

207-
if p.options.SkipStartSnapshot {
208-
log.Msg("Skip taking a snapshot at the start")
209-
210-
return nil
211-
}
212-
213214
p.dbMark.DataStateAt = extractDataStateAt(p.dbMarker)
214215

215216
// Snapshot data.
@@ -304,7 +305,7 @@ func (p *PhysicalInitial) startScheduler(ctx context.Context) func() {
304305

305306
func (p *PhysicalInitial) runAutoSnapshot(ctx context.Context) func() {
306307
return func() {
307-
if err := p.Run(ctx); err != nil {
308+
if err := p.run(ctx); err != nil {
308309
log.Err(errors.Wrap(err, "failed to take a snapshot automatically"))
309310

310311
log.Msg("Interrupt automatic snapshots")

‎pkg/services/cloning/mode_base.go

Copy file name to clipboardExpand all lines: pkg/services/cloning/mode_base.go
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,11 @@ func (c *baseCloning) UpdateCloneStatus(cloneID string, status models.Status) er
289289
func (c *baseCloning) ResetClone(cloneID string) error {
290290
w, ok := c.findWrapper(cloneID)
291291
if !ok {
292-
return models.New(models.ErrCodeNotFound, "clone not found")
292+
return models.New(models.ErrCodeNotFound, "the clone not found")
293+
}
294+
295+
if w.session == nil {
296+
return models.New(models.ErrCodeNotFound, "clone is not started yet")
293297
}
294298

295299
if err := c.UpdateCloneStatus(cloneID, models.Status{
@@ -299,10 +303,6 @@ func (c *baseCloning) ResetClone(cloneID string) error {
299303
return errors.Wrap(err, "failed to update clone status")
300304
}
301305

302-
if w.session == nil {
303-
return models.New(models.ErrCodeNotFound, "clone is not started yet")
304-
}
305-
306306
go func() {
307307
err := c.provision.ResetSession(w.session, w.snapshot.ID)
308308
if err != nil {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.