Couchbase Server

Fix race condition in stats code path