Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add detailed log for readreplica rotator #2281

Merged
merged 4 commits into from
Dec 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pkg/index/job/readreplica/rotate/service/rotator.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

newPvc, oldPvc, err := r.createPVC(ctx, newSnap.Name)
if err != nil {
log.Infof("failed to create PVC. removing the new snapshot(%v)...", newSnap.Name)
log.Errorf("failed to create PVC. removing the new snapshot(%v)...", newSnap.Name)

Check warning on line 119 in pkg/index/job/readreplica/rotate/service/rotator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/readreplica/rotate/service/rotator.go#L119

Added line #L119 was not covered by tests
if dserr := r.deleteSnapshot(ctx, newSnap); dserr != nil {
errors.Join(err, dserr)
}
Expand All @@ -125,7 +125,7 @@

err = r.updateDeployment(ctx, newPvc.GetName())
if err != nil {
log.Infof("failed to update Deployment. removing the new snapshot(%v) and pvc(%v)...", newSnap.Name, newPvc.Name)
log.Errorf("failed to update Deployment. removing the new snapshot(%v) and pvc(%v)...", newSnap.Name, newPvc.Name)

Check warning on line 128 in pkg/index/job/readreplica/rotate/service/rotator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/readreplica/rotate/service/rotator.go#L128

Added line #L128 was not covered by tests
if dperr := r.deletePVC(ctx, newPvc); dperr != nil {
errors.Join(err, dperr)
}
Expand Down Expand Up @@ -172,6 +172,9 @@
Spec: cur.Spec,
}

log.Infof("creating new snapshot(%s)...", newSnap.GetName())
log.Debugf("snapshot detail: %+v", newSnap)

Check warning on line 177 in pkg/index/job/readreplica/rotate/service/rotator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/readreplica/rotate/service/rotator.go#L175-L177

Added lines #L175 - L177 were not covered by tests
err = r.client.Create(ctx, newSnap)
if err != nil {
return nil, nil, fmt.Errorf("failed to create snapshot: %w", err)
Expand Down Expand Up @@ -214,6 +217,9 @@
},
}

log.Infof("creating new pvc(%s)...", newPvc.GetName())
log.Debugf("pvc detail: %+v", newPvc)

Check warning on line 222 in pkg/index/job/readreplica/rotate/service/rotator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/readreplica/rotate/service/rotator.go#L220-L222

Added lines #L220 - L222 were not covered by tests
if err := r.client.Create(ctx, newPvc); err != nil {
return nil, nil, fmt.Errorf("failed to create PVC(%s): %w", newPvc.GetName(), err)
}
Expand Down Expand Up @@ -242,6 +248,9 @@
}
}

log.Infof("updating deployment(%s)...", deployment.GetName())
log.Debugf("deployment detail: %+v", deployment)

Check warning on line 253 in pkg/index/job/readreplica/rotate/service/rotator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/readreplica/rotate/service/rotator.go#L251-L253

Added lines #L251 - L253 were not covered by tests
if err := r.client.Update(ctx, &deployment); err != nil {
return fmt.Errorf("failed to update deployment: %w", err)
}
Expand All @@ -263,7 +272,8 @@

eg, egctx := errgroup.New(ctx)
eg.Go(func() error {
log.Infof("deleting volume snapshot(%v)...", snapshot.GetName())
log.Infof("deleting volume snapshot(%s)...", snapshot.GetName())
log.Debugf("volume snapshot detail: %+v", snapshot)

Check warning on line 276 in pkg/index/job/readreplica/rotate/service/rotator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/readreplica/rotate/service/rotator.go#L275-L276

Added lines #L275 - L276 were not covered by tests
for {
select {
case <-egctx.Done():
Expand Down Expand Up @@ -300,6 +310,7 @@
eg, egctx := errgroup.New(ctx)
eg.Go(func() error {
log.Infof("deleting PVC(%s)...", pvc.GetName())
log.Debugf("PVC detail: %+v", pvc)

Check warning on line 313 in pkg/index/job/readreplica/rotate/service/rotator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/job/readreplica/rotate/service/rotator.go#L313

Added line #L313 was not covered by tests
for {
select {
case <-egctx.Done():
Expand Down
Loading