mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove logs
This commit is contained in:
parent
7c029b2183
commit
cb476a53ff
|
@ -1,9 +1,7 @@
|
||||||
package mem
|
package mem
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var pools []*sync.Pool
|
var pools []*sync.Pool
|
||||||
|
@ -41,13 +39,8 @@ func getSlotPool(size int) (*sync.Pool, bool) {
|
||||||
return pools[index], true
|
return pools[index], true
|
||||||
}
|
}
|
||||||
|
|
||||||
var total int64
|
|
||||||
|
|
||||||
func Allocate(size int) []byte {
|
func Allocate(size int) []byte {
|
||||||
if pool, found := getSlotPool(size); found {
|
if pool, found := getSlotPool(size); found {
|
||||||
newVal := atomic.AddInt64(&total, 1)
|
|
||||||
glog.V(4).Infof("++> %d", newVal)
|
|
||||||
|
|
||||||
slab := *pool.Get().(*[]byte)
|
slab := *pool.Get().(*[]byte)
|
||||||
return slab[:size]
|
return slab[:size]
|
||||||
}
|
}
|
||||||
|
@ -56,8 +49,6 @@ func Allocate(size int) []byte {
|
||||||
|
|
||||||
func Free(buf []byte) {
|
func Free(buf []byte) {
|
||||||
if pool, found := getSlotPool(cap(buf)); found {
|
if pool, found := getSlotPool(cap(buf)); found {
|
||||||
newVal := atomic.AddInt64(&total, -1)
|
|
||||||
glog.V(4).Infof("--> %d", newVal)
|
|
||||||
pool.Put(&buf)
|
pool.Put(&buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ func (vc *vidMap) GetVidLocations(vid string) (locations []Location, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (vc *vidMap) GetLocations(vid uint32) (locations []Location, found bool) {
|
func (vc *vidMap) GetLocations(vid uint32) (locations []Location, found bool) {
|
||||||
glog.V(4).Infof("~ lookup volume id %d: %+v ec:%+v", vid, vc.vid2Locations, vc.ecVid2Locations)
|
// glog.V(4).Infof("~ lookup volume id %d: %+v ec:%+v", vid, vc.vid2Locations, vc.ecVid2Locations)
|
||||||
locations, found = vc.getLocations(vid)
|
locations, found = vc.getLocations(vid)
|
||||||
if found && len(locations) > 0 {
|
if found && len(locations) > 0 {
|
||||||
return locations, found
|
return locations, found
|
||||||
|
|
Loading…
Reference in a new issue