diff --git a/pkg/agent/internal/metadata/metadata.go b/pkg/agent/internal/metadata/metadata.go index a079a5d208..623b48f6ae 100644 --- a/pkg/agent/internal/metadata/metadata.go +++ b/pkg/agent/internal/metadata/metadata.go @@ -18,6 +18,7 @@ package metadata import ( + "io" "os" "github.com/vdaas/vald/internal/encoding/json" @@ -46,7 +47,7 @@ func Load(path string) (*Metadata, error) { var meta Metadata err = json.Decode(f, &meta) - if err != nil { + if err != nil && err != io.EOF { return nil, err } diff --git a/pkg/agent/sidecar/service/observer/observer.go b/pkg/agent/sidecar/service/observer/observer.go index ee077c807c..f5ed32d553 100644 --- a/pkg/agent/sidecar/service/observer/observer.go +++ b/pkg/agent/sidecar/service/observer/observer.go @@ -153,6 +153,7 @@ func (o *observer) PostStop(ctx context.Context) (err error) { backup := func() error { metadata, err := metadata.Load(o.metadataPath) if err != nil { + log.Warn("cannot read metadata of the backup files:", err) return err } @@ -247,6 +248,7 @@ func (o *observer) startTicker(ctx context.Context) (<-chan error, error) { case <-ct.C: metadata, err := metadata.Load(o.metadataPath) if err != nil { + log.Warn("cannot read metadata of the backup files:", err) ech <- err continue } @@ -324,6 +326,7 @@ func (o *observer) onWrite(ctx context.Context, name string) error { ok, err := o.isValidMetadata() if err != nil { + log.Warn("cannot read metadata of the backup files:", err) return err } @@ -348,6 +351,7 @@ func (o *observer) onCreate(ctx context.Context, name string) error { ok, err := o.isValidMetadata() if err != nil { + log.Warn("cannot read metadata of the backup files:", err) return err }