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

Unified Diff: appengine/logdog/coordinator/logStream.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: appengine/logdog/coordinator/logStream.go
diff --git a/appengine/logdog/coordinator/logStream.go b/appengine/logdog/coordinator/logStream.go
index 4285bd3e4f25dd4708d0e45025d41964cb9ca775..80032b5e961c5adcaf43d7d261a1ed73994d6d16 100644
--- a/appengine/logdog/coordinator/logStream.go
+++ b/appengine/logdog/coordinator/logStream.go
@@ -114,7 +114,12 @@ type LogStream struct {
Source []string
// TerminalIndex is the log stream index of the last log entry in the stream.
- // If the value is -1, the log is still streaming.
+ //
+ // If the value is <0:
Vadim Sh. 2016/03/31 22:29:59 typo: "If" is not needed here
dnj 2016/04/01 22:57:04 Acknowledged.
+ // - If the log is in the LSPending state, the stream is still streaming
+ // without a known terminal index.
+ // - If the log is in LSArchived state, it means that the stream's archival
+ // has completed, but had no log entries.
TerminalIndex int64 `gae:",noindex"`
// ArchiveIndexURL is the Google Storage URL where the log stream's index is
@@ -140,6 +145,11 @@ type LogStream struct {
// ArchiveWhole is true if archival is complete and the archived log stream
// was not missing any entries.
ArchiveWhole bool
+ // ArchiveErrors is the number of errors encountered during archival. This
+ // will be incremented when incomplete archival is permitted, but the archival
+ // still failed due to an error (e.g., data corruption). If this exceeds a
+ // threshold, the stream may be marked archived even if the archival failed.
+ ArchiveErrors int
// _ causes datastore to ignore unrecognized fields and strip them in future
// writes.
@@ -353,6 +363,12 @@ func (s *LogStream) Terminated() bool {
return s.State >= LSTerminated
}
+// Streaming returns true if this log stream is still streaming without a known
+// terminal index.
+func (s *LogStream) Streaming() bool {
+ return (s.State == LSPending && s.TerminalIndex < 0)
+}
+
// Archived returns true if this stream has been archived. A stream is archived
// if it has any of its archival properties set.
func (s *LogStream) Archived() bool {

Powered by Google App Engine
This is Rietveld 408576698