|
|
|
@ -610,8 +610,8 @@ func (p *PoolMaster) Lookup(id string) (exists bool) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
p.WORMLock.Lock()
|
|
|
|
|
defer p.WORMLock.Unlock()
|
|
|
|
|
p.lock.Lock()
|
|
|
|
|
defer p.lock.Unlock()
|
|
|
|
|
for _, wormPool := range p.WORMPools { // WORM Pools
|
|
|
|
|
for _, poolItem := range wormPool.items {
|
|
|
|
|
if poolItem == id {
|
|
|
|
@ -699,8 +699,8 @@ func (p *PoolMaster) FetchLoadWORM(chunkID string, fileID string, writer io.Writ
|
|
|
|
|
}
|
|
|
|
|
func (p *PoolMaster) CleanWORMTemp() (err error) {
|
|
|
|
|
p.lock.Lock()
|
|
|
|
|
p.WORMLock.Lock()
|
|
|
|
|
defer p.WORMLock.Unlock()
|
|
|
|
|
//p.WORMLock.Lock()
|
|
|
|
|
//defer p.WORMLock.Unlock()
|
|
|
|
|
defer p.lock.Unlock()
|
|
|
|
|
|
|
|
|
|
for _, wormPool := range p.WORMPools {
|
|
|
|
@ -735,16 +735,17 @@ func (p *PoolMaster) Fetch(id string, writer io.Writer) (err error) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
p.WORMLock.Lock()
|
|
|
|
|
defer p.WORMLock.Unlock()
|
|
|
|
|
p.lock.Lock()
|
|
|
|
|
for _, wormPool := range p.WORMPools {
|
|
|
|
|
for _, poolItem := range wormPool.items {
|
|
|
|
|
if poolItem == id {
|
|
|
|
|
fmt.Printf("Fetch WORMPool %s file %s\n", wormPool.PoolID, id)
|
|
|
|
|
p.lock.Unlock()
|
|
|
|
|
return wormPool.Fetch(id, writer)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
p.lock.Unlock()
|
|
|
|
|
for _, fullPool := range p.FullPools {
|
|
|
|
|
for _, poolItem := range fullPool.items {
|
|
|
|
|
if poolItem == id {
|
|
|
|
@ -862,7 +863,7 @@ func (p *PoolMaster) Store(id string, src io.Reader, targetSize int64) (err erro
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pool.itemCount = newItemCount
|
|
|
|
|
fmt.Printf("Current Pool %s, Recounted ItemCount = %d\n", pool.PoolID, pool.itemCount)
|
|
|
|
|
//fmt.Printf("Current Pool %s, Recounted ItemCount = %d\n", pool.PoolID, pool.itemCount)
|
|
|
|
|
if pool.itemCount >= PoolMaxItems {
|
|
|
|
|
pool.ReadOnly = true
|
|
|
|
|
}
|
|
|
|
@ -893,8 +894,8 @@ func main() {
|
|
|
|
|
if len(poolMaster.FullPools) > 0 {
|
|
|
|
|
poolMaster.lock.Lock()
|
|
|
|
|
fmt.Printf("Aquiring WORMLock for Regular FullPool Pack\n")
|
|
|
|
|
poolMaster.WORMLock.Lock()
|
|
|
|
|
fmt.Printf("Aquired WORMLock success for Regular FullPool Pack\n")
|
|
|
|
|
//poolMaster.WORMLock.Lock()
|
|
|
|
|
//fmt.Printf("Aquired WORMLock success for Regular FullPool Pack\n")
|
|
|
|
|
|
|
|
|
|
var deletedPools []string
|
|
|
|
|
for _, fullPool := range poolMaster.FullPools {
|
|
|
|
@ -932,15 +933,18 @@ func main() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//fmt.Printf("unlock WORMLock Regular FullPool Pack\n")
|
|
|
|
|
//poolMaster.WORMLock.Unlock()
|
|
|
|
|
fmt.Printf("unlock lock Regular FullPool Pack\n")
|
|
|
|
|
poolMaster.lock.Unlock()
|
|
|
|
|
poolMaster.WORMLock.Unlock()
|
|
|
|
|
fmt.Printf("unlock WORMLock Regular FullPool Pack\n")
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
poolMaster.CleanWORMTemp()
|
|
|
|
|
time.Sleep(time.Second * 10)
|
|
|
|
|
}
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
// Initial packing
|
|
|
|
|
for _, localPool := range poolMaster.LocalPools {
|
|
|
|
|
if localPool.ReadOnly {
|
|
|
|
|
|
|
|
|
|