Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: server/internal/logdog/archivist/archivist.go

Issue 1853433002: LogDog: Handle archive failures. (Closed) Base URL: https://github.com/luci/luci-go@logdog-gs-update
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: server/internal/logdog/archivist/archivist.go
diff --git a/server/internal/logdog/archivist/archivist.go b/server/internal/logdog/archivist/archivist.go
index 1d79af1d0225532985066c380010d92f0ad693f4..e1cb4587a19126bd48ee7c7d64992391f46d8d88 100644
--- a/server/internal/logdog/archivist/archivist.go
+++ b/server/internal/logdog/archivist/archivist.go
@@ -116,7 +116,18 @@ func (a *Archivist) Archive(c context.Context, t *logdog.ArchiveTask) error {
}
if err := task.archive(c); err != nil {
log.WithError(err).Errorf(c, "Failed to perform archival operation.")
- return err
+
+ // Fail only if completeness is a requirement. Allow the Coordinator to
+ // handle errors on !Complete streams.
+ if t.Complete {
+ return err
+ }
+
+ // Report that there was an archival error to the Coordinator's
+ // ArchiveStream endpoint. It may accept the archival or respond with a
+ // FailedPrecondition error code indicating that this archival run should
+ // be considered a failure.
+ task.ar.Error = true
Vadim Sh. 2016/03/31 22:29:59 are transient errors possible in "task.archive"? I
dnj 2016/04/01 22:57:04 They are retried in task.archive already as part o
}
log.Fields{
"streamURL": task.ar.StreamUrl,
@@ -124,6 +135,7 @@ func (a *Archivist) Archive(c context.Context, t *logdog.ArchiveTask) error {
"dataURL": task.ar.DataUrl,
"terminalIndex": task.ar.TerminalIndex,
"complete": task.ar.Complete,
+ "hadError": task.ar.Error,
}.Debugf(c, "Finished archive construction.")
if _, err := a.Service.ArchiveStream(c, &task.ar); err != nil {
@@ -151,6 +163,10 @@ type archiveTask struct {
// Coordinator State. Upon success, the State will be updated with the result
// of the archival operation.
func (t *archiveTask) archive(c context.Context) (err error) {
+ // Minimal ArchiveRequest parameters.
+ t.ar.Path = t.Path
+ t.ar.TerminalIndex = -1
+
// Generate our archival object managers.
bext := t.desc.BinaryFileExt
if bext == "" {
@@ -271,7 +287,6 @@ func (t *archiveTask) archive(c context.Context) (err error) {
}
// Update our state with archival results.
- t.ar.Path = t.Path
t.ar.StreamSize = streamO.Count()
t.ar.IndexSize = indexO.Count()
t.ar.DataSize = dataO.Count()

Powered by Google App Engine
This is Rietveld 408576698