MXS-2727 Add fix

If an existing cache-entry should be updated, but the new value
is larger that the maximum size of the cache, then the cache can
not be updated, but the old value must be removed.

Whether or not we succeed in removing the entry, an error result
must be returned. Earlier OK was returned, but no node was
allocated, which then caused a crash.
This commit is contained in:
Johan Wikman
2019-11-12 15:27:31 +02:00
parent 6a319dc655
commit 1c28eefbd0

View File

@ -479,11 +479,14 @@ cache_result_t LRUStorage::get_existing_node(NodesByKey::iterator& i, const GWBU
result = do_del_value(*pkey);
if (!CACHE_RESULT_IS_ERROR(result))
if (CACHE_RESULT_IS_ERROR(result))
{
// If we failed to remove the value, we do not have enough space.
result = CACHE_RESULT_OUT_OF_RESOURCES;
// Removal of old value of too big a value to be cached failed, we are hosed.
MXS_ERROR("Value is too big to be stored, and removal of old value "
"failed. The cache will return stale data.");
}
result = CACHE_RESULT_OUT_OF_RESOURCES;
}
else
{