From 417d98fa2e5e60a0ed623a4e406918c5cacfd500 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 12 Jun 2025 10:34:46 +0200 Subject: syz-cluster: avoid UUIDs in blob store Make blob store URIs dependent on the IDs explicitly passed into the Write() function. In many cases this removes the need to distinguish between the case when the object has already been saved and we must overwrite it and when it's saved the first time. Keep on first storing the object to the blob storage and only then submitting the entities to Spanner. This will lead to some wasted space, but we'll add garbage collection at some point. --- syz-cluster/controller/processor.go | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'syz-cluster/controller') diff --git a/syz-cluster/controller/processor.go b/syz-cluster/controller/processor.go index 07851a9fa..e634ad5e5 100644 --- a/syz-cluster/controller/processor.go +++ b/syz-cluster/controller/processor.go @@ -138,7 +138,7 @@ func (sp *SeriesProcessor) handleSession(ctx context.Context, session *db.Sessio app.Errorf("failed to query workflow %q status: %v", session.ID, err) continue } - if workflowLog != nil { + if len(workflowLog) > 0 { err := sp.updateSessionLog(ctx, session, workflowLog) if err != nil { app.Errorf("failed to update session log: %v", err) @@ -214,19 +214,12 @@ func (sp *SeriesProcessor) stopRunningTests(ctx context.Context, sessionID strin } func (sp *SeriesProcessor) updateSessionLog(ctx context.Context, session *db.Session, log []byte) error { + logURI, err := sp.blobStorage.Write(bytes.NewReader(log), "Session", session.ID, "log") + if err != nil { + return fmt.Errorf("failed to save the log: %w", err) + } return sp.sessionRepo.Update(ctx, session.ID, func(session *db.Session) error { - if session.LogURI == "" { - path, err := sp.blobStorage.Store(bytes.NewReader(log)) - if err != nil { - return fmt.Errorf("failed to save the log: %w", err) - } - session.LogURI = path - } else { - err := sp.blobStorage.Update(session.LogURI, bytes.NewReader(log)) - if err != nil { - return fmt.Errorf("failed to update the log %q: %w", session.LogURI, err) - } - } + session.LogURI = logURI return nil }) } -- cgit mrf-deployment