diff --git a/core/etcd.go b/core/etcd.go index 0b6dd9804..b57033a18 100644 --- a/core/etcd.go +++ b/core/etcd.go @@ -105,15 +105,13 @@ func getLightestProcess(m map[string]int) (Pair, error) { } func (self *TopologyMapper) MakeFragments(db string, slice_int int) error { - /* - frames_to_create := config.GetStringArrayDefault("supported_frames", []string{"b.n", "l.n", "t.t", "d"}) - for _, frame := range frames_to_create { - err := self.AllocateFragment(db, frame, slice_int) - if err != nil { - log.Println(err) - } + frames_to_create := config.GetStringArrayDefault("supported_frames", []string{"b.n", "l.n", "t.t", "d"}) + for _, frame := range frames_to_create { + err := self.AllocateFragment(db, frame, slice_int) + if err != nil { + log.Println(err) } - */ + } return nil } diff --git a/core/http.go b/core/http.go index 64f42865a..1dac1dfdf 100644 --- a/core/http.go +++ b/core/http.go @@ -437,7 +437,7 @@ func (self *WebService) HandleStats(w http.ResponseWriter, r *http.Request) { err := encoder.Encode(m) if err != nil { - panic("Error encoding stats") + log.Fatal("Error encoding stats") } } @@ -483,7 +483,7 @@ func (self *WebService) HandleProcesses(w http.ResponseWriter, r *http.Request) processes := self.service.ProcessMap.GetMetadata() err := encoder.Encode(processes) if err != nil { - panic("Error encoding stats") + http.Error(w, "Error Encoding", http.StatusBadRequest) } } diff --git a/index/storage_cass.go b/index/storage_cass.go index c9514598e..30d785e48 100644 --- a/index/storage_cass.go +++ b/index/storage_cass.go @@ -123,12 +123,15 @@ func (self *CassandraStorage) FlushBatch() { func (self *CassandraStorage) EndBatch() { start := time.Now() if self.batch != nil { - last := time.Since(self.batch_time) - if last.Seconds() > self.cass_time_window_secs { - self.FlushBatch() - } else if self.batch_counter > self.cass_flush_size { - self.FlushBatch() - } + self.FlushBatch() + /* + last := time.Since(self.batch_time) + if last.Seconds() > self.cass_time_window_secs { + self.FlushBatch() + } else if self.batch_counter > self.cass_flush_size { + self.FlushBatch() + } + */ } else { log.Println("NIL BATCH") } @@ -161,7 +164,7 @@ func (self *CassandraStorage) Store(id int64, db string, frame string, slice int func (self *CassandraStorage) StoreBlock(id int64, db string, frame string, slice int, filter uint64, chunk int64, block_index int32, block int64) error { if self.batch == nil { - panic("NIL BATCH") + self.BeginBatch() } start := time.Now() self.batch.Query(self.stmt, id, db, frame, slice, int(filter), chunk, block_index, block) diff --git a/query/parser.go b/query/parser.go index 3c9f1a8d7..ddb5109fe 100644 --- a/query/parser.go +++ b/query/parser.go @@ -3,6 +3,7 @@ package query import ( "errors" "fmt" + "log" "pilosa/util" "strconv" @@ -199,8 +200,9 @@ ArgLoop: } } default: - spew.Dump("unexpected", token) - panic(token) + + log.Println(spew.Sdump("unexpected", token)) + return nil, errors.New("BAD TOKEN") } } diff --git a/query/planner.go b/query/planner.go index 5c87a484c..409bc255c 100644 --- a/query/planner.go +++ b/query/planner.go @@ -2,11 +2,14 @@ package query import ( "encoding/gob" + "errors" "fmt" "log" "math/rand" "pilosa/db" "pilosa/util" + + "github.com/davecgh/go-spew/spew" ) type PortableQueryStep interface { @@ -390,7 +393,8 @@ func (qp *QueryPlanner) buildTree(query *Query, slice int) (QueryTree, error) { tree = &IntersectQueryTree{subqueries: subqueries} } else { //TODO return error gracefully - panic("invalid operation") + log.Println(spew.Sdump(query)) + return nil, errors.New("BuildTree Issues") } } return tree, nil