Skip to content
This repository

prohibit to run freeMemoryIfNeed when it is slave #882

Closed
wants to merge 1 commit into from

2 participants

charsyam openbaas
charsyam

Situation:
when Slave's maxmemory and maxmemory-policy are different from Master's
some datum are in Master but they aren't in Slave.

How:
for consistency between master and slave. it is better to turn off slave's freememoryIfNeed.

Why::
1] at the first time, I considered to copy master's maxmemory and maxmemory-policy setting
when they sync for the first time. but it can cause some troubles. because Master and Slave uses memory
differently.

2] even though, they uses same maxmemory-policy, slave can perform "LRU or Expire" itself.

In conclusion, Skipping freememoryIfNeed in slave is better.

charsyam charsyam closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 15, 2013
openbaas prohibit to run freeMemoryIfNeed when it is slave cda108c
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  src/redis.c
2  src/redis.c
@@ -2304,6 +2304,8 @@ void monitorCommand(redisClient *c) {
2304 2304
  * used by the server.
2305 2305
  */
2306 2306
 int freeMemoryIfNeeded(void) {
  2307
+    if (server.masterhost) return REDIS_OK;
  2308
+
2307 2309
     size_t mem_used, mem_tofree, mem_freed;
2308 2310
     int slaves = listLength(server.slaves);
2309 2311
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.