Skip to content

Commit

Permalink
etcdctl: add etcdctl snapshot pipe command
Browse files Browse the repository at this point in the history
  • Loading branch information
Ais8Ooz8 authored Mar 18, 2024
1 parent 1a4add0 commit d3af9ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/v3/snapshot/v3_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit d3af9ca

Please sign in to comment.