mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-04 11:30:14 -05:00
Revert "limit write concurrency of leveldb to max open file handles limit"
This reverts commit 8d2d380676.
This commit is contained in:
+5
-13
@@ -22,10 +22,9 @@ func toChunkKey(r ref.Ref) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LevelDBStore struct {
|
type LevelDBStore struct {
|
||||||
db *leveldb.DB
|
db *leveldb.DB
|
||||||
mu *sync.Mutex
|
mu *sync.Mutex
|
||||||
putCount int // for testing
|
putCount int // for testing
|
||||||
concurrentWriteLimit chan struct{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLevelDBStore(dir string, maxFileHandles int) *LevelDBStore {
|
func NewLevelDBStore(dir string, maxFileHandles int) *LevelDBStore {
|
||||||
@@ -35,15 +34,10 @@ func NewLevelDBStore(dir string, maxFileHandles int) *LevelDBStore {
|
|||||||
Compression: opt.NoCompression,
|
Compression: opt.NoCompression,
|
||||||
Filter: filter.NewBloomFilter(10), // 10 bits/key
|
Filter: filter.NewBloomFilter(10), // 10 bits/key
|
||||||
OpenFilesCacheCapacity: maxFileHandles,
|
OpenFilesCacheCapacity: maxFileHandles,
|
||||||
WriteBuffer: 1 << 24, // 16MiB,
|
WriteBuffer: 1 << 24, // 16MiB
|
||||||
})
|
})
|
||||||
d.Chk.NoError(err)
|
d.Chk.NoError(err)
|
||||||
return &LevelDBStore{
|
return &LevelDBStore{db, &sync.Mutex{}, 0}
|
||||||
db,
|
|
||||||
&sync.Mutex{},
|
|
||||||
0,
|
|
||||||
make(chan struct{}, maxFileHandles),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LevelDBStore) Root() ref.Ref {
|
func (l *LevelDBStore) Root() ref.Ref {
|
||||||
@@ -92,11 +86,9 @@ func (l *LevelDBStore) Put(c Chunk) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l.concurrentWriteLimit <- struct{}{}
|
|
||||||
err := l.db.Put(toChunkKey(c.Ref()), c.Data(), nil)
|
err := l.db.Put(toChunkKey(c.Ref()), c.Data(), nil)
|
||||||
d.Chk.NoError(err)
|
d.Chk.NoError(err)
|
||||||
l.putCount += 1
|
l.putCount += 1
|
||||||
<-l.concurrentWriteLimit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LevelDBStore) Close() error {
|
func (l *LevelDBStore) Close() error {
|
||||||
|
|||||||
+6
-5
@@ -23,15 +23,16 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type httpServer struct {
|
type httpServer struct {
|
||||||
cs chunks.ChunkStore
|
cs chunks.ChunkStore
|
||||||
port int
|
port int
|
||||||
l *net.Listener
|
l *net.Listener
|
||||||
conns map[net.Conn]http.ConnState
|
conns map[net.Conn]http.ConnState
|
||||||
|
writeLimit chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHttpServer(cs chunks.ChunkStore, port int) *httpServer {
|
func NewHttpServer(cs chunks.ChunkStore, port int) *httpServer {
|
||||||
return &httpServer{
|
return &httpServer{
|
||||||
cs, port, nil, map[net.Conn]http.ConnState{},
|
cs, port, nil, map[net.Conn]http.ConnState{}, make(chan struct{}, maxConcurrentPuts),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user