From 52c90cdcfb243303355dc4cea8b905250e53418b Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Tue, 7 Apr 2015 12:41:05 -0700 Subject: [PATCH] etcdctl: import hidden keys --- etcdctl/command/import_snap_command.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etcdctl/command/import_snap_command.go b/etcdctl/command/import_snap_command.go index dd9966812fd..40f71e3d866 100644 --- a/etcdctl/command/import_snap_command.go +++ b/etcdctl/command/import_snap_command.go @@ -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, @@ -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)