* {@inheritDoc}
*/
@Override
public MemcachedNode getPrimary(String k) {
TotalConfig totConfig = fullConfig.get();
Config config = totConfig.getConfig();
Map<String, MemcachedNode> nodesMap = totConfig.getNodesMap();
int vbucket = config.getVbucketByKey(k);
int serverNumber = config.getMaster(vbucket);
if(serverNumber == -1) {
getLogger().warn("The key "+ k +" pointed to vbucket "+ vbucket
+ ", for which no server is responsible in the cluster map (-1). This "
+ "can be an indication that either no replica is defined for a "
+ "failed server or more nodes have been failed over than replicas "
+ "defined.");
return null;
}
String server = config.getServer(serverNumber);
// choose appropriate MemcachedNode according to config data
MemcachedNode pNode = nodesMap.get(server);
if (pNode == null) {
getLogger().error("The node locator does not have a primary for key"
+ " %s. Wanted vbucket %s which should be on server %s.", k,