Friday, July 5, 2013

Search Query Topology stuck at deactivating

Consultant working with us removed a Web Front End server from our SharePoint 2010 farm before removing a query component assigned to that server (query component is on all our web front ends)

This lead to an issue with errors being logged about the query component in the event log:
Log Name: ApplicationSource: Microsoft-SharePoint Products-SharePoint Server SearchEvent ID: 2587Description:The following conditions are currently affecting index propagation to this server for search service application 'Search Service': 1. Query 3 has been disabled so that crawls can continue. It may be recovered via the Restart-SPEnterpriseSearchQueryComponent command in PowerShell.

We then removed the query component from the search topology.

However there was a SQL permission issue as well in the background (still not 100% sure of the cause of that yet)

I found that the old top[ology was stuck at deactivating by using the poweshell command 


GET-SPEnterpriseSearchServiceApplication | GET-SPEnterpriseSearchQueryTopology 

The event log errors continued and laso in the ULS log we were getting a lot errors in the SharePoint 2010 search area.


Unable to find server  

Found great article at http://blogs.msdn.com/b/sharepoint_strategery/archive/2013/05/19/sp2010-troubleshooting-serverid-mismatch-deleting-components.aspx

Which mentioned to do a index reset.  

Great script I found at http://get-spscripts.com/2012/02/resetting-sharepoint-2010-search-index.html which I reporduced below was awesome at resetting the index


#Get the search service application
#You will need to specify the -Identity switch and a name if you have more than one
$sa = Get-SPEnterpriseSearchServiceApplication

#Reset index with the following options in brackets:
#Disable Alerts $true/$false
#Ignore unreachable server $true/$false
try
{
    Write-Host "Attempting to reset the index...please wait"
    $sa.Reset($false, $false)
    Write-Host "Index successfully reset" -ForegroundColor Blue
}
catch
{
    Write-Host "There was a problem resetting the index:" $_ -ForegroundColor Red
}


After the index reset  the topology was inactive so I could then simply use the command




GET-SPEnterpriseSearchServiceApplication | GET-SPEnterpriseSearchQueryTopology | where {$_.Id -eq "2598bfd7-2e73-4f20-ace9-fc8c92010c88"} | Remove-SPEnterpriseSearchQueryTopology