1970 11 tracker fails redo (#2624)
#### Type of change - [x] 🐛 Bugfix #### Issue(s) * #1970 #### Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
a5ecc8dd7e
commit
1459e1406c
@ -126,24 +126,33 @@ func (c Contacts) EnumerateContainers(
|
|||||||
With("options_fields", fields)
|
With("options_fields", fields)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
et := errs.Tracker()
|
||||||
builder := service.Client().
|
builder := service.Client().
|
||||||
UsersById(userID).
|
UsersById(userID).
|
||||||
ContactFoldersById(baseDirID).
|
ContactFoldersById(baseDirID).
|
||||||
ChildFolders()
|
ChildFolders()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
if et.Err() != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := builder.Get(ctx, ofcf)
|
resp, err := builder.Get(ctx, ofcf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, fold := range resp.GetValue() {
|
for _, fold := range resp.GetValue() {
|
||||||
if errs.Err() != nil {
|
if et.Err() != nil {
|
||||||
return errs.Err()
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := checkIDAndName(fold); err != nil {
|
if err := checkIDAndName(fold); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...))
|
et.Add(clues.Stack(err).
|
||||||
|
WithClues(ctx).
|
||||||
|
With(graph.ErrData(err)...).
|
||||||
|
Label(fault.LabelForceNoBackupCreation))
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +163,11 @@ func (c Contacts) EnumerateContainers(
|
|||||||
|
|
||||||
temp := graph.NewCacheFolder(fold, nil, nil)
|
temp := graph.NewCacheFolder(fold, nil, nil)
|
||||||
if err := fn(temp); err != nil {
|
if err := fn(temp); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(fctx).With(graph.ErrData(err)...))
|
et.Add(clues.Stack(err).
|
||||||
|
WithClues(fctx).
|
||||||
|
With(graph.ErrData(err)...).
|
||||||
|
Label(fault.LabelForceNoBackupCreation))
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +180,7 @@ func (c Contacts) EnumerateContainers(
|
|||||||
builder = users.NewItemContactFoldersItemChildFoldersRequestBuilder(link, service.Adapter())
|
builder = users.NewItemContactFoldersItemChildFoldersRequestBuilder(link, service.Adapter())
|
||||||
}
|
}
|
||||||
|
|
||||||
return errs.Err()
|
return et.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@ -153,18 +153,31 @@ func (c Events) EnumerateContainers(
|
|||||||
return clues.Wrap(err, "setting calendar options").WithClues(ctx).With(graph.ErrData(err)...)
|
return clues.Wrap(err, "setting calendar options").WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
et := errs.Tracker()
|
||||||
builder := service.Client().UsersById(userID).Calendars()
|
builder := service.Client().UsersById(userID).Calendars()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
if et.Err() != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := builder.Get(ctx, ofc)
|
resp, err := builder.Get(ctx, ofc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, cal := range resp.GetValue() {
|
for _, cal := range resp.GetValue() {
|
||||||
|
if et.Err() != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
cd := CalendarDisplayable{Calendarable: cal}
|
cd := CalendarDisplayable{Calendarable: cal}
|
||||||
if err := checkIDAndName(cd); err != nil {
|
if err := checkIDAndName(cd); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...))
|
et.Add(clues.Stack(err).
|
||||||
|
WithClues(ctx).
|
||||||
|
With(graph.ErrData(err)...).
|
||||||
|
Label(fault.LabelForceNoBackupCreation))
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +191,11 @@ func (c Events) EnumerateContainers(
|
|||||||
path.Builder{}.Append(ptr.Val(cd.GetId())), // storage path
|
path.Builder{}.Append(ptr.Val(cd.GetId())), // storage path
|
||||||
path.Builder{}.Append(ptr.Val(cd.GetDisplayName()))) // display location
|
path.Builder{}.Append(ptr.Val(cd.GetDisplayName()))) // display location
|
||||||
if err := fn(temp); err != nil {
|
if err := fn(temp); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(fctx).With(graph.ErrData(err)...))
|
et.Add(clues.Stack(err).
|
||||||
|
WithClues(fctx).
|
||||||
|
With(graph.ErrData(err)...).
|
||||||
|
Label(fault.LabelForceNoBackupCreation))
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +208,7 @@ func (c Events) EnumerateContainers(
|
|||||||
builder = users.NewItemCalendarsRequestBuilder(link, service.Adapter())
|
builder = users.NewItemCalendarsRequestBuilder(link, service.Adapter())
|
||||||
}
|
}
|
||||||
|
|
||||||
return errs.Err()
|
return et.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@ -171,18 +171,27 @@ func (c Mail) EnumerateContainers(
|
|||||||
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
et := errs.Tracker()
|
||||||
builder := service.Client().
|
builder := service.Client().
|
||||||
UsersById(userID).
|
UsersById(userID).
|
||||||
MailFolders().
|
MailFolders().
|
||||||
Delta()
|
Delta()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
if et.Err() != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := builder.Get(ctx, nil)
|
resp, err := builder.Get(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
return clues.Stack(err).WithClues(ctx).With(graph.ErrData(err)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range resp.GetValue() {
|
for _, v := range resp.GetValue() {
|
||||||
|
if et.Err() != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
fctx := clues.Add(
|
fctx := clues.Add(
|
||||||
ctx,
|
ctx,
|
||||||
"container_id", ptr.Val(v.GetId()),
|
"container_id", ptr.Val(v.GetId()),
|
||||||
@ -190,7 +199,11 @@ func (c Mail) EnumerateContainers(
|
|||||||
|
|
||||||
temp := graph.NewCacheFolder(v, nil, nil)
|
temp := graph.NewCacheFolder(v, nil, nil)
|
||||||
if err := fn(temp); err != nil {
|
if err := fn(temp); err != nil {
|
||||||
errs.Add(clues.Stack(err).WithClues(fctx).With(graph.ErrData(err)...))
|
et.Add(clues.Stack(err).
|
||||||
|
WithClues(fctx).
|
||||||
|
With(graph.ErrData(err)...).
|
||||||
|
Label(fault.LabelForceNoBackupCreation))
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +216,7 @@ func (c Mail) EnumerateContainers(
|
|||||||
builder = users.NewItemMailFoldersDeltaRequestBuilder(link, service.Adapter())
|
builder = users.NewItemMailFoldersDeltaRequestBuilder(link, service.Adapter())
|
||||||
}
|
}
|
||||||
|
|
||||||
return errs.Err()
|
return et.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@ -253,7 +253,7 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Errors) {
|
|||||||
atomic.AddInt64(&success, 1)
|
atomic.AddInt64(&success, 1)
|
||||||
log.With("err", err).Infow("item not found", clues.InErr(err).Slice()...)
|
log.With("err", err).Infow("item not found", clues.InErr(err).Slice()...)
|
||||||
} else {
|
} else {
|
||||||
errs.Add(clues.Wrap(err, "fetching item"))
|
errs.Add(clues.Wrap(err, "fetching item").Label(fault.LabelForceNoBackupCreation))
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -261,7 +261,7 @@ func (col *Collection) streamItems(ctx context.Context, errs *fault.Errors) {
|
|||||||
|
|
||||||
data, err := col.items.Serialize(ctx, item, user, id)
|
data, err := col.items.Serialize(ctx, item, user, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs.Add(clues.Wrap(err, "serializing item"))
|
errs.Add(clues.Wrap(err, "serializing item").Label(fault.LabelForceNoBackupCreation))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ func filterContainersAndFillCollections(
|
|||||||
added, removed, newDelta, err := getter.GetAddedAndRemovedItemIDs(ctx, qp.ResourceOwner, cID, prevDelta)
|
added, removed, newDelta, err := getter.GetAddedAndRemovedItemIDs(ctx, qp.ResourceOwner, cID, prevDelta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !graph.IsErrDeletedInFlight(err) {
|
if !graph.IsErrDeletedInFlight(err) {
|
||||||
et.Add(err)
|
et.Add(clues.Stack(err).Label(fault.LabelForceNoBackupCreation))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,7 @@ func (md MetadataCollection) DoNotMergeItems() bool {
|
|||||||
|
|
||||||
func (md MetadataCollection) Items(
|
func (md MetadataCollection) Items(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
errs *fault.Errors,
|
_ *fault.Errors, // not used, just here for interface compliance
|
||||||
) <-chan data.Stream {
|
) <-chan data.Stream {
|
||||||
res := make(chan data.Stream)
|
res := make(chan data.Stream)
|
||||||
|
|
||||||
|
|||||||
@ -273,6 +273,7 @@ func (oc *Collection) populateItems(ctx context.Context) {
|
|||||||
|
|
||||||
errUpdater := func(id string, err error) {
|
errUpdater := func(id string, err error) {
|
||||||
m.Lock()
|
m.Lock()
|
||||||
|
// TODO: Label(fault.LabelForceNoBackupCreation)
|
||||||
errs = support.WrapAndAppend(id, err, errs)
|
errs = support.WrapAndAppend(id, err, errs)
|
||||||
m.Unlock()
|
m.Unlock()
|
||||||
}
|
}
|
||||||
@ -451,6 +452,7 @@ func (oc *Collection) populateItems(ctx context.Context) {
|
|||||||
func (oc *Collection) reportAsCompleted(ctx context.Context, itemsFound, itemsRead int, byteCount int64, errs error) {
|
func (oc *Collection) reportAsCompleted(ctx context.Context, itemsFound, itemsRead int, byteCount int64, errs error) {
|
||||||
close(oc.data)
|
close(oc.data)
|
||||||
|
|
||||||
|
// TODO: add Label(fault.LabelForceNoBackupCreation) to errs
|
||||||
status := support.CreateStatus(ctx, support.Backup,
|
status := support.CreateStatus(ctx, support.Backup,
|
||||||
1, // num folders (always 1)
|
1, // num folders (always 1)
|
||||||
support.CollectionMetrics{
|
support.CollectionMetrics{
|
||||||
|
|||||||
@ -243,7 +243,7 @@ func (sc *Collection) retrieveLists(
|
|||||||
|
|
||||||
byteArray, err := serializeContent(wtr, lst)
|
byteArray, err := serializeContent(wtr, lst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
et.Add(clues.Wrap(err, "serializing list").WithClues(ctx))
|
et.Add(clues.Wrap(err, "serializing list").WithClues(ctx).Label(fault.LabelForceNoBackupCreation))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ func (sc *Collection) retrievePages(
|
|||||||
|
|
||||||
byteArray, err := serializeContent(wtr, pg)
|
byteArray, err := serializeContent(wtr, pg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
et.Add(clues.Wrap(err, "serializing page").WithClues(ctx))
|
et.Add(clues.Wrap(err, "serializing page").WithClues(ctx).Label(fault.LabelForceNoBackupCreation))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ type kopiaDataCollection struct {
|
|||||||
|
|
||||||
func (kdc *kopiaDataCollection) Items(
|
func (kdc *kopiaDataCollection) Items(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
errs *fault.Errors,
|
_ *fault.Errors, // unused, just matching the interface
|
||||||
) <-chan data.Stream {
|
) <-chan data.Stream {
|
||||||
res := make(chan data.Stream)
|
res := make(chan data.Stream)
|
||||||
|
|
||||||
|
|||||||
@ -264,7 +264,8 @@ func (cp *corsoProgress) Error(relpath string, err error, isIgnored bool) {
|
|||||||
defer cp.UploadProgress.Error(relpath, err, isIgnored)
|
defer cp.UploadProgress.Error(relpath, err, isIgnored)
|
||||||
|
|
||||||
cp.errs.Add(clues.Wrap(err, "kopia reported error").
|
cp.errs.Add(clues.Wrap(err, "kopia reported error").
|
||||||
With("is_ignored", isIgnored, "relative_path", relpath))
|
With("is_ignored", isIgnored, "relative_path", relpath).
|
||||||
|
Label(fault.LabelForceNoBackupCreation))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cp *corsoProgress) put(k string, v *itemDetails) {
|
func (cp *corsoProgress) put(k string, v *itemDetails) {
|
||||||
|
|||||||
@ -410,13 +410,16 @@ func (w Wrapper) RestoreMultipleItems(
|
|||||||
|
|
||||||
ds, err := getItemStream(ctx, itemPath, snapshotRoot, bcounter)
|
ds, err := getItemStream(ctx, itemPath, snapshotRoot, bcounter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
et.Add(err)
|
et.Add(clues.Stack(err).Label(fault.LabelForceNoBackupCreation))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
parentPath, err := itemPath.Dir()
|
parentPath, err := itemPath.Dir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
et.Add(clues.Wrap(err, "making directory collection").WithClues(ctx))
|
et.Add(clues.Wrap(err, "making directory collection").
|
||||||
|
WithClues(ctx).
|
||||||
|
Label(fault.LabelForceNoBackupCreation))
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -190,6 +190,20 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) {
|
|||||||
return op.Errors.Err()
|
return op.Errors.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// force exit without backup in certain cases.
|
||||||
|
// see: https://github.com/alcionai/corso/pull/2510#discussion_r1113532530
|
||||||
|
for _, e := range op.Errors.Errs() {
|
||||||
|
if clues.HasLabel(e, fault.LabelForceNoBackupCreation) {
|
||||||
|
logger.Ctx(ctx).
|
||||||
|
With("error", e).
|
||||||
|
With(clues.InErr(err).Slice()...).
|
||||||
|
Infow("completed backup; conditional error forcing exit without model persistence",
|
||||||
|
"results", op.Results)
|
||||||
|
|
||||||
|
return op.Errors.Fail(errors.Wrap(e, "forced backup")).Err()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = op.createBackupModels(
|
err = op.createBackupModels(
|
||||||
ctx,
|
ctx,
|
||||||
detailsStore,
|
detailsStore,
|
||||||
|
|||||||
@ -169,3 +169,7 @@ func (e *tracker) Add(err error) {
|
|||||||
func (e *tracker) Err() error {
|
func (e *tracker) Err() error {
|
||||||
return e.current
|
return e.current
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// temporary hack identifier
|
||||||
|
// see: https://github.com/alcionai/corso/pull/2510#discussion_r1113532530
|
||||||
|
const LabelForceNoBackupCreation = "label_forces_no_backup_creations"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user