Details
Description
When rebalance abruptly terminates ns_server closes the connection on DCP consumer replication streams and lets KV engine close the streams when it figures out that the connection is closed, as opposed to closing each stream in the connection explicitly. ns_server then opens these streams again – which is racy in KV engine as it may take some time for the connection close to get picked up.
Rather ns_server should explicitly close the streams in the situation of an abruptly terminated rebalance. This is equivalent to simply closing the connection but has the positive side effect of removing raciness and reducing the probability of any problem in KV Engine.