corrected error for post to non-existant fragment

This commit is contained in:
Todd Gruben 2014-01-23 13:16:06 -06:00
parent cf721020fb
commit 0106a20696
3 changed files with 18 additions and 11 deletions

View file

@ -4,15 +4,14 @@ import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
"pilosa/db"
"pilosa/index"
"strconv"
"strings"
"github.com/davecgh/go-spew/spew"
)
func post(database, base_url, id, compressed_string, frame_type string, slice int) {
@ -22,14 +21,17 @@ func post(database, base_url, id, compressed_string, frame_type string, slice in
values.Set("frame", frame_type)
values.Set("slice", fmt.Sprintf("%d", slice))
values.Set("bitmap", compressed_string)
r, err := http.PostForm(base_url, values)
if err != nil {
log.Printf("error posting stat to stathat: %s", err)
return
}
//body, _ := ioutil.ReadAll(r.Body)
ioutil.ReadAll(r.Body)
r.Body.Close()
spew.Dump(values)
/*
r, err := http.PostForm(base_url, values)
if err != nil {
log.Printf("error posting stat to stathat: %s", err)
return
}
//body, _ := ioutil.ReadAll(r.Body)
ioutil.ReadAll(r.Body)
r.Body.Close()
*/
}
func Load(database, url, fullpath string, frame_type string) error {

View file

@ -45,7 +45,7 @@ func (self *Service) Batch(database_name, frame, compressed_bitmap string, bitma
dest_id := fragment.GetProcess().Id()
self.Transport.Send(&batch, &dest_id)
_, err := self.Hold.Get(&id, 60)
_, err = self.Hold.Get(&id, 60)
}
return err

View file

@ -313,9 +313,14 @@ func (d *Database) GetFragmentForBitmap(slice *Slice, bitmap *Bitmap) (*Fragment
//defer d.mutex.Unlock()
frame, _ := d.getFrame(bitmap.FrameType)
fsi, err := d.GetFrameSliceIntersect(frame, slice)
if err != nil {
log.Fatal(err)
return nil, err
}
frag_id_s, err := fsi.hashring.Get(fmt.Sprintf("%d", bitmap.Id))
if err != nil {
log.Fatal(err)
return nil, err
}
frag_id := util.Hex_to_SUUID(frag_id_s)
return fsi.GetFragment(frag_id)