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

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

Issue 1863973002: LogDog: Update to archival V2. (Closed) Base URL: https://github.com/luci/luci-go@grpcutil-errors
Patch Set: Fix proto comment. Created 4 years, 8 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
« no previous file with comments | « server/internal/logdog/archivist/storageSource.go ('k') | server/internal/logdog/service/service.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/internal/logdog/collector/collector.go
diff --git a/server/internal/logdog/collector/collector.go b/server/internal/logdog/collector/collector.go
index 90d055278688ecebb61f36fd5f52fd5b9a23a7ad..8884c9550ed1042b3e56556d7a85ec68747e181e 100644
--- a/server/internal/logdog/collector/collector.go
+++ b/server/internal/logdog/collector/collector.go
@@ -163,6 +163,17 @@ type bundleEntryHandler struct {
// processLogStream processes an individual set of log messages belonging to the
// same log stream.
func (c *Collector) processLogStream(ctx context.Context, h *bundleEntryHandler) error {
+ // If this bundle has neither log entries nor a terminal index, it is junk and
+ // must be discarded.
+ //
+ // This is more important than a basic optimization, as it enforces that no
+ // zero-entry log streams can be ingested. Either some entries exist, or there
+ // is a promise of a terminal entry.
+ if len(h.be.Logs) == 0 && !h.be.Terminal {
+ log.Warningf(ctx, "Bundle entry is non-terminal and contains no logs; discarding.")
+ return nil
+ }
+
if err := h.be.Desc.Validate(true); err != nil {
log.Errorf(log.SetError(ctx, err), "Invalid log stream descriptor.")
return err
« no previous file with comments | « server/internal/logdog/archivist/storageSource.go ('k') | server/internal/logdog/service/service.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698