fixing deadlock+verbose ingress

master
cheetah 1 year ago
parent 48b36faf07
commit b4c69f79c9

@ -269,6 +269,8 @@ func ProcessGMA(filePath string) (err error) {
return err
}
dboGMA.Header = header
log.Printf("Name=%s\n", header.Title)
log.Printf("Desc=%s\n", header.Description)
// log.Printf("AddonVersion=%d\n", header.AddonVersion)
// log.Printf("FormatVersion=%d\n", header.FormatVersion)
// log.Printf("FormatVersionDiscardByte=%d\n", header.FormatVersionDiscardByte)

@ -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 {

Loading…
Cancel
Save