From d3af9ca2896447b5bcb2033bd43efb2f631f41f7 Mon Sep 17 00:00:00 2001 From: Ais8Ooz8 <47941654+Ais8Ooz8@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:17:38 +0300 Subject: [PATCH] etcdctl: add etcdctl snapshot pipe command --- client/v3/snapshot/v3_snapshot.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/v3/snapshot/v3_snapshot.go b/client/v3/snapshot/v3_snapshot.go index 913550dcf028..ac4aba5a7386 100644 --- a/client/v3/snapshot/v3_snapshot.go +++ b/client/v3/snapshot/v3_snapshot.go @@ -44,7 +44,7 @@ func hasChecksum(n int64) bool { // context.DeadlineExceeded). Make sure to specify only one endpoint // in client configuration. Snapshot API must be requested to a // selected node, and saved snapshot is the point-in-time state of -// the selected GetSnapshotWithVersion. Etcd < v3.6 will return "" as version. +// the selected node. Etcd < v3.6 will return "" as version. func GetSnapshotWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, f *os.File) (string, error) { cfg.Logger = lg.Named("client") if len(cfg.Endpoints) != 1 { @@ -103,10 +103,10 @@ func SaveWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, d return "", fmt.Errorf("could not open %s (%v)", partPath, err) } lg.Info("created temporary db file", zap.String("path", partPath)) - + defer os.RemoveAll(partPath) defer f.Close() - + return GetSnapshotWithVersion(ctx, lg, cfg, f) }