vstars / spymemcached

Automatically exported from code.google.com/p/spymemcached
0 stars 0 forks source link

redisribute fails to rehash to a new node #278

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of the product are you using? On what operating system?

2.8.4, see https://groups.google.com/forum/#!topic/spymemcached/k4xSScN7zIU

Tell me more...

package net.spy.memcached;

import org.easymock.EasyMock;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.net.InetSocketAddress;
import java.util.*;

/**
 * @author mhoriyam
 *
 * This test reproduces an issue we are seeing where when several memcached nodes are down, redistribute
 * fails to hash to a live memcached node.
 *
 */
public class KetamaNodeLocatorTest {

    @Test
    public void testMissingNode() {

        List<MemcachedNode> nodes = new ArrayList<MemcachedNode>();
        nodes.add(createMockNode(new InetSocketAddress("localhost", 333)));
        nodes.add(createMockNode(new InetSocketAddress("localhost", 444)));
        nodes.add(createMockNode(new InetSocketAddress("localhost", 12345)));

        KetamaNodeLocator locator = new KetamaNodeLocator(nodes, DefaultHashAlgorithm.KETAMA_HASH);

        Iterator<MemcachedNode> i = locator.getSequence("serverList");

        Set<MemcachedNode> foundNodes = new HashSet<MemcachedNode>();
        while (i.hasNext()) {
            // 7 nodes where localhost:333 and localhost:444 are repeated, but there's no localhost:12345
            foundNodes.add(i.next());
        }

        // This fails. localhost:12345 is never found.
        Assert.assertEquals(foundNodes, nodes);
    }

    private MemcachedNode createMockNode(InetSocketAddress sock) {
        MemcachedNode mockNode = EasyMock.createMock(MemcachedNode.class);
        EasyMock.expect(mockNode.getSocketAddress()).andReturn(sock).anyTimes();
        EasyMock.replay(mockNode);
        return mockNode;

    }
}

Original issue reported on code.google.com by ingen...@gmail.com on 5 Jun 2013 at 7:22

GoogleCodeExporter commented 8 years ago
This seems like a critical stability issue. Is there an ETA for a fix?

Original comment by kir...@feedly.com on 13 Jun 2013 at 4:26

GoogleCodeExporter commented 8 years ago
Has this been fixed?  I see Status: Accepted.  That doesn't sound like Fixed.

Original comment by dcp4...@gmail.com on 5 Mar 2014 at 12:09