update sliceMaxByIndex by view

This commit is contained in:
Linh Vo 2017-05-16 11:11:11 -05:00
parent 5de9a7d0d0
commit f392853134
3 changed files with 18 additions and 5 deletions

View file

@ -474,7 +474,14 @@ func (c *Client) BackupTo(ctx context.Context, w io.Writer, index, frame, view s
tw := tar.NewWriter(w)
// Find the maximum number of slices.
maxSlices, err := c.MaxSliceByIndex(ctx)
var maxSlices map[string]uint64
var err error
if view == ViewStandard {
maxSlices, err = c.MaxSliceByIndex(ctx)
} else if view == ViewInverse {
maxSlices, err = c.MaxInverseSliceByIndex(ctx)
}
if err != nil {
return fmt.Errorf("slice n: %s", err)
}

View file

@ -43,9 +43,9 @@ Backs up the view from across the cluster into a single file.
}
flags := backupCmd.Flags()
flags.StringVarP(&Backuper.Host, "host", "", "localhost:10101", "host:port of Pilosa.")
flags.StringVarP(&Backuper.Index, "index", "i", "", "Pilosa index to backup into.")
flags.StringVarP(&Backuper.Frame, "frame", "f", "", "Frame to backup into.")
flags.StringVarP(&Backuper.View, "view", "v", "", "View to backup into.")
flags.StringVarP(&Backuper.Index, "index", "i", "", "Pilosa index to backup.")
flags.StringVarP(&Backuper.Frame, "frame", "f", "", "Frame to backup.")
flags.StringVarP(&Backuper.View, "view", "v", "", "View to backup.")
flags.StringVarP(&Backuper.Path, "output-file", "o", "", "File to write backup to - default stdout")
return backupCmd

View file

@ -79,7 +79,13 @@ func (cmd *ExportCommand) Run(ctx context.Context) error {
}
// Determine slice count.
maxSlices, err := client.MaxSliceByIndex(ctx)
var maxSlices map[string]uint64
if cmd.View == pilosa.ViewStandard {
maxSlices, err = client.MaxSliceByIndex(ctx)
} else if cmd.View == pilosa.ViewInverse {
maxSlices, err = client.MaxInverseSliceByIndex(ctx)
}
if err != nil {
return err
}