Skip to content
3 changes: 3 additions & 0 deletions service/worker/handler/diff_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/hibiken/asynq"
"github.com/redis/go-redis/v9"
"github.com/rs/zerolog"

"github.com/clyso/chorus/pkg/dom"
"github.com/clyso/chorus/pkg/entity"
Expand Down Expand Up @@ -803,6 +804,7 @@ func (r *DiffSvc) EnsureObjectsDeleted(ctx context.Context, id entity.DiffFixID,
return fmt.Errorf("unable to get objects to remove: %w", err)
}

zerolog.Ctx(ctx).Info().Int("count", len(objectsToRemove)).Msg("EnsureObjectsDeleted: checking objects to remove")
client, err := r.clients.AsCommon(ctx, location.Storage, user)
if err != nil {
return fmt.Errorf("unable to obtain client: %w", err)
Expand Down Expand Up @@ -833,6 +835,7 @@ func (r *DiffSvc) EnsureObjectsDeleted(ctx context.Context, id entity.DiffFixID,
return fmt.Errorf("unable to get objects to copy: %w", err)
}

zerolog.Ctx(ctx).Info().Int("count", len(objectsToCopy)).Msg("EnsureObjectsDeleted: enqueuing copy tasks")
Comment thread
sarwottamdev marked this conversation as resolved.
Outdated
for _, object := range objectsToCopy {
payload, err := makePayload(object.Name, object.IsDir)
if err != nil {
Expand Down
12 changes: 10 additions & 2 deletions service/worker/handler/migration_obj_copy_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ func (s *svc) HandleMigrationObjCopy(ctx context.Context, t *asynq.Task) (err er
}
fromVer, toVer := versions.From, versions.To

if fromVer != 0 && fromVer <= toVer {
isDiffFix := t.Type() == tasks.TypeDiffFixCopyS3
if !isDiffFix && fromVer != 0 && fromVer <= toVer {
logger.Info().Int("from_ver", fromVer).Int("to_ver", toVer).Msg("migration obj copy: identical from/to obj version: skip copy")
return nil
}
if isDiffFix {
logger.Warn().Int("from_ver", fromVer).Int("to_ver", toVer).Msg("diff fix copy: proceeding with copy despite version check")
Comment thread
sarwottamdev marked this conversation as resolved.
Outdated
}
// 1. sync obj meta and content
err = lock.Do(ctx, time.Second*2, func() error {
return s.copySvc.CopyObject(ctx, p.ID.User(), copy.File{
Expand Down Expand Up @@ -105,7 +109,11 @@ func (s *svc) HandleMigrationObjCopy(ctx context.Context, t *asynq.Task) (err er
return fmt.Errorf("migration obj copy: unable to update obj meta: %w", err)
}
}
logger.Info().Msg("migration obj copy: done")
if isDiffFix {
logger.Info().Msg("diff fix copy: object copied successfully")
} else {
logger.Info().Msg("migration obj copy: done")
}

return nil
}