From d0abcfc9102fa665334c2a9fc7a1c792bf58714a Mon Sep 17 00:00:00 2001 From: Todd Gruben Date: Fri, 13 May 2016 19:59:14 -0500 Subject: [PATCH] changed slicewidth --- client.go | 29 +++++++++++++++++++---------- cmd/pilosa/main.go | 10 +++++----- fragment.go | 2 +- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/client.go b/client.go index 15f4b401b..77fcdf771 100644 --- a/client.go +++ b/client.go @@ -175,12 +175,29 @@ func (c *Client) Import(db, frame string, slice uint64, bits []Bit) error { return ErrFrameRequired } + buf, err := ImportPayload(db, frame, slice, bits) + if err != nil { + return fmt.Errorf("Error Creating Payload: %s", err) + } + // Retrieve a list of nodes that own the slice. nodes, err := c.SliceNodes(slice) + if err != nil { return fmt.Errorf("slice nodes: %s", err) } + // Import to each node. + for _, node := range nodes { + if err := c.importNode(node, buf); err != nil { + return fmt.Errorf("import node: host=%s, err=%s", node.Host, err) + } + } + + return nil +} + +func ImportPayload(db, frame string, slice uint64, bits []Bit) ([]byte, error) { // Separate bitmap and profile IDs to reduce allocations. bitmapIDs := Bits(bits).BitmapIDs() profileIDs := Bits(bits).ProfileIDs() @@ -194,17 +211,9 @@ func (c *Client) Import(db, frame string, slice uint64, bits []Bit) error { ProfileIDs: profileIDs, }) if err != nil { - return fmt.Errorf("marshal import request: %s", err) + return nil, fmt.Errorf("marshal import request: %s", err) } - - // Import to each node. - for _, node := range nodes { - if err := c.importNode(node, buf); err != nil { - return fmt.Errorf("import node: host=%s, err=%s", node.Host, err) - } - } - - return nil + return buf, nil } // importNode sends a pre-marshaled import request to a node. diff --git a/cmd/pilosa/main.go b/cmd/pilosa/main.go index 5c7971e6a..32b0f2e18 100644 --- a/cmd/pilosa/main.go +++ b/cmd/pilosa/main.go @@ -13,7 +13,6 @@ import ( "net/url" "os" "os/signal" - "os/user" "path/filepath" "runtime/pprof" "strconv" @@ -371,13 +370,14 @@ func (m *Main) ParseFlags(args []string) error { // Expand home directory. prefix := "~" + string(filepath.Separator) if strings.HasPrefix(m.Config.DataDir, prefix) { - u, err := user.Current() - if err != nil { + // u, err := user.Current() + HomeDir := os.Getenv("HOME") + /*if err != nil { return err - } else if u.HomeDir == "" { + } else*/if HomeDir == "" { return errors.New("data directory not specified and no home dir available") } - m.Config.DataDir = filepath.Join(u.HomeDir, strings.TrimPrefix(m.Config.DataDir, prefix)) + m.Config.DataDir = filepath.Join(HomeDir, strings.TrimPrefix(m.Config.DataDir, prefix)) } return nil diff --git a/fragment.go b/fragment.go index 545f7aa8d..52ffd9f9a 100644 --- a/fragment.go +++ b/fragment.go @@ -25,7 +25,7 @@ import ( const ( // SliceWidth is the number of profile IDs in a slice. - SliceWidth = 65536 + SliceWidth = 2097152 // SnapshotExt is the file extension used for an in-process snapshot. SnapshotExt = ".snapshotting"