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:
9
server/modules/filter/cache/lrustorage.cc
vendored
9
server/modules/filter/cache/lrustorage.cc
vendored
@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user