mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: import hidden keys
This commit is contained in:
parent
471aa1aa89
commit
2c647409b9
@ -26,6 +26,7 @@ func NewImportSnapCommand() cli.Command {
|
|||||||
Usage: "import a snapshot to a cluster",
|
Usage: "import a snapshot to a cluster",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{Name: "snap", Value: "", Usage: "Path to the vaild etcd 0.4.x snapshot."},
|
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"},
|
cli.IntFlag{Name: "c", Value: 10, Usage: "Number of concurrent clients to import the data"},
|
||||||
},
|
},
|
||||||
Action: handleImportSnap,
|
Action: handleImportSnap,
|
||||||
@ -83,6 +84,15 @@ func handleImportSnap(c *cli.Context) {
|
|||||||
handleError(ErrorFromEtcd, err)
|
handleError(ErrorFromEtcd, err)
|
||||||
}
|
}
|
||||||
n := copyKeys(all.Node, setc)
|
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)
|
close(setc)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
fmt.Printf("finished importing %d keys\n", n)
|
fmt.Printf("finished importing %d keys\n", n)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user