Skip to content

Commit

Permalink
etcdctl: import hidden keys
Browse files Browse the repository at this point in the history
  • Loading branch information
xiang90 authored and yichengq committed Apr 7, 2015
1 parent a88b22a commit 52c90cd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions etcdctl/command/import_snap_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func NewImportSnapCommand() cli.Command {
Usage: "import a snapshot to a cluster",
Flags: []cli.Flag{
cli.StringFlag{Name: "snap", Value: "", Usage: "Path to the vaild etcd 0.4.x snapshot."},
cli.StringSliceFlag{Name: "hidden", Value: nil, Usage: "Hidden key space to import from snapshot"},
cli.IntFlag{Name: "c", Value: 10, Usage: "Number of concurrent clients to import the data"},
},
Action: handleImportSnap,
Expand Down Expand Up @@ -83,6 +84,15 @@ func handleImportSnap(c *cli.Context) {
handleError(ErrorFromEtcd, err)
}
n := copyKeys(all.Node, setc)

hiddens := c.StringSlice("hidden")
for _, h := range hiddens {
allh, err := st.Get(h, true, true)
if err != nil {
handleError(ErrorFromEtcd, err)
}
n += copyKeys(allh.Node, setc)
}
close(setc)
wg.Wait()
fmt.Printf("finished importing %d keys\n", n)
Expand Down

0 comments on commit 52c90cd

Please sign in to comment.