diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-06-12 10:34:46 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-06-17 08:59:03 +0000 |
| commit | 417d98fa2e5e60a0ed623a4e406918c5cacfd500 (patch) | |
| tree | 88c5ccf815967870da4c81c2afd28ca9c635b65f /syz-cluster/controller/processor.go | |
| parent | 74c9d2523829e2f377ef7ee2e819a04ead202264 (diff) | |
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.
Diffstat (limited to 'syz-cluster/controller/processor.go')
| -rw-r--r-- | syz-cluster/controller/processor.go | 19 |
1 files changed, 6 insertions, 13 deletions
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 }) } |
