Fix append cli
This commit is contained in:
parent
ef59c441d4
commit
58334f237e
|
@ -15,7 +15,6 @@ type AppendStore struct {
|
|||
//writeMutex sync.RWMutex
|
||||
useCompactHashes bool
|
||||
usePackedValues bool
|
||||
totalPrints int
|
||||
}
|
||||
|
||||
func NewAppendStore(pathName string, useCompactHashes, usePackedValues bool) (*AppendStore, error) {
|
||||
|
@ -143,7 +142,6 @@ func (s *AppendStore) StorePanakoPrints(records []panako.StoreRecord) {
|
|||
m[records[i].ResourceId] = append(m[records[i].ResourceId], &records[i])
|
||||
}
|
||||
|
||||
s.totalPrints += len(records)
|
||||
//s.writeMutex.Lock()
|
||||
//defer s.writeMutex.Unlock()
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"math"
|
||||
"math/bits"
|
||||
"os"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
@ -227,7 +226,7 @@ func (t *TaskState) Progress() (int64, int64) {
|
|||
}
|
||||
|
||||
func (c *AppendConverter) SortHashes(s *AppendStore, workers int) *TaskState {
|
||||
nentries := c.fileSize / c.GetEntrySize()
|
||||
nentries := c.fileSize / c.recordSize
|
||||
|
||||
nrecords := int64(len(c.resourceIndex))
|
||||
splitSize := nrecords / int64(workers)
|
||||
|
@ -241,8 +240,8 @@ func (c *AppendConverter) SortHashes(s *AppendStore, workers int) *TaskState {
|
|||
|
||||
for i := int64(0); i < nrecords; i += splitSize {
|
||||
l := i + splitSize
|
||||
if l > nentries {
|
||||
l = nentries
|
||||
if l > nrecords {
|
||||
l = nrecords
|
||||
}
|
||||
|
||||
ts.wg.Add(1)
|
||||
|
@ -250,9 +249,6 @@ func (c *AppendConverter) SortHashes(s *AppendStore, workers int) *TaskState {
|
|||
defer ts.wg.Done()
|
||||
for _, control := range slice {
|
||||
records := c.ReadRecords(control.resourceId, control.recordsStartIndex, int64(control.length))
|
||||
sort.Slice(records, func(i, j int) bool {
|
||||
return records[i].Hash < records[j].Hash
|
||||
})
|
||||
s.StorePanakoPrints(records)
|
||||
atomic.AddInt64(&ts.processed, int64(len(records))+c.controlSize)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue