Race condition causes metric updates to be lost
If a metric is updated while QuiescentRegistryListener is restarting PcpMmvWriter due to a monitorable being added, then it's possible that the metric update will be lost. This can happen because the metric update calls PcpMmvWriter.updateMetric(), which immediately returns if started is false. When QuiescentRegistryListener restarts PcpMmvWriter, it first stops it, setting started to false, and then starts it again. PcpMmvWriter.start() iterates over all of the metric data, writing it again, prior to setting started to true. So, the race occurs if a metric is updated between the time the old value is rewritten in PcpMmvWriter.start() and the time started is set to true.
Unfortunately, my prior PR only partially addressed the issue. The race condition still exists if a monitorable is updated before the writer is started again but after the monitorable has been re-added to the writer. I hope to get a PR up to fix this case tomorrow.