app/vminsert/netstorage: remove possible race condition when broken connection may be recovered before acquiring storageNode.bcLock

This commit is contained in:
Aliaksandr Valialkin 2020-06-20 16:38:02 +03:00
parent 85036c2b07
commit 2fc2679a3f

View file

@ -185,13 +185,12 @@ func sendBufToReplicas(br *bufRows, snIdx, replicas int) bool {
}
func (sn *storageNode) checkHealth() {
if !sn.isBroken() {
return
}
sn.bcLock.Lock()
defer sn.bcLock.Unlock()
if !sn.isBroken() {
return
}
if sn.bc != nil {
logger.Panicf("BUG: sn.bc must be nil when sn is broken; got %p", sn.bc)
}