Closed shaitan closed 8 years ago
It shouldn't break anything.
Why is it unnecessary? Lookup command is about returning data from disk, it is perfectly valid not to have given key in the cache, but have it on disk.
This pull request breaks every installation which has cache enabled, since every lookup will fail if there is no data in the cache, for example after node restart.
I mean that "sending another lookup directly to the backend, when cache does not have the key, is unnecessary". So in this case cache should return -ENOTSUP
to make outside logic (dnet_process_cmd_with_backend_raw
) calls backend's handler for original request.
Maybe it is better to:
-ENOENT
in slru_cache_t::lookup()
what will mean that cache knows nothing about the key-ENOTSUP
in dnet_cmd_cache_lookup
if cache->lookup()
has returned -ENOENT
what will mean that cache has not handled the request, so the request should be handled by something else (by backend for example).Returning -ENOTSUP
is an abuse of the error code, other levels can not determine whether cache is enabled or it doesn't have data. I think that returning -ENOENT
and handling it properly by routing request to the backend is the way to go.
I've replaced ENOTSUP
by ENOENT
in this code and have added routing request to the backend when cache lookup is failed with -ENOENT
.
Cache handles lookups by sending another lookups directly to the backend, but it is unnecessary when cache does not have the key.