Skip to content

Commit bba8a1b

Browse files
committed
feat: disable pgbackrest timestamp logging
Our task logs have a separate `timestamp` field, so disabling these timestamps will make the task logs easier to consume consistently. PLAT-33
1 parent ea72b00 commit bba8a1b

File tree

4 files changed

+8
-23
lines changed

4 files changed

+8
-23
lines changed

server/internal/orchestrator/swarm/pgbackrest_restore.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ func (p *PgBackRestRestore) runRestoreContainer(
230230
limits = *swarmService.Spec.TaskTemplate.Resources.Limits
231231
}
232232
containerSpec := swarmService.Spec.TaskTemplate.ContainerSpec
233+
opts := append([]string{"--log-timestamp=n"}, p.Options...)
233234
containerID, err := dockerClient.ContainerRun(ctx, docker.ContainerRunOptions{
234235
Config: &container.Config{
235236
Image: containerSpec.Image,
@@ -240,7 +241,7 @@ func (p *PgBackRestRestore) runRestoreContainer(
240241
"pgedge.component": "pgbackrest-restore",
241242
},
242243
Hostname: containerSpec.Hostname,
243-
Entrypoint: PgBackRestRestoreCmd("restore", p.Options...).StringSlice(),
244+
Entrypoint: PgBackRestRestoreCmd("restore", opts...).StringSlice(),
244245
},
245246
Host: &container.HostConfig{
246247
Mounts: containerSpec.Mounts,

server/internal/pgbackrest/cmd.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ type BackupOptions struct {
5555
}
5656

5757
func (b BackupOptions) StringSlice() []string {
58-
var options []string
59-
options = append(options, "--type", b.Type.String())
58+
options := []string{
59+
"--log-timestamp=n",
60+
"--type", b.Type.String(),
61+
}
6062
for k, v := range b.Annotations {
6163
options = append(options, "--annotation", k+"="+v)
6264
}

server/internal/workflows/activities/delete_db_entities.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ import (
1313

1414
"github.com/pgEdge/control-plane/server/internal/database"
1515
"github.com/pgEdge/control-plane/server/internal/resource"
16-
"github.com/pgEdge/control-plane/server/internal/task"
1716
)
1817

1918
type DeleteDbEntitiesInput struct {
20-
DatabaseID uuid.UUID `json:"database_id"`
21-
DeleteTaskID uuid.UUID `json:"delete_task_id"`
19+
DatabaseID uuid.UUID `json:"database_id"`
2220
}
2321

2422
type DeleteDbEntitiesOutput struct{}
@@ -57,21 +55,6 @@ func (a *Activities) DeleteDbEntities(ctx context.Context, input *DeleteDbEntiti
5755
if err != nil && !errors.Is(err, database.ErrDatabaseNotFound) {
5856
return nil, fmt.Errorf("failed to delete database: %w", err)
5957
}
60-
tasks, err := a.TaskSvc.GetTasks(ctx, input.DatabaseID, task.TaskListOptions{})
61-
if err != nil {
62-
return nil, fmt.Errorf("failed to list tasks: %w", err)
63-
}
64-
for _, t := range tasks {
65-
// We want to leave the delete task in place so that API clients can
66-
// track the delete through to completion.
67-
if t.TaskID == input.DeleteTaskID {
68-
continue
69-
}
70-
err = a.TaskSvc.DeleteTask(ctx, input.DatabaseID, t.TaskID)
71-
if err != nil {
72-
return nil, fmt.Errorf("failed to delete task: %w", err)
73-
}
74-
}
7558

7659
return &DeleteDbEntitiesOutput{}, nil
7760
}

server/internal/workflows/delete_database.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ func (w *Workflows) DeleteDatabase(ctx workflow.Context, input *DeleteDatabaseIn
7777
}
7878

7979
deleteInput := &activities.DeleteDbEntitiesInput{
80-
DatabaseID: input.DatabaseID,
81-
DeleteTaskID: input.TaskID,
80+
DatabaseID: input.DatabaseID,
8281
}
8382
_, err = w.Activities.ExecuteDeleteDbEntities(ctx, deleteInput).Get(ctx)
8483
if err != nil {

0 commit comments

Comments
 (0)