carbonserver: fix a 404 related race condition in findCache
carbonserver: fix a 404 related race condition in findCache

The findCache logics doesnt handle 404 edge case well. When findCache is enabled,
if go-carbon receives multiple requests about the same query, only one
query is executed, other requests are put on-hold and wait until the leader
query execution is finished and returned the same result. When a query has no
matches, the leader request will return 404 but set no data for locked fellow
requests. This means other requests will see nil response and without errorNotFound.
For these requests, go-carbon will return 500 instead 404.
This has a negative impact on carbonapi, which might return users 200 for 404 (from go-carbon),
but 500 for 500 (from go-carbon).

This fix addresses the issue by setting an empty findResponse and check if file
count is 0 for response returned from findCache, and then return a proper 404
like the leader request.

deniszh/go-carbon,deniszh/go-carbon,lomik/go-carbon,lomik/go-carbon,deniszh/go-carbon,lomik/go-carbon