SEARCH-506: Adding better logging/tests of routing fallback

This commit is contained in:
Gethin James
2017-08-18 16:53:38 +02:00
parent 5520fc2063
commit 4460096585
2 changed files with 29 additions and 18 deletions
@@ -43,7 +43,7 @@ public class ExplicitRouter implements DocRouter {
{
if (log.isDebugEnabled())
{
log.debug("EXPLICIT_ID routing specified but failed to parse a shard property value of "+shardBy+" for node "+node.getNodeRef());
log.debug("Shard "+shardInstance+" EXPLICIT_ID routing specified but failed to parse a shard property value ("+shardBy+") for node "+node.getNodeRef());
}
}
}
@@ -51,10 +51,14 @@ public class ExplicitRouter implements DocRouter {
{
if (log.isDebugEnabled())
{
log.debug("EXPLICIT_ID routing specified but no shard id property found for node "+node.getNodeRef());
log.debug("Shard "+shardInstance+" EXPLICIT_ID routing specified but no shard id property found for node "+node.getNodeRef());
}
}
if (log.isDebugEnabled())
{
log.debug("Shard "+shardInstance+" falling back to DBID routing for node "+node.getNodeRef());
}
return fallback.routeNode(shardCount, shardInstance, node);
}
}
@@ -74,9 +74,7 @@ public class DistributedExplicitShardRoutingTrackerTest extends AbstractAlfresco
null));
}
indexAclChangeSet(bulkAclChangeSet,
bulkAcls,
bulkAclReaders);
indexAclChangeSet(bulkAclChangeSet, bulkAcls, bulkAclReaders);
int numNodes = 1000;
List<Node> nodes = new ArrayList();
@@ -123,21 +121,30 @@ public class DistributedExplicitShardRoutingTrackerTest extends AbstractAlfresco
//lets make sure the other nodes don't have any.
assertShardCount(2, contentQuery, 0);
/**
//Add a node that will get indexed by DBID
Node node = getNode(bigTxn, bulkAcls.get(1), Node.SolrApiNodeStatus.UPDATED);
nodes.add(node);
NodeMetaData nodeMetaData = getNodeMetaData(node, bigTxn, bulkAcls.get(1), "king", null, false);
node.setShardPropertyValue("node YOU DON'T");
nodeMetaDatas.add(nodeMetaData);
//Add another node that will get indexed by DBID
node = getNode(bigTxn, bulkAcls.get(2), Node.SolrApiNodeStatus.UPDATED);
nodes.add(node);
nodeMetaData = getNodeMetaData(node, bigTxn, bulkAcls.get(2), "king", null, false);
Transaction txn1 = getTransaction(0, 2);
List<Node> extraNodes = new ArrayList();
List<NodeMetaData> extraNodeMetaDatas = new ArrayList();
//Add a node that will get indexed by fallback to DBID
Node node = getNode(txn1, bulkAcls.get(1), Node.SolrApiNodeStatus.UPDATED);
extraNodes.add(node);
NodeMetaData nodeMetaData = getNodeMetaData(node, txn1, bulkAcls.get(1), "king", null, false);
node.setShardPropertyValue("node YOU DON'T");
extraNodeMetaDatas.add(nodeMetaData);
//Add another node that will get indexed by fallback to DBID
node = getNode(txn1, bulkAcls.get(2), Node.SolrApiNodeStatus.UPDATED);
extraNodes.add(node);
nodeMetaData = getNodeMetaData(node, txn1, bulkAcls.get(2), "king", null, false);
//Don't set the Share Property but add it anyway
nodeMetaDatas.add(nodeMetaData);
**/
extraNodeMetaDatas.add(nodeMetaData);
indexTransaction(txn1, extraNodes, extraNodeMetaDatas);
begin = System.currentTimeMillis();
//Asserts the the two nodes were not lost even though the ShardPropertyValue was incorrect
waitForShardsCount(contentQuery,numNodes+2,30000, begin);
}
protected Properties getProperties()