memcached
memcached copied to clipboard
Failover Servers not working when only 1 master server
Failover servers work fine if we have more than 1 master node but not working for 1 master node. Replacing the server upon failure just replaces the servers in hashring and not in memcached (this.servers), so the below logic seems to be wrong.
// try to find the correct server for this query if (!server) { // no need to do a hashring lookup if we only have one server assigned to // us if (this.servers.length === 1) { server = this.servers[0]; // -> this seems to be wrong since the this.servers is not getting updated upon servers swap } else { if (redundancy && queryRedundancy) { redundancy = this.HashRing.createRange(query.key, (this.redundancy + 1), true); server = redundancy.shift(); } else { server = this.HashRing.get(query.key); } } }