Fixed badger/sort
This commit is contained in:
parent
32fd88313b
commit
01e6f0e8ce
|
@ -263,7 +263,7 @@ func (c *AppendConverter) ConvertToBadger(s *specializedstore.BadgerStore, batch
|
|||
nentries := c.fileSize / c.recordSize
|
||||
|
||||
nrecords := int64(len(c.resourceIndex))
|
||||
splitSize := nrecords / int64(batchSize)
|
||||
splitSize := int64(batchSize)
|
||||
if splitSize < 1 {
|
||||
splitSize = 1
|
||||
}
|
||||
|
@ -285,8 +285,8 @@ func (c *AppendConverter) ConvertToBadger(s *specializedstore.BadgerStore, batch
|
|||
|
||||
for _, control := range c.resourceIndex[i:l] {
|
||||
records = append(records, c.ReadRecords(control.resourceId, control.recordsStartIndex, int64(control.length))...)
|
||||
atomic.AddInt64(&ts.processed, int64(len(records))+c.controlSize)
|
||||
}
|
||||
atomic.AddInt64(&ts.processed, int64(len(records))+c.controlSize*(l-i))
|
||||
s.StorePanakoPrints(records)
|
||||
s.RunGarbageCollection()
|
||||
}
|
||||
|
@ -296,8 +296,6 @@ func (c *AppendConverter) ConvertToBadger(s *specializedstore.BadgerStore, batch
|
|||
}
|
||||
|
||||
func (c *AppendConverter) ReadRecords(id panako.ResourceId, recordIndex, n int64) (results []panako.StoreRecord) {
|
||||
c.resourceIndex = c.resourceIndex[:0]
|
||||
|
||||
buf := make([]byte, c.recordSize*n)
|
||||
_, err := c.f.ReadAt(buf, recordIndex*c.recordSize)
|
||||
if err != nil {
|
||||
|
|
|
@ -22,11 +22,13 @@ func main() {
|
|||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
destination, err := store.NewAppendStore(*destinationPath, true, true)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
defer destination.Close()
|
||||
|
||||
taskState := source.SortHashes(destination, *nworkers)
|
||||
|
||||
|
@ -48,11 +50,13 @@ func main() {
|
|||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
destination, err := specializedstore.NewBadgerStore(*destinationPath, true, false, 500000)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
defer destination.Close()
|
||||
|
||||
taskState := source.ConvertToBadger(destination, *nworkers)
|
||||
|
||||
|
|
Loading…
Reference in a new issue