From c59d0f9fe2e547fb4e2f4c43118230ce72c30cc2 Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Tue, 30 Jan 2018 09:57:10 -0800 Subject: [PATCH] snapshot: clarify "Restore" method with conflicting data directory Signed-off-by: Gyuho Lee --- snapshot/v3_snapshot.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/snapshot/v3_snapshot.go b/snapshot/v3_snapshot.go index 7988989d8fb..efff0e27305 100644 --- a/snapshot/v3_snapshot.go +++ b/snapshot/v3_snapshot.go @@ -57,6 +57,8 @@ type Manager interface { Status(dbPath string) (Status, error) // Restore restores a new etcd data directory from given snapshot file. + // It returns an error if specified data directory already exists, to + // prevent unintended data directory overwrites. Restore(dbPath string, cfg RestoreConfig) error } @@ -73,6 +75,9 @@ type RestoreConfig struct { // Name is the human-readable name of this member. Name string // OutputDataDir is the target data directory to save restored data. + // OutputDataDir should not conflict with existing etcd data directory. + // If OutputDataDir already exists, it will return an error to prevent + // unintended data directory overwrites. // Defaults to "[Name].etcd" if not given. OutputDataDir string // OutputWALDir is the target WAL data directory.