mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Waiting for writes to complete with acquired locks may lead to deadlock, fixes #4952
This commit is contained in:
parent
2b229e98ce
commit
06e723f629
|
@ -147,14 +147,17 @@ func (up *UploadPipeline) MaybeReadDataAt(p []byte, off int64, tsNs int64) (maxS
|
||||||
}
|
}
|
||||||
|
|
||||||
func (up *UploadPipeline) FlushAll() {
|
func (up *UploadPipeline) FlushAll() {
|
||||||
|
up.flushChunks()
|
||||||
|
up.waitForCurrentWritersToComplete()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (up *UploadPipeline) flushChunks() {
|
||||||
up.chunksLock.Lock()
|
up.chunksLock.Lock()
|
||||||
defer up.chunksLock.Unlock()
|
defer up.chunksLock.Unlock()
|
||||||
|
|
||||||
for logicChunkIndex, memChunk := range up.writableChunks {
|
for logicChunkIndex, memChunk := range up.writableChunks {
|
||||||
up.moveToSealed(memChunk, logicChunkIndex)
|
up.moveToSealed(memChunk, logicChunkIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
up.waitForCurrentWritersToComplete()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (up *UploadPipeline) maybeMoveToSealed(memChunk PageChunk, logicChunkIndex LogicChunkIndex) {
|
func (up *UploadPipeline) maybeMoveToSealed(memChunk PageChunk, logicChunkIndex LogicChunkIndex) {
|
||||||
|
|
Loading…
Reference in a new issue