mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
prevent small integer sharing when maxmemory is active. So every object will use a private LRU field and the LRU algorithm can work well
This commit is contained in:
parent
9f8ded8ced
commit
13a49af44b
@ -245,8 +245,12 @@ robj *tryObjectEncoding(robj *o) {
|
||||
* range and if this is the main thread, since when VM is enabled we
|
||||
* have the constraint that I/O thread should only handle non-shared
|
||||
* objects, in order to avoid race conditions (we don't have per-object
|
||||
* locking). */
|
||||
if (value >= 0 && value < REDIS_SHARED_INTEGERS &&
|
||||
* locking).
|
||||
*
|
||||
* Note that we also avoid using shared integers when maxmemory is used
|
||||
* because very object needs to have a private LRU field for the LRU
|
||||
* algorithm to work well. */
|
||||
if (server.maxmemory == 0 && value >= 0 && value < REDIS_SHARED_INTEGERS &&
|
||||
pthread_equal(pthread_self(),server.mainthread)) {
|
||||
decrRefCount(o);
|
||||
incrRefCount(shared.integers[value]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user