Skip to content

Commit

Permalink
Merge branch 'main' into K8SPXC-1155
Browse files Browse the repository at this point in the history
  • Loading branch information
nmarukovich authored Oct 2, 2024
2 parents 671b9df + 54b9fd3 commit ea892c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 8 additions & 2 deletions cmd/pitr/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func (c *Collector) manageBinlog(ctx context.Context, binlog pxc.Binlog) (err er
return errors.Wrapf(err, "put %s object", binlog.Name)
}

log.Println("Successfully written binlog file", binlog.Name, "to s3 with name", binlogName)
log.Println("Successfully wrote binlog file", binlog.Name, "to storage with name", binlogName)

err = cmd.Wait()
if err != nil {
Expand All @@ -502,7 +502,13 @@ func (c *Collector) manageBinlog(ctx context.Context, binlog pxc.Binlog) (err er
// nolint:errcheck
setBuffer.WriteString(binlog.GTIDSet.Raw())

err = c.storage.PutObject(ctx, lastSetFilePrefix+strings.Split(gtidSet, ":")[0], &setBuffer, int64(setBuffer.Len()))
lastSetName := lastSetFilePrefix+strings.Split(gtidSet, ":")[0]

// remove any newline characters from the last set name
lastSetName = strings.ReplaceAll(lastSetName, "\n", "")
lastSetName = strings.ReplaceAll(lastSetName, "\r", "")

err = c.storage.PutObject(ctx, lastSetName, &setBuffer, int64(setBuffer.Len()))
if err != nil {
return errors.Wrap(err, "put last-set object")
}
Expand Down
8 changes: 2 additions & 6 deletions pkg/controller/pxc/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,19 +503,15 @@ func (r *ReconcilePerconaXtraDBCluster) reconcileHAProxy(ctx context.Context, cr

if cr.HAProxyReplicasServiceEnabled() {
svc := pxc.NewServiceHAProxyReplicas(cr)
err := setControllerReference(cr, svc, r.scheme)
if err != nil {
return errors.Wrapf(err, "%s setControllerReference", svc.Name)
}

if cr.CompareVersionWith("1.14.0") >= 0 {
e := cr.Spec.HAProxy.ExposeReplicas
err = r.createOrUpdateService(ctx, cr, svc, len(e.ServiceExpose.Labels) == 0 && len(e.ServiceExpose.Annotations) == 0)
err := r.createOrUpdateService(ctx, cr, svc, len(e.ServiceExpose.Labels) == 0 && len(e.ServiceExpose.Annotations) == 0)
if err != nil {
return errors.Wrapf(err, "%s upgrade error", svc.Name)
}
} else {
err = r.createOrUpdateService(ctx, cr, svc, len(podSpec.ReplicasServiceLabels) == 0 && len(podSpec.ReplicasServiceAnnotations) == 0)
err := r.createOrUpdateService(ctx, cr, svc, len(podSpec.ReplicasServiceLabels) == 0 && len(podSpec.ReplicasServiceAnnotations) == 0)
if err != nil {
return errors.Wrapf(err, "%s upgrade error", svc.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pxc/backup/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (a *Azure) PutObject(ctx context.Context, name string, data io.Reader, _ in
}

func (a *Azure) ListObjects(ctx context.Context, prefix string) ([]string, error) {
listPrefix := path.Join(a.prefix, prefix) + "/"
listPrefix := path.Join(a.prefix, prefix)
pg := a.client.NewListBlobsFlatPager(a.container, &container.ListBlobsFlatOptions{
Prefix: &listPrefix,
})
Expand Down

0 comments on commit ea892c3

Please sign in to comment.