Thursday, 28 June 2012

SharePoint Server Search error 2587

After our SharePoint and SQL servers were patched over the weekend, (I'm laying the blame here), SharePoint Server started logged warning event 2587, which looks like this:

The following conditions are currently affecting index propagation to this server for search service application 'SharePoint-Live-Search':
1. Query 1, catalog Main: unresponsive for 104 minutes. not completing tasks
2. Query 1, catalog Anchor: unresponsive for 104 minutes. not completing tasks
3. Query 1 is not being automatically disabled because the minimum number of ready query components per partition is 2.

Using some deep dive research techniques I learnt during recon missions in world war two, I tapped the error code into Google and came across this firm called Microsoft, who have a command to fix this issue. The crux of it is below, but to see the full article, go here.
As well as this error event, my crawls were not completing.

The Restart-SPEnterpriseSearchQueryComponent cmdlet recovers a failed query component from its redundant component under the same index partition. There must be redundant query components (at least two) serving one index partition, one of which being in Ready state.
If this query component is offline because of some failures —for example, index corruption, low disk, or out-of- sync — a user can recover this component by running this cmdlet.

To restart a query component;

1. Take note of the query component name (mine was "Query 1", seen in the event)
2. Open a PowerShell window
3. Run the following commands;

$ess = Get-SPEnterpriseSearchServiceApplication
$qt = $ess.QueryTopologies
$qc = Get-SPEnterpriseSearchQueryComponent -QueryTopology $qt.ActiveTopology 

## List out the query components. Note that in Microsofts example the state of one of their query components is "failed". Both of my query components where in the ready state, even though one was clearly broken. From the error message above, you can see that SharePoint was not automatically disabling it because "the minimum number of ready query components per partition is 2."
$qc  | ft name,state

Name                                         State
1641af7b-62eb-4fff-898d-f08be5086dc7-query-2 Ready
1641af7b-62eb-4fff-898d-f08be5086dc7-query-1 Ready

## Choose the query you need to restart and pipe it the restart commandlet.

 $qc[1]  | Restart-SPEnterpriseSearchQueryComponent 
This will get the query component rebuilding, which may take a while. Problem solved.