enable LinearImport for diffCache during import

master
Oliver Tonnhofer 2013-08-05 12:51:25 +02:00
parent 639c206b16
commit 63794491f6
3 changed files with 9 additions and 8 deletions

4
cache/diff.go vendored
View File

@ -237,8 +237,6 @@ func newRefIndex(path string, opts *cacheOptions) (*bunchRefCache, error) {
index.waitWrite = &sync.WaitGroup{}
index.waitAdd = &sync.WaitGroup{}
// index.SetLinearImport(true)
return &index, nil
}
@ -259,6 +257,8 @@ func (index *bunchRefCache) SetLinearImport(val bool) {
index.waitAdd.Wait()
close(index.write)
index.waitWrite.Wait()
index.linearImport = false
}
}

9
cache/diff_test.go vendored
View File

@ -100,19 +100,16 @@ func TestWriteDiff(t *testing.T) {
if err != nil {
t.Fatal()
}
defer cache.Close()
cache.SetLinearImport(true)
for w := 0; w < 5; w++ {
for n := 0; n < 200; n++ {
cache.add(int64(n), int64(w))
}
}
cache.Close()
cache, err = newRefIndex(cache_dir, &globalCacheOptions.CoordsIndex)
if err != nil {
t.Fatal(err)
}
defer cache.Close()
cache.SetLinearImport(false)
for n := 0; n < 200; n++ {
refs := cache.Get(int64(n))

View File

@ -240,6 +240,10 @@ func mainimport() {
if err != nil {
log.Fatal(err)
}
if diffCache != nil {
diffCache.Coords.SetLinearImport(true)
diffCache.Ways.SetLinearImport(true)
}
osmCache.Coords.SetReadOnly(true)
pointsTagMatcher := tagmapping.PointMatcher()
lineStringsTagMatcher := tagmapping.LineStringMatcher()