Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 35736

Performing a clean uninstall of Search extensions in Team Foundation Server

$
0
0

TFS currently supports search for Code, Work Item and WIKI. Each of these entities have their own extensions that need to be installed for the feature to be enabled for that collection. Extension install is done automatically during Search configuration (note: Work Item and WIKI search extensions are installed by default, whereas Code search is an opt-in feature). Extension can also be installed later from the Local Gallery page (http://{Server}/tfs/_gallery). Extension uninstall can be done from the “Manage extensions” page (http://{Server}/tfs/{Collection}/_admin/_extensions?tab=manage&status=active).

Extension uninstall could be required for multiple reasons –

  • You might not require the feature any longer. Hence, cleaning it up would reclaim disk space taken by that entity index in the Elasticsearch machine.
  • As part of troubleshooting, you might need to reset the index. Uninstalling and re-installing the extension is one of the approach (more details in the blog post here)

Extension uninstall does the following internally –

  • Removes the search feature (for that entity) from the portal
  • Stops all future indexing of the entity data.
  • Deletes the index data for that entity in the Elasticsearch (if the ES is still accessible)
  • Cleans up all tables entries associated with that entity in the Collection DB.

Getting all the above 4 (especially the last 2) is essential to ensure that future extension installation works as expected. Following are the guidance to ensure a clean uninstall –

  • Disable the FaultManagement feature temporarily. That will help speed up the uninstall process (specifically in the scenario where the Elasticsearch cluster is inaccessible; such offline scenarios can potentially occur when the collection properties are pointing to some old cluster). Run the following script on Configuration DB:

declare @features dbo.typ_KeyValuePairStringTableNullable
insert into @features values('#FeatureAvailabilityEntriesSearch.Server.FaultManagement', '0')
exec prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features

The extension uninstall triggers a sequence of clean up jobs per repository under that collection to delete the indices. In the [Tfs_Configuration].[dbo].[tbl_JobHistory] table, you can see delete jobs cleaning up the ES documents. There will be one job result entry for each repository in that collection.

SELECT [JobId], [StartTime], [Result], [ResultMessage] 
FROM [Tfs_Configuration].[dbo].[tbl_JobHistory]
WHERE JobSource = '<CollectionHostId from tbl_ServiceHost>' 
and ResultMessage like '%Delete-SearchExtensionEventNotification%'
ORDER BY StartTime desc

  • [This step applies ONLY to TFS 2017 Update 2 and earlier. The uninstall-install synchronization is built into the indexer pipeline in later releases]

Wait for 10-15 min for documents in the index to be cleaned up.

  • Ensure all IndexingUnits and ChangeEvents for that entity in the Collection DB are cleaned up.

DELETE FROM [Search].[tbl_IndexingUnit] where EntityType = '%EntityType%'
DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] where EntityType = '%EntityType%'

(where, %EntityType% would be 'Code',  'WorkItem' or 'WIKI' depending on the extension being uninstalled)

  • Enable back the FaultManagement feature by running the following script on Configuration DB:

declare @features dbo.typ_KeyValuePairStringTableNullable
insert into @features values('#FeatureAvailabilityEntriesSearch.Server.FaultManagement', '1')
exec prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features

  • [This step applies ONLY to TFS 2017 Update 3 and later]

Verify that the #ServiceALMSearchSettingsIsExtensionOperationInProgress%EntityType%Uninstalled either does not exist, or is reset correctly to false.

SELECT *
FROM [<CollectionDB>].[dbo].[tbl_RegistryItems]
WHERE ParentPath = '#ServiceALMSearchSettingsIsExtensionOperationInProgress%EntityType%'
and ChildItem = 'Uninstalled'

If it is set to 'True', execute the following command to reset it:

declare @registryValue dbo.typ_KeyValuePairStringTableNullable
insert into @registryValue values('#ServiceALMSearchSettingsIsExtensionOperationInProgress%EntityType%Uninstalled', 'False')
exec prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @registryValue

You have now cleanly removed all footprints of the search entity extension from TFS.


Viewing all articles
Browse latest Browse all 35736


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>