fixed bug in local process determination

This commit is contained in:
Todd Gruben 2015-03-23 20:30:58 +00:00
parent 8ce29cc316
commit 662ff2d00c
4 changed files with 25 additions and 11 deletions

View file

@ -20,6 +20,7 @@ func (self *Service) RecallQueryStepHandler(msg *db.Message) {
}
*/
func (self *Service) CountQueryStepHandler(msg *db.Message) {
log.Trace("CountQueryStepHandler")
//spew.Dump("COUNT QUERYSTEP")
qs := msg.Data.(query.CountQueryStep)
input := qs.Input
@ -174,7 +175,7 @@ func (self *Service) StashQueryStepHandler(msg *db.Message) {
case query.Stash:
result.Stash = append(result.Stash, val.Stash...)
default:
log.Warn("UNEXCPECTED MESSAG", value)
log.Warn("UNEXCPECTED MESSAGE", value)
}
}
result_message := db.Message{Data: query.StashQueryResult{&query.BaseQueryResult{Id: qs.Id, Data: result}}}
@ -183,6 +184,7 @@ func (self *Service) StashQueryStepHandler(msg *db.Message) {
}
func (self *Service) CatQueryStepHandler(msg *db.Message) {
log.Trace("CatQueryStepHandler")
qs := msg.Data.(query.CatQueryStep)
var handles []index.BitmapHandle
return_type := "bitmap-handles"

View file

@ -65,16 +65,12 @@ func (self *Service) getProduction() string {
fname := fmt.Sprintf("%s/%s.%s", base_path, self.name, self.Id)
//<seelog minlevel="debug" maxlevel="error">
log_level := config.GetStringDefault("log_level", "info")
prod_config := fmt.Sprintf(`
<seelog minlevel="%s">
prod_config := fmt.Sprintf(`<seelog minlevel="%s">
<outputs>
<rollingfile formatid="simpleformat" type="size" filename="%s" maxsize="524288000" maxrolls="4" />
</outputs>
<formats>
<format id="simpleformat" format="%Date/%Time [%LEV] %Msg%n"/>
<formats>
</seelog>
`, log_level, fname)
<rollingfile type="size" filename="%s" maxsize="524288000" maxrolls="4" />
</outputs>
</seelog>`, log_level, fname)
fmt.Println(prod_config)
return prod_config
}

View file

@ -67,6 +67,7 @@ func (self *FragmentContainer) Shutdown() {
}
func (self *FragmentContainer) LoadBitmap(frag_id util.SUUID, bitmap_id uint64, compressed_bitmap string, filter uint64) {
log.Trace("LoadBitmap")
if fragment, found := self.GetFragment(frag_id); found {
request := NewLoader(bitmap_id, compressed_bitmap, filter)
fragment.requestChan <- request
@ -76,6 +77,7 @@ func (self *FragmentContainer) LoadBitmap(frag_id util.SUUID, bitmap_id uint64,
}
func (self *FragmentContainer) GetFragment(frag_id util.SUUID) (*Fragment, bool) {
log.Trace("index.GetFragment")
self.mutex.Lock()
c, v := self.fragments[frag_id]
self.mutex.Unlock()
@ -91,6 +93,7 @@ func (self *FragmentContainer) Stats(frag_id util.SUUID) interface{} {
return nil
}
func (self *FragmentContainer) Empty(frag_id util.SUUID) (BitmapHandle, error) {
log.Trace("index.Empty")
if fragment, found := self.GetFragment(frag_id); found {
request := NewEmpty()
fragment.requestChan <- request
@ -100,6 +103,7 @@ func (self *FragmentContainer) Empty(frag_id util.SUUID) (BitmapHandle, error) {
}
func (self *FragmentContainer) Intersect(frag_id util.SUUID, bh []BitmapHandle) (BitmapHandle, error) {
log.Trace("index.Intersect")
if fragment, found := self.GetFragment(frag_id); found {
request := NewIntersect(bh)
fragment.requestChan <- request
@ -110,6 +114,7 @@ func (self *FragmentContainer) Intersect(frag_id util.SUUID, bh []BitmapHandle)
return 0, errors.New("Invalid Bitmap Handle Intersect")
}
func (self *FragmentContainer) Union(frag_id util.SUUID, bh []BitmapHandle) (BitmapHandle, error) {
log.Trace("index.Union")
if fragment, found := self.GetFragment(frag_id); found {
request := NewUnion(bh)
fragment.requestChan <- request
@ -121,6 +126,7 @@ func (self *FragmentContainer) Union(frag_id util.SUUID, bh []BitmapHandle) (Bit
}
func (self *FragmentContainer) Difference(frag_id util.SUUID, bh []BitmapHandle) (BitmapHandle, error) {
log.Trace("index.Difference")
if fragment, found := self.GetFragment(frag_id); found {
request := NewDifference(bh)
fragment.requestChan <- request
@ -132,6 +138,7 @@ func (self *FragmentContainer) Difference(frag_id util.SUUID, bh []BitmapHandle)
}
func (self *FragmentContainer) Get(frag_id util.SUUID, bitmap_id uint64) (BitmapHandle, error) {
log.Trace("index.Get")
if fragment, found := self.GetFragment(frag_id); found {
request := NewGet(bitmap_id)
fragment.requestChan <- request
@ -165,6 +172,7 @@ func (self *FragmentContainer) Range(frag_id util.SUUID, bitmap_id uint64, start
}
func (self *FragmentContainer) TopN(frag_id util.SUUID, bh BitmapHandle, n int, categories []uint64) ([]Pair, error) {
log.Trace("index.TopN")
if fragment, found := self.GetFragment(frag_id); found {
request := NewTopN(bh, n, categories)
fragment.requestChan <- request
@ -176,6 +184,7 @@ func (self *FragmentContainer) TopN(frag_id util.SUUID, bh BitmapHandle, n int,
}
func (self *FragmentContainer) TopNAll(frag_id util.SUUID, n int, categories []uint64) ([]Pair, error) {
log.Trace("index.TopNAll")
if fragment, found := self.GetFragment(frag_id); found {
request := NewTopNAll(n, categories)
fragment.requestChan <- request
@ -187,6 +196,7 @@ func (self *FragmentContainer) TopNAll(frag_id util.SUUID, n int, categories []u
}
func (self *FragmentContainer) TopFillBatch(args []FillArgs) ([]Pair, error) {
log.Trace("index.TopFillBatch")
//should probaly make this concurrent but then all hell breaks loose
results := make(map[uint64]uint64)
for _, v := range args {
@ -208,6 +218,7 @@ func (self *FragmentContainer) TopFillBatch(args []FillArgs) ([]Pair, error) {
}
func (self *FragmentContainer) TopFillFragment(arg FillArgs) ([]Pair, error) {
log.Trace("index.TopFillFragment")
if fragment, found := self.GetFragment(arg.Frag_id); found {
request := NewTopFill(arg)
fragment.requestChan <- request
@ -219,6 +230,7 @@ func (self *FragmentContainer) TopFillFragment(arg FillArgs) ([]Pair, error) {
}
func (self *FragmentContainer) GetList(frag_id util.SUUID, bitmap_id []uint64) ([]BitmapHandle, error) {
log.Trace("index.GetList")
if fragment, found := self.GetFragment(frag_id); found {
request := NewGetList(bitmap_id)
fragment.requestChan <- request
@ -230,6 +242,7 @@ func (self *FragmentContainer) GetList(frag_id util.SUUID, bitmap_id []uint64) (
}
func (self *FragmentContainer) Count(frag_id util.SUUID, bitmap BitmapHandle) (uint64, error) {
log.Trace("index.Count")
if fragment, found := self.GetFragment(frag_id); found {
request := NewCount(bitmap)
fragment.requestChan <- request
@ -241,6 +254,7 @@ func (self *FragmentContainer) Count(frag_id util.SUUID, bitmap BitmapHandle) (u
}
func (self *FragmentContainer) GetBytes(frag_id util.SUUID, bh BitmapHandle) ([]byte, error) {
log.Trace("index.GetBytes")
if fragment, found := self.GetFragment(frag_id); found {
request := NewGetBytes(bh)
fragment.requestChan <- request
@ -252,6 +266,7 @@ func (self *FragmentContainer) GetBytes(frag_id util.SUUID, bh BitmapHandle) ([]
}
func (self *FragmentContainer) FromBytes(frag_id util.SUUID, bytes []byte) (BitmapHandle, error) {
log.Trace("index.FromBytes")
if fragment, found := self.GetFragment(frag_id); found {
request := NewFromBytes(bytes)
fragment.requestChan <- request

View file

@ -76,7 +76,8 @@ func (self *BaseQueryStep) GetLocation() *db.Location {
func (self *BaseQueryStep) LocIsDest() bool {
log.Trace("BaseQueryStep.LocIsDest")
if self.Location.ProcessId == self.Destination.ProcessId &&
// if self.Location.ProcessId == self.Destination.ProcessId &&
if util.Equal(self.Location.ProcessId, self.Destination.ProcessId) &&
self.Location.FragmentId == self.Destination.FragmentId {
log.Trace("BaseQueryStep.LocIsDest Return true")
return true