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