├── .editorconfig ├── Azure_DevOps_Server_2019 ├── CleanUpShardDetails.ps1 ├── Common.psm1 ├── ExcludedTfvcFoldersForIndexing.ps1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── GetCollectionReIndexingActivityStatus.ps1 ├── GetElasticsearchDocCountPerRepository.ps1 ├── GetReIndexingStatusOfFiles.ps1 ├── GetRepositoryReIndexingActivityStatus.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── OptimizeElasticIndex.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── ReIndexFiles.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SetIndexingStateRepository.ps1 ├── SqlScripts │ ├── AddCodeRe-IndexingJobData.sql │ ├── AddFilesToBeIndexed.sql │ ├── AddRepositoryUpdateMetadataChangeEvent.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CleanUpShardDetailsTable.sql │ ├── CodeAccountFaultInResult.sql │ ├── CodeBulkIndexingActivity.sql │ ├── CodeBulkIndexingInProgressActivity.sql │ ├── CodeBulkIndexingInProgressRepositoryCount.sql │ ├── CodeContinuousIndexingActivity.sql │ ├── CodeContinuousIndexingInProgressActivity.sql │ ├── CodeFailedIndexingActivity.sql │ ├── CodeIndexingCompletedCount.sql │ ├── CodeIndexingInProgressRepositories.sql │ ├── CountCodeIndexingCompleted.sql │ ├── CountWorkItemIndexingCompleted.sql │ ├── FixIndexingIndexName.sql │ ├── GetReIndexingStatusOfFiles.sql │ ├── PauseCodeIndexing.sql │ ├── PauseWikiIndexing.sql │ ├── PauseWorkItemIndexing.sql │ ├── QueueCodeExtensionInstallIndexing.sql │ ├── QueueCodeRe-IndexingJob.sql │ ├── QueuePeriodicMaintenanceJob.sql │ ├── QueueWikiExtensionInstallIndexing.sql │ ├── QueueWorkItemExtensionInstallIndexing.sql │ ├── ResumeCodeIndexing.sql │ ├── ResumeWikiIndexing.sql │ ├── ResumeWorkItemIndexing.sql │ ├── TfvcExcludedFolders │ │ ├── AddFoldersInExclusionList.sql │ │ ├── DeleteAllFoldersInExclusionList.sql │ │ ├── FetchFoldersInExclusionList.sql │ │ └── RemoveFoldersFromExclusionList.sql │ ├── WikiAccountFaultInResult.sql │ ├── WikiFailedIndexingActivity.sql │ ├── WikiIndexingCompletedActivity.sql │ ├── WikiIndexingInProgressActivity.sql │ ├── WikiIndexingInProgressRepositories.sql │ ├── WorkItemAccountFaultInResult.sql │ ├── WorkItemBulkIndexingActivity.sql │ ├── WorkItemBulkIndexingInProgressActivity.sql │ ├── WorkItemContinuousIndexingActivity.sql │ ├── WorkItemContinuousIndexingInProgressActivity.sql │ ├── WorkItemFailedIndexingActivity.sql │ └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 ├── Troubleshooting │ ├── Actions │ │ ├── ActionRelations.Tests.ps1 │ │ ├── ActionRelations.ps1 │ │ ├── Enable-IndexingFeatureFlags.psm1 │ │ ├── Remove-Index.psm1 │ │ ├── Remove-OrphanIndexedDocuments.psm1 │ │ ├── Request-ConfigureSearch.psm1 │ │ ├── Request-FixElasticsearchClusterState.psm1 │ │ ├── Request-InstallSearchExtension.psm1 │ │ ├── Request-ReconfigureSearch.psm1 │ │ ├── Request-Upgrade.psm1 │ │ ├── Reset-ExtensionInstallationRegKeys.psm1 │ │ └── Restart-Indexing.psm1 │ ├── Analyzers │ │ ├── AnalyzerRelations.Tests.ps1 │ │ ├── AnalyzerRelations.ps1 │ │ ├── Test-ElasticsearchHealth.psm1 │ │ ├── Test-FaultInJobInInfiniteRetries.psm1 │ │ ├── Test-GeneralTfvcIssues.psm1 │ │ ├── Test-IndexingUnitPointsToDeletedIndex.psm1 │ │ ├── Test-IndicesHaveUnsupportedMappings.psm1 │ │ └── Test-SqlHealth.psm1 │ ├── Repair-Search.ps1 │ ├── SqlScripts │ │ ├── CleanUpCollectionIndexingState.sql │ │ ├── GetCollectionIndexingUnitDetails.sql │ │ ├── QueueJob.sql │ │ ├── SearchCollectionProperties.sql │ │ └── SearchIndexingIndices.sql │ └── Utils │ │ ├── Algorithms.ps1 │ │ └── Common.psm1 └── WipeOutAndResetElasticSearch.ps1 ├── Azure_DevOps_Server_2022 ├── CleanUpShardDetails.ps1 ├── Common.psm1 ├── ExcludedTfvcFoldersForIndexing.ps1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── GetCollectionReIndexingActivityStatus.ps1 ├── GetElasticsearchDocCountPerRepository.ps1 ├── GetReIndexingStatusOfFiles.ps1 ├── GetRepositoryReIndexingActivityStatus.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── OptimizeElasticIndex.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── ReIndexFiles.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SetIndexingStateRepository.ps1 ├── SqlScripts │ ├── AddCodeRe-IndexingJobData.sql │ ├── AddFilesToBeIndexed.sql │ ├── AddRepositoryUpdateMetadataChangeEvent.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CleanUpShardDetailsTable.sql │ ├── CodeAccountFaultInResult.sql │ ├── CodeBulkIndexingActivity.sql │ ├── CodeBulkIndexingInProgressActivity.sql │ ├── CodeBulkIndexingInProgressRepositoryCount.sql │ ├── CodeContinuousIndexingActivity.sql │ ├── CodeContinuousIndexingInProgressActivity.sql │ ├── CodeFailedIndexingActivity.sql │ ├── CodeIndexingCompletedCount.sql │ ├── CodeIndexingInProgressRepositories.sql │ ├── CountCodeIndexingCompleted.sql │ ├── CountWorkItemIndexingCompleted.sql │ ├── FixIndexingIndexName.sql │ ├── GetActiveIncompatibleIndex.sql │ ├── GetReIndexingStatusOfFiles.sql │ ├── PauseCodeIndexing.sql │ ├── PauseWikiIndexing.sql │ ├── PauseWorkItemIndexing.sql │ ├── QueueCodeExtensionInstallIndexing.sql │ ├── QueueCodeRe-IndexingJob.sql │ ├── QueuePeriodicMaintenanceJob.sql │ ├── QueueWikiExtensionInstallIndexing.sql │ ├── QueueWorkItemExtensionInstallIndexing.sql │ ├── ResumeCodeIndexing.sql │ ├── ResumeWikiIndexing.sql │ ├── ResumeWorkItemIndexing.sql │ ├── TfvcExcludedFolders │ │ ├── AddFoldersInExclusionList.sql │ │ ├── DeleteAllFoldersInExclusionList.sql │ │ ├── FetchFoldersInExclusionList.sql │ │ └── RemoveFoldersFromExclusionList.sql │ ├── WikiAccountFaultInResult.sql │ ├── WikiFailedIndexingActivity.sql │ ├── WikiIndexingCompletedActivity.sql │ ├── WikiIndexingInProgressActivity.sql │ ├── WikiIndexingInProgressRepositories.sql │ ├── WorkItemAccountFaultInResult.sql │ ├── WorkItemBulkIndexingActivity.sql │ ├── WorkItemBulkIndexingInProgressActivity.sql │ ├── WorkItemContinuousIndexingActivity.sql │ ├── WorkItemContinuousIndexingInProgressActivity.sql │ ├── WorkItemFailedIndexingActivity.sql │ └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 ├── Troubleshooting │ ├── Actions │ │ ├── ActionRelations.Tests.ps1 │ │ ├── ActionRelations.ps1 │ │ ├── Enable-IndexingFeatureFlags.psm1 │ │ ├── Remove-Index.psm1 │ │ ├── Remove-OrphanIndexedDocuments.psm1 │ │ ├── Request-ConfigureSearch.psm1 │ │ ├── Request-FixElasticsearchClusterState.psm1 │ │ ├── Request-InstallSearchExtension.psm1 │ │ ├── Request-ReconfigureSearch.psm1 │ │ ├── Request-Upgrade.psm1 │ │ ├── Reset-ExtensionInstallationRegKeys.psm1 │ │ └── Restart-Indexing.psm1 │ ├── Analyzers │ │ ├── AnalyzerRelations.Tests.ps1 │ │ ├── AnalyzerRelations.ps1 │ │ ├── Test-ElasticsearchHealth.psm1 │ │ ├── Test-FaultInJobInInfiniteRetries.psm1 │ │ ├── Test-GeneralTfvcIssues.psm1 │ │ ├── Test-IndexingUnitPointsToDeletedIndex.psm1 │ │ ├── Test-IndicesHaveUnsupportedMappings.psm1 │ │ └── Test-SqlHealth.psm1 │ ├── Repair-Search.ps1 │ ├── SqlScripts │ │ ├── CleanUpCollectionIndexingState.sql │ │ ├── GetCollectionIndexingUnitDetails.sql │ │ ├── QueueJob.sql │ │ ├── SearchCollectionProperties.sql │ │ └── SearchIndexingIndices.sql │ ├── Utils │ │ ├── Algorithms.ps1 │ │ └── Common.psm1 │ └── readme.txt ├── ViewDelete-IncompatibleIndices.ps1 └── WipeOutAndResetElasticSearch.ps1 ├── HealthCheck └── Database │ ├── Common.psm1 │ ├── RepoIUHierarchy.sql │ ├── RepositoryHealthCheck.ps1 │ ├── SearchCollectionProperties.sql │ ├── SearchDBSanityCheck.ps1 │ └── SearchFFData.sql ├── Java Migration ├── Azure_DevOps_Server_2019.md ├── README.md ├── TFS_2017 RTW.md ├── TFS_2017Update1.md ├── TFS_2017Update2.md ├── TFS_2017Update3.md ├── TFS_2018RTW.md ├── TFS_2018Update1.md ├── TFS_2018Update2.md ├── TFS_2018Update3.md ├── flow1.png ├── flow2.png └── java_home.png ├── README.md ├── SECURITY.md ├── SearchDiagonistics └── README.txt ├── TFS_2017RTW ├── CheckIndexingStatus.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingRepository.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SqlScripts │ ├── AccountFaultInResult.sql │ ├── AddDataRe-IndexingJob.sql │ ├── AddExtensionInstallJobData.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CountRepositoryIndexingCompleted.sql │ ├── IndexingInProgressRepositoryCount.sql │ ├── PauseCodeIndexing.sql │ ├── QueueExtensionInstallIndexing.sql │ ├── QueueRe-IndexingJob.sql │ ├── RepositoriesInFileDiscoveryPhase.sql │ └── ResumeCodeIndexing.sql ├── TriggerCollectionIndexing.ps1 └── WipeOutAndResetElasticSearch.ps1 ├── TFS_2017Update1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingRepository.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SqlScripts │ ├── AccountFaultInResult.sql │ ├── AddDataRe-IndexingJob.sql │ ├── AddExtensionInstallJobData.sql │ ├── BulkIndexingActivity.sql │ ├── BulkIndexingInProgressActivity.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── ContinuousIndexingActivity.sql │ ├── ContinuousIndexingInProgressActivity.sql │ ├── CountRepositoryIndexingCompleted.sql │ ├── FailedIndexingActivity.sql │ ├── FixIndexingIndexName.sql │ ├── IndexingInProgressRepositoryCount.sql │ ├── PauseCodeIndexing.sql │ ├── QueueExtensionInstallIndexing.sql │ ├── QueueRe-IndexingJob.sql │ └── ResumeCodeIndexing.sql ├── TriggerCollectionIndexing.ps1 └── WipeOutAndResetElasticSearch.ps1 ├── TFS_2017Update2 ├── Common.psm1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SqlScripts │ ├── AddCodeExtensionInstallJobData.sql │ ├── AddCodeRe-IndexingJobData.sql │ ├── AddWorkItemExtensionInstallJobData.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CodeAccountFaultInResult.sql │ ├── CodeBulkIndexingActivity.sql │ ├── CodeBulkIndexingInProgressActivity.sql │ ├── CodeContinuousIndexingActivity.sql │ ├── CodeContinuousIndexingInProgressActivity.sql │ ├── CodeFailedIndexingActivity.sql │ ├── CodeIndexingInProgressRepositoryCount.sql │ ├── CountCodeIndexingCompleted.sql │ ├── CountWorkItemIndexingCompleted.sql │ ├── FixIndexingIndexName.sql │ ├── PauseCodeIndexing.sql │ ├── PauseWorkItemIndexing.sql │ ├── QueueCodeExtensionInstallIndexing.sql │ ├── QueueCodeRe-IndexingJob.sql │ ├── QueueWorkItemExtensionInstallIndexing.sql │ ├── ResumeCodeIndexing.sql │ ├── ResumeWorkItemIndexing.sql │ ├── WorkItemAccountFaultInResult.sql │ ├── WorkItemBulkIndexingActivity.sql │ ├── WorkItemBulkIndexingInProgressActivity.sql │ ├── WorkItemContinuousIndexingActivity.sql │ ├── WorkItemContinuousIndexingInProgressActivity.sql │ ├── WorkItemFailedIndexingActivity.sql │ └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 └── WipeOutAndResetElasticSearch.ps1 ├── TFS_2017Update3 ├── Common.psm1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── GetReIndexingStatusOfFiles.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── ReIndexFiles.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SqlScripts │ ├── AddCodeExtensionInstallJobData.sql │ ├── AddCodeRe-IndexingJobData.sql │ ├── AddFilesToBeIndexed.sql │ ├── AddWorkItemExtensionInstallJobData.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CodeAccountFaultInResult.sql │ ├── CodeBulkIndexingActivity.sql │ ├── CodeBulkIndexingInProgressActivity.sql │ ├── CodeContinuousIndexingActivity.sql │ ├── CodeContinuousIndexingInProgressActivity.sql │ ├── CodeFailedIndexingActivity.sql │ ├── CodeIndexingInProgressRepositoryCount.sql │ ├── CountCodeIndexingCompleted.sql │ ├── CountWorkItemIndexingCompleted.sql │ ├── FixIndexingIndexName.sql │ ├── GetReIndexingStatusOfFiles.sql │ ├── PauseCodeIndexing.sql │ ├── PauseWorkItemIndexing.sql │ ├── QueueCodeExtensionInstallIndexing.sql │ ├── QueueCodeRe-IndexingJob.sql │ ├── QueuePeriodicMaintenanceJob.sql │ ├── QueueWorkItemExtensionInstallIndexing.sql │ ├── ResumeCodeIndexing.sql │ ├── ResumeWorkItemIndexing.sql │ ├── WorkItemAccountFaultInResult.sql │ ├── WorkItemBulkIndexingActivity.sql │ ├── WorkItemBulkIndexingInProgressActivity.sql │ ├── WorkItemContinuousIndexingActivity.sql │ ├── WorkItemContinuousIndexingInProgressActivity.sql │ ├── WorkItemFailedIndexingActivity.sql │ └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 └── WipeOutAndResetElasticSearch.ps1 ├── TFS_2018RTW ├── Common.psm1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── GetReIndexingStatusOfFiles.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── OptimizeElasticIndex.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── ReIndexFiles.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SetIndexingStateRepository.ps1 ├── SqlScripts │ ├── AddCodeExtensionInstallJobData.sql │ ├── AddCodeRe-IndexingJobData.sql │ ├── AddFilesToBeIndexed.sql │ ├── AddRepositoryUpdateMetadataChangeEvent.sql │ ├── AddWorkItemExtensionInstallJobData.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CodeAccountFaultInResult.sql │ ├── CodeBulkIndexingActivity.sql │ ├── CodeBulkIndexingInProgressActivity.sql │ ├── CodeBulkIndexingInProgressRepositoryCount.sql │ ├── CodeContinuousIndexingActivity.sql │ ├── CodeContinuousIndexingInProgressActivity.sql │ ├── CodeFailedIndexingActivity.sql │ ├── CountCodeIndexingCompleted.sql │ ├── CountWorkItemIndexingCompleted.sql │ ├── FixIndexingIndexName.sql │ ├── GetReIndexingStatusOfFiles.sql │ ├── PauseCodeIndexing.sql │ ├── PauseWorkItemIndexing.sql │ ├── QueueCodeExtensionInstallIndexing.sql │ ├── QueueCodeRe-IndexingJob.sql │ ├── QueuePeriodicMaintenanceJob.sql │ ├── QueueWorkItemExtensionInstallIndexing.sql │ ├── ResumeCodeIndexing.sql │ ├── ResumeWorkItemIndexing.sql │ ├── WorkItemAccountFaultInResult.sql │ ├── WorkItemBulkIndexingActivity.sql │ ├── WorkItemBulkIndexingInProgressActivity.sql │ ├── WorkItemContinuousIndexingActivity.sql │ ├── WorkItemContinuousIndexingInProgressActivity.sql │ ├── WorkItemFailedIndexingActivity.sql │ └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 ├── Troubleshooting │ ├── Actions │ │ ├── ActionRelations.Tests.ps1 │ │ ├── ActionRelations.ps1 │ │ ├── Enable-IndexingFeatureFlags.psm1 │ │ ├── Remove-Index.psm1 │ │ ├── Remove-OrphanIndexedDocuments.psm1 │ │ ├── Request-ConfigureSearch.psm1 │ │ ├── Request-FixElasticsearchClusterState.psm1 │ │ ├── Request-InstallSearchExtension.psm1 │ │ ├── Request-ReconfigureSearch.psm1 │ │ ├── Request-TfvcSProcHotfix.psm1 │ │ ├── Request-Upgrade.psm1 │ │ ├── Reset-ExtensionInstallationRegKeys.psm1 │ │ └── Restart-Indexing.psm1 │ ├── Analyzers │ │ ├── AnalyzerRelations.Tests.ps1 │ │ ├── AnalyzerRelations.ps1 │ │ ├── Test-ElasticsearchHealth.psm1 │ │ ├── Test-FaultInJobInInfiniteRetries.psm1 │ │ ├── Test-GeneralTfvcIssues.psm1 │ │ ├── Test-IndexingUnitPointsToDeletedIndex.psm1 │ │ ├── Test-IndicesHaveUnsupportedMappings.psm1 │ │ ├── Test-InefficientTfvcCrawlingStoredProcedure.psm1 │ │ └── Test-SqlHealth.psm1 │ ├── Repair-Search.ps1 │ ├── SqlScripts │ │ ├── CleanUpCollectionIndexingState.sql │ │ ├── GetCollectionIndexingUnitDetails.sql │ │ ├── QueueJob.sql │ │ ├── SearchCollectionProperties.sql │ │ └── SearchIndexingIndices.sql │ └── Utils │ │ ├── Algorithms.ps1 │ │ └── Common.psm1 └── WipeOutAndResetElasticSearch.ps1 ├── TFS_2018Update1 ├── Common.psm1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── GetReIndexingStatusOfFiles.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── OptimizeElasticIndex.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── ReIndexFiles.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SetIndexingStateRepository.ps1 ├── SqlScripts │ ├── AddCodeExtensionInstallJobData.sql │ ├── AddCodeRe-IndexingJobData.sql │ ├── AddFilesToBeIndexed.sql │ ├── AddRepositoryUpdateMetadataChangeEvent.sql │ ├── AddWorkItemExtensionInstallJobData.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CodeAccountFaultInResult.sql │ ├── CodeBulkIndexingActivity.sql │ ├── CodeBulkIndexingInProgressActivity.sql │ ├── CodeBulkIndexingInProgressRepositoryCount.sql │ ├── CodeContinuousIndexingActivity.sql │ ├── CodeContinuousIndexingInProgressActivity.sql │ ├── CodeFailedIndexingActivity.sql │ ├── CountCodeIndexingCompleted.sql │ ├── CountWorkItemIndexingCompleted.sql │ ├── FixIndexingIndexName.sql │ ├── GetReIndexingStatusOfFiles.sql │ ├── PauseCodeIndexing.sql │ ├── PauseWorkItemIndexing.sql │ ├── QueueCodeExtensionInstallIndexing.sql │ ├── QueueCodeRe-IndexingJob.sql │ ├── QueuePeriodicMaintenanceJob.sql │ ├── QueueWorkItemExtensionInstallIndexing.sql │ ├── ResumeCodeIndexing.sql │ ├── ResumeWorkItemIndexing.sql │ ├── WorkItemAccountFaultInResult.sql │ ├── WorkItemBulkIndexingActivity.sql │ ├── WorkItemBulkIndexingInProgressActivity.sql │ ├── WorkItemContinuousIndexingActivity.sql │ ├── WorkItemContinuousIndexingInProgressActivity.sql │ ├── WorkItemFailedIndexingActivity.sql │ └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 ├── Troubleshooting │ ├── Actions │ │ ├── ActionRelations.Tests.ps1 │ │ ├── ActionRelations.ps1 │ │ ├── Enable-IndexingFeatureFlags.psm1 │ │ ├── Remove-Index.psm1 │ │ ├── Remove-OrphanIndexedDocuments.psm1 │ │ ├── Request-ConfigureSearch.psm1 │ │ ├── Request-FixElasticsearchClusterState.psm1 │ │ ├── Request-InstallSearchExtension.psm1 │ │ ├── Request-ReconfigureSearch.psm1 │ │ ├── Request-TfvcSProcHotfix.psm1 │ │ ├── Request-Upgrade.psm1 │ │ ├── Reset-ExtensionInstallationRegKeys.psm1 │ │ └── Restart-Indexing.psm1 │ ├── Analyzers │ │ ├── AnalyzerRelations.Tests.ps1 │ │ ├── AnalyzerRelations.ps1 │ │ ├── Test-ElasticsearchHealth.psm1 │ │ ├── Test-FaultInJobInInfiniteRetries.psm1 │ │ ├── Test-GeneralTfvcIssues.psm1 │ │ ├── Test-IndexingUnitPointsToDeletedIndex.psm1 │ │ ├── Test-IndicesHaveUnsupportedMappings.psm1 │ │ ├── Test-InefficientTfvcCrawlingStoredProcedure.psm1 │ │ └── Test-SqlHealth.psm1 │ ├── Repair-Search.ps1 │ ├── SqlScripts │ │ ├── CleanUpCollectionIndexingState.sql │ │ ├── GetCollectionIndexingUnitDetails.sql │ │ ├── QueueJob.sql │ │ ├── SearchCollectionProperties.sql │ │ └── SearchIndexingIndices.sql │ └── Utils │ │ ├── Algorithms.ps1 │ │ └── Common.psm1 └── WipeOutAndResetElasticSearch.ps1 ├── TFS_2018Update2 ├── Common.psm1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── GetCollectionReIndexingActivityStatus.ps1 ├── GetElasticsearchDocCountPerRepository.ps1 ├── GetReIndexingStatusOfFiles.ps1 ├── GetRepositoryReIndexingActivityStatus.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── OptimizeElasticIndex.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── ReIndexFiles.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics │ ├── CollectionDBDiagnosticScripts │ │ ├── ClassificationNodeData.sql │ │ ├── DisabledFilesData.sql │ │ ├── IndexingUnitChangeEventData.sql │ │ ├── IndexingUnitData.sql │ │ ├── ItemLevelFailuresData.sql │ │ ├── JobYieldData.sql │ │ ├── ResourceLockData.sql │ │ └── SearchRegistryDataOfCollection.sql │ ├── CollectionDBSearchDiagnostics.ps1 │ ├── Common.psm1 │ ├── ConfigurationDBDiagnosticScripts │ │ ├── JobHistoryData.sql │ │ ├── JobQueueData.sql │ │ ├── JobThrottlingData.sql │ │ ├── SearchConnectionUrlData.sql │ │ ├── SearchRegistryData.sql │ │ └── ServiceHostData.sql │ ├── ConfigurationDBSearchDiagnostics.ps1 │ ├── ElasticsearchDiagnostics.ps1 │ └── README.txt ├── SetIndexingStateRepository.ps1 ├── SqlScripts │ ├── AddCodeRe-IndexingJobData.sql │ ├── AddFilesToBeIndexed.sql │ ├── AddRepositoryUpdateMetadataChangeEvent.sql │ ├── CleanUpCollectionIndexingState.sql │ ├── CleanUpCollectionIndexingState_IndexDelete.sql │ ├── CodeAccountFaultInResult.sql │ ├── CodeBulkIndexingActivity.sql │ ├── CodeBulkIndexingInProgressActivity.sql │ ├── CodeBulkIndexingInProgressRepositoryCount.sql │ ├── CodeContinuousIndexingActivity.sql │ ├── CodeContinuousIndexingInProgressActivity.sql │ ├── CodeFailedIndexingActivity.sql │ ├── CodeIndexingCompletedCount.sql │ ├── CodeIndexingInProgressRepositories.sql │ ├── CountCodeIndexingCompleted.sql │ ├── CountWorkItemIndexingCompleted.sql │ ├── FixIndexingIndexName.sql │ ├── GetReIndexingStatusOfFiles.sql │ ├── PauseCodeIndexing.sql │ ├── PauseWikiIndexing.sql │ ├── PauseWorkItemIndexing.sql │ ├── QueueCodeExtensionInstallIndexing.sql │ ├── QueueCodeRe-IndexingJob.sql │ ├── QueuePeriodicMaintenanceJob.sql │ ├── QueueWikiExtensionInstallIndexing.sql │ ├── QueueWorkItemExtensionInstallIndexing.sql │ ├── ResumeCodeIndexing.sql │ ├── ResumeWikiIndexing.sql │ ├── ResumeWorkItemIndexing.sql │ ├── UpdateCodeRepairJobToAllowJobDefinitionOverride.sql │ ├── WikiAccountFaultInResult.sql │ ├── WikiFailedIndexingActivity.sql │ ├── WikiIndexingCompletedActivity.sql │ ├── WikiIndexingInProgressActivity.sql │ ├── WikiIndexingInProgressRepositories.sql │ ├── WorkItemAccountFaultInResult.sql │ ├── WorkItemBulkIndexingActivity.sql │ ├── WorkItemBulkIndexingInProgressActivity.sql │ ├── WorkItemContinuousIndexingActivity.sql │ ├── WorkItemContinuousIndexingInProgressActivity.sql │ ├── WorkItemFailedIndexingActivity.sql │ └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 ├── Troubleshooting │ ├── Actions │ │ ├── ActionRelations.Tests.ps1 │ │ ├── ActionRelations.ps1 │ │ ├── Enable-IndexingFeatureFlags.psm1 │ │ ├── Remove-Index.psm1 │ │ ├── Remove-OrphanIndexedDocuments.psm1 │ │ ├── Request-ConfigureSearch.psm1 │ │ ├── Request-FixElasticsearchClusterState.psm1 │ │ ├── Request-InstallSearchExtension.psm1 │ │ ├── Request-ReconfigureSearch.psm1 │ │ ├── Request-TfvcSProcHotfix.psm1 │ │ ├── Request-Upgrade.psm1 │ │ ├── Reset-ExtensionInstallationRegKeys.psm1 │ │ └── Restart-Indexing.psm1 │ ├── Analyzers │ │ ├── AnalyzerRelations.Tests.ps1 │ │ ├── AnalyzerRelations.ps1 │ │ ├── Test-ElasticsearchHealth.psm1 │ │ ├── Test-FaultInJobInInfiniteRetries.psm1 │ │ ├── Test-GeneralTfvcIssues.psm1 │ │ ├── Test-IndexingUnitPointsToDeletedIndex.psm1 │ │ ├── Test-IndicesHaveUnsupportedMappings.psm1 │ │ ├── Test-InefficientTfvcCrawlingStoredProcedure.psm1 │ │ └── Test-SqlHealth.psm1 │ ├── Repair-Search.ps1 │ ├── SqlScripts │ │ ├── CleanUpCollectionIndexingState.sql │ │ ├── GetCollectionIndexingUnitDetails.sql │ │ ├── QueueJob.sql │ │ ├── SearchCollectionProperties.sql │ │ └── SearchIndexingIndices.sql │ └── Utils │ │ ├── Algorithms.ps1 │ │ └── Common.psm1 └── WipeOutAndResetElasticSearch.ps1 └── TFS_2018Update3 ├── Common.psm1 ├── ExcludedTfvcFoldersForIndexing.ps1 ├── ExtensionInstallIndexingStatus.ps1 ├── FixIndexingIndexName.ps1 ├── GetCollectionReIndexingActivityStatus.ps1 ├── GetElasticsearchDocCountPerRepository.ps1 ├── GetReIndexingStatusOfFiles.ps1 ├── GetRepositoryReIndexingActivityStatus.ps1 ├── MissingIndexFolderTriggerCollectionIndexing.ps1 ├── OptimizeElasticIndex.ps1 ├── PauseIndexing.ps1 ├── Re-IndexingCodeRepository.ps1 ├── ReIndexFiles.ps1 ├── RecentIndexingActivity.ps1 ├── ResumeIndexing.ps1 ├── SearchDiagonistics ├── CollectionDBDiagnosticScripts │ ├── ClassificationNodeData.sql │ ├── DisabledFilesData.sql │ ├── IndexingUnitChangeEventData.sql │ ├── IndexingUnitData.sql │ ├── ItemLevelFailuresData.sql │ ├── JobYieldData.sql │ ├── ResourceLockData.sql │ └── SearchRegistryDataOfCollection.sql ├── CollectionDBSearchDiagnostics.ps1 ├── Common.psm1 ├── ConfigurationDBDiagnosticScripts │ ├── JobHistoryData.sql │ ├── JobQueueData.sql │ ├── JobThrottlingData.sql │ ├── SearchConnectionUrlData.sql │ ├── SearchRegistryData.sql │ └── ServiceHostData.sql ├── ConfigurationDBSearchDiagnostics.ps1 ├── ElasticsearchDiagnostics.ps1 └── README.txt ├── SetIndexingStateRepository.ps1 ├── SqlScripts ├── AddCodeRe-IndexingJobData.sql ├── AddFilesToBeIndexed.sql ├── AddRepositoryUpdateMetadataChangeEvent.sql ├── CleanUpCollectionIndexingState.sql ├── CleanUpCollectionIndexingState_IndexDelete.sql ├── CodeAccountFaultInResult.sql ├── CodeBulkIndexingActivity.sql ├── CodeBulkIndexingInProgressActivity.sql ├── CodeBulkIndexingInProgressRepositoryCount.sql ├── CodeContinuousIndexingActivity.sql ├── CodeContinuousIndexingInProgressActivity.sql ├── CodeFailedIndexingActivity.sql ├── CodeIndexingCompletedCount.sql ├── CodeIndexingInProgressRepositories.sql ├── CountCodeIndexingCompleted.sql ├── CountWorkItemIndexingCompleted.sql ├── FixIndexingIndexName.sql ├── GetReIndexingStatusOfFiles.sql ├── PauseCodeIndexing.sql ├── PauseWikiIndexing.sql ├── PauseWorkItemIndexing.sql ├── QueueCodeExtensionInstallIndexing.sql ├── QueueCodeRe-IndexingJob.sql ├── QueuePeriodicMaintenanceJob.sql ├── QueueWikiExtensionInstallIndexing.sql ├── QueueWorkItemExtensionInstallIndexing.sql ├── ResumeCodeIndexing.sql ├── ResumeWikiIndexing.sql ├── ResumeWorkItemIndexing.sql ├── TfvcExcludedFolders │ ├── AddFoldersInExclusionList.sql │ ├── DeleteAllFoldersInExclusionList.sql │ ├── FetchFoldersInExclusionList.sql │ └── RemoveFoldersFromExclusionList.sql ├── UpdateCodeRepairJobToAllowJobDefinitionOverride.sql ├── WikiAccountFaultInResult.sql ├── WikiFailedIndexingActivity.sql ├── WikiIndexingCompletedActivity.sql ├── WikiIndexingInProgressActivity.sql ├── WikiIndexingInProgressRepositories.sql ├── WorkItemAccountFaultInResult.sql ├── WorkItemBulkIndexingActivity.sql ├── WorkItemBulkIndexingInProgressActivity.sql ├── WorkItemContinuousIndexingActivity.sql ├── WorkItemContinuousIndexingInProgressActivity.sql ├── WorkItemFailedIndexingActivity.sql └── WorkItemIndexingInProgressRepositoryCount.sql ├── TriggerCollectionIndexing.ps1 ├── Troubleshooting ├── Actions │ ├── ActionRelations.Tests.ps1 │ ├── ActionRelations.ps1 │ ├── Enable-IndexingFeatureFlags.psm1 │ ├── Remove-Index.psm1 │ ├── Remove-OrphanIndexedDocuments.psm1 │ ├── Request-ConfigureSearch.psm1 │ ├── Request-FixElasticsearchClusterState.psm1 │ ├── Request-InstallSearchExtension.psm1 │ ├── Request-ReconfigureSearch.psm1 │ ├── Request-Upgrade.psm1 │ ├── Reset-ExtensionInstallationRegKeys.psm1 │ └── Restart-Indexing.psm1 ├── Analyzers │ ├── AnalyzerRelations.Tests.ps1 │ ├── AnalyzerRelations.ps1 │ ├── Test-ElasticsearchHealth.psm1 │ ├── Test-FaultInJobInInfiniteRetries.psm1 │ ├── Test-GeneralTfvcIssues.psm1 │ ├── Test-IndexingUnitPointsToDeletedIndex.psm1 │ ├── Test-IndicesHaveUnsupportedMappings.psm1 │ └── Test-SqlHealth.psm1 ├── Repair-Search.ps1 ├── SqlScripts │ ├── CleanUpCollectionIndexingState.sql │ ├── GetCollectionIndexingUnitDetails.sql │ ├── QueueJob.sql │ ├── SearchCollectionProperties.sql │ └── SearchIndexingIndices.sql └── Utils │ ├── Algorithms.ps1 │ └── Common.psm1 └── WipeOutAndResetElasticSearch.ps1 /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Settings for all file types 7 | [*] 8 | end_of_line = crlf 9 | trim_trailing_whitespace: true 10 | insert_final_newline = true 11 | 12 | [*.ps1] 13 | indent_style = space 14 | indent_size = 4 15 | 16 | [*.sql] 17 | indent_style = tab 18 | indent_size = 4 19 | 20 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/CleanUpShardDetails.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This scripts cleans the shard details table from the configuration database 3 | #> 4 | 5 | [CmdletBinding()] 6 | Param( 7 | [Parameter(Mandatory=$True, Position=0, HelpMessage="The Server Instance against which the script is to run.")] 8 | [string]$SQLServerInstance, 9 | 10 | [Parameter(Mandatory=$True, Position=1, HelpMessage="Configuration DB")] 11 | [string]$ConfigurationDatabaseName 12 | ) 13 | 14 | function CleanupShardDetails 15 | { 16 | $SqlFullPath = Join-Path $PWD -ChildPath 'SqlScripts\CleanUpShardDetailsTable.sql' 17 | Invoke-Sqlcmd -InputFile $SqlFullPath -serverInstance $SQLServerInstance -database $ConfigurationDatabaseName -Verbose 18 | Write-Host "Cleaned up the shard details..." -ForegroundColor Yellow 19 | } 20 | 21 | CleanupShardDetails -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | TRUNCATE TABLE [Search].[tbl_ClassificationNode] 5 | TRUNCATE TABLE [Search].[tbl_DisabledFiles] 6 | TRUNCATE TABLE [Search].[tbl_IndexingUnit] 7 | TRUNCATE TABLE [Search].[tbl_IndexingUnitIndexingInformation] 8 | TRUNCATE TABLE [Search].[tbl_IndexingUnitChangeEvent] 9 | TRUNCATE TABLE [Search].[tbl_IndexingUnitWikis] 10 | TRUNCATE TABLE [Search].[tbl_ItemLevelFailures] 11 | TRUNCATE TABLE [Search].[tbl_JobYield] 12 | TRUNCATE TABLE [Search].[tbl_ResourceLockTable] 13 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CleanUpShardDetailsTable.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the entries in the shard details table. 3 | **/ 4 | TRUNCATE TABLE [Search].[tbl_ShardDetails] 5 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for BulkIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for ContinuousIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: Code%') 15 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%') 15 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/PauseCodeIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable code indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.CrudOperations\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 9 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/PauseWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/PauseWorkItemIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable work item indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.CrudOperations\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 9 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/QueuePeriodicMaintenanceJob.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue Periodic Maintenance Job for the given collection id. 2 | -- The script needs to be executed on the Configuration DB. 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | -- ID of Periodic Maintenance job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '1761D61B-4708-42A2-9E29-A39540141277' 9 | 10 | Declare @jobList dbo.typ_JobQueueUpdateTable 11 | Insert into @jobList values (@JobID, 10); 12 | 13 | Declare @priorityLevel int; 14 | SET @priorityLevel = 10 15 | 16 | Declare @delaySeconds int; 17 | SET @delaySeconds = 0; 18 | 19 | DECLARE @queueAsDormant bit; 20 | SET @queueAsDormant = 0; 21 | 22 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/QueueWikiExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the Wiki AccountFault In Job in case of fresh indexing for the given collection id. 2 | * DATABASE : CONFIGURATION DB 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @jobList dbo.typ_JobQueueUpdateTable 7 | 8 | -- ID of the Account Fault In job to be queued. 9 | DECLARE @JobID uniqueIdentifier = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 10 | Insert into @jobList values (@JobID, 10); 11 | Declare @priorityLevel int; 12 | SET @priorityLevel = 10 13 | Declare @delaySeconds int; 14 | SET @delaySeconds = 0; 15 | DECLARE @queueAsDormant bit; 16 | SET @queueAsDormant = 0; 17 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/ResumeCodeIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable code indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.CrudOperations\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/ResumeWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/ResumeWorkItemIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable work item indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.CrudOperations\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WikiAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the WikiAccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory WITH (NOLOCK) 8 | WHERE JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WikiFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing operations failed in the given date range. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @Days int = $(DaysAgo); 7 | 8 | SELECT Count(Id) AS FailedIndexingCount 9 | FROM Search.tbl_IndexingUnitChangeEvent AS IUCE join 10 | Search.tbl_IndexingUnit as IU ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 11 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State = 'Failed' 12 | AND IU.IndexingUnitType = 'Git_Repository' 13 | AND IU.EntityType = 'Wiki' 14 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) 15 | AND IUCE.CreatedTimeUTC > DATEADD(DAY, -@Days, GETUTCDATE()) -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WikiIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id 2 | /* 3 | This script gets the number of repositories for which the indexing of a wiki git repository is in Progress. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | SELECT Count(DISTINCT(TfsEntityId)) AS IndexingInProgressCount 8 | FROM Search.tbl_IndexingUnit AS IU join 9 | Search.tbl_IndexingUnitChangeEvent as IUCE ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 10 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 11 | AND IU.IndexingUnitType = 'Git_Repository' 12 | AND IU.EntityType = 'Wiki' 13 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | and IU.PartitionId > 0 12 | and IUCE.PartitionId > 0 13 | 14 | 15 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | and IU.PartitionId > 0 13 | and IUCE.PartitionId > 0 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2019/Troubleshooting/SqlScripts/QueueJob.sql: -------------------------------------------------------------------------------- 1 | DECLARE @HostId UNIQUEIDENTIFIER = $(HostId) 2 | DECLARE @JobId UNIQUEIDENTIFIER = $(JobId) 3 | 4 | DECLARE @jobList dbo.typ_JobQueueUpdateTable 5 | INSERT INTO @jobList VALUES (@JobId, 10) 6 | DECLARE @priorityLevel INT = 10 7 | DECLARE @delaySeconds INT = 0 8 | DECLARE @queueAsDormant BIT = 0 9 | 10 | EXEC dbo.prc_QueueJobs @HostId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/CleanUpShardDetails.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | This scripts cleans the shard details table from the configuration database 3 | #> 4 | 5 | [CmdletBinding()] 6 | Param( 7 | [Parameter(Mandatory=$True, Position=0, HelpMessage="The Server Instance against which the script is to run.")] 8 | [string]$SQLServerInstance, 9 | 10 | [Parameter(Mandatory=$True, Position=1, HelpMessage="Configuration DB")] 11 | [string]$ConfigurationDatabaseName 12 | ) 13 | 14 | function CleanupShardDetails 15 | { 16 | $SqlFullPath = Join-Path $PWD -ChildPath 'SqlScripts\CleanUpShardDetailsTable.sql' 17 | Invoke-Sqlcmd -InputFile $SqlFullPath -serverInstance $SQLServerInstance -database $ConfigurationDatabaseName -Verbose 18 | Write-Host "Cleaned up the shard details..." -ForegroundColor Yellow 19 | } 20 | 21 | CleanupShardDetails -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | TRUNCATE TABLE [Search].[tbl_ClassificationNode] 5 | TRUNCATE TABLE [Search].[tbl_DisabledFiles] 6 | TRUNCATE TABLE [Search].[tbl_IndexingUnit] 7 | TRUNCATE TABLE [Search].[tbl_IndexingUnitIndexingInformation] 8 | TRUNCATE TABLE [Search].[tbl_IndexingUnitChangeEvent] 9 | TRUNCATE TABLE [Search].[tbl_IndexingUnitWikis] 10 | TRUNCATE TABLE [Search].[tbl_ItemLevelFailures] 11 | TRUNCATE TABLE [Search].[tbl_JobYield] 12 | TRUNCATE TABLE [Search].[tbl_ResourceLockTable] 13 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CleanUpShardDetailsTable.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the entries in the shard details table. 3 | **/ 4 | TRUNCATE TABLE [Search].[tbl_ShardDetails] 5 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for BulkIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for ContinuousIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: Code%') 15 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%') 15 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/GetActiveIncompatibleIndex.sql: -------------------------------------------------------------------------------- 1 | DECLARE @IndexName VARCHAR(500) = $(IndexName); 2 | 3 | SELECT TFSEntityId, EntityType, IndexingUnitType, IndexingUnitId, ParentUnitId 4 | FROM Search.tbl_IndexingUnit 5 | WHERE Properties LIKE '%' + @IndexName + '%' 6 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/PauseCodeIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable code indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.CrudOperations\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 9 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/PauseWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/PauseWorkItemIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable work item indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.CrudOperations\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 9 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/QueueCodeExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/QueuePeriodicMaintenanceJob.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue Periodic Maintenance Job for the given collection id. 2 | -- The script needs to be executed on the Configuration DB. 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | -- ID of Periodic Maintenance job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '1761D61B-4708-42A2-9E29-A39540141277' 9 | 10 | Declare @jobList dbo.typ_JobQueueUpdateTable 11 | Insert into @jobList values (@JobID, 10); 12 | 13 | Declare @priorityLevel int; 14 | SET @priorityLevel = 10 15 | 16 | Declare @delaySeconds int; 17 | SET @delaySeconds = 0; 18 | 19 | DECLARE @queueAsDormant bit; 20 | SET @queueAsDormant = 0; 21 | 22 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/QueueWikiExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the Wiki AccountFault In Job in case of fresh indexing for the given collection id. 2 | * DATABASE : CONFIGURATION DB 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @jobList dbo.typ_JobQueueUpdateTable 7 | 8 | -- ID of the Account Fault In job to be queued. 9 | DECLARE @JobID uniqueIdentifier = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 10 | Insert into @jobList values (@JobID, 10); 11 | Declare @priorityLevel int; 12 | SET @priorityLevel = 10 13 | Declare @delaySeconds int; 14 | SET @delaySeconds = 0; 15 | DECLARE @queueAsDormant bit; 16 | SET @queueAsDormant = 0; 17 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/ResumeCodeIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable code indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Code.CrudOperations\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/ResumeWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/ResumeWorkItemIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable work item indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.WorkItem.CrudOperations\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WikiAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the WikiAccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory WITH (NOLOCK) 8 | WHERE JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WikiFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing operations failed in the given date range. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @Days int = $(DaysAgo); 7 | 8 | SELECT Count(Id) AS FailedIndexingCount 9 | FROM Search.tbl_IndexingUnitChangeEvent AS IUCE join 10 | Search.tbl_IndexingUnit as IU ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 11 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State = 'Failed' 12 | AND IU.IndexingUnitType = 'Git_Repository' 13 | AND IU.EntityType = 'Wiki' 14 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) 15 | AND IUCE.CreatedTimeUTC > DATEADD(DAY, -@Days, GETUTCDATE()) -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WikiIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id 2 | /* 3 | This script gets the number of repositories for which the indexing of a wiki git repository is in Progress. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | SELECT Count(DISTINCT(TfsEntityId)) AS IndexingInProgressCount 8 | FROM Search.tbl_IndexingUnit AS IU join 9 | Search.tbl_IndexingUnitChangeEvent as IUCE ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 10 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 11 | AND IU.IndexingUnitType = 'Git_Repository' 12 | AND IU.EntityType = 'Wiki' 13 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | and IU.PartitionId > 0 12 | and IUCE.PartitionId > 0 13 | 14 | 15 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | and IU.PartitionId > 0 13 | and IUCE.PartitionId > 0 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /Azure_DevOps_Server_2022/Troubleshooting/SqlScripts/QueueJob.sql: -------------------------------------------------------------------------------- 1 | DECLARE @HostId UNIQUEIDENTIFIER = $(HostId) 2 | DECLARE @JobId UNIQUEIDENTIFIER = $(JobId) 3 | 4 | DECLARE @jobList dbo.typ_JobQueueUpdateTable 5 | INSERT INTO @jobList VALUES (@JobId, 10) 6 | DECLARE @priorityLevel INT = 10 7 | DECLARE @delaySeconds INT = 0 8 | DECLARE @queueAsDormant BIT = 0 9 | 10 | EXEC dbo.prc_QueueJobs @HostId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /HealthCheck/Database/SearchFFData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search FF states for indexing. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ParentPath like '%Search.Server.Code.Indexing%' or 9 | ParentPath like '%Search.Server.Code.CrudOperations%' or 10 | ParentPath like '%Search.Server.WorkItem.Indexing%' or 11 | ParentPath like '%Search.Server.WorkItem.CrudOperations%' or 12 | ParentPath like '%Search.Server.Wiki.Indexing%' or 13 | ParentPath like '%Search.Server.Wiki.ContinuousIndexing%') and 14 | ChildItem like '%AvailabilityState%' -------------------------------------------------------------------------------- /Java Migration/flow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Code-Search/5745edc2f5dfa15673c3ec9515e67054755e41a5/Java Migration/flow1.png -------------------------------------------------------------------------------- /Java Migration/flow2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Code-Search/5745edc2f5dfa15673c3ec9515e67054755e41a5/Java Migration/flow2.png -------------------------------------------------------------------------------- /Java Migration/java_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Code-Search/5745edc2f5dfa15673c3ec9515e67054755e41a5/Java Migration/java_home.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Code-Search 2 | Code Search Admin scripts (SQL and PS) for managing a Code Search on-prem instance 3 | 4 | ## Troubleshooting 5 | 6 | To find help on troubleshooting Azure DevOps Server follow this [link](https://docs.microsoft.com/azure/devops/project/search/administration#troubleshoot-search-in-azure-devops-server-and-tfs). 7 | -------------------------------------------------------------------------------- /SearchDiagonistics/README.txt: -------------------------------------------------------------------------------- 1 | Navigate one level up from the directory containing this file and follow the instructions in \SearchDiagnostics\README.txt file. 2 | For example, if you want to report a Search issue in TFS 2018 Update 2, follow the instructions in TFS_2018Update2\SearchDiagnostics\README.txt file. -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2017RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2017RTW/SqlScripts/AccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2017RTW/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] 6 | DELETE FROM [Search].[tbl_JobYield] 7 | DELETE FROM [Search].[tbl_TreeStore] 8 | DELETE FROM [Search].[tbl_ResourceLockTable] 9 | -------------------------------------------------------------------------------- /TFS_2017RTW/SqlScripts/CountRepositoryIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id 2 | /* 3 | This script gets the number of repositories for which the DataCrawl stage has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%AccountFaultIn%RepositoryDataCrawlerOperation for %completed%' 14 | -------------------------------------------------------------------------------- /TFS_2017RTW/SqlScripts/IndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | 5 | SELECT TS.TFSEntityId, (Count(*)*500) as MaxFilesPending 6 | FROM Search.tbl_TreeStore as TS join 7 | (SELECT DISTINCT(TfsEntityId) as RepositoryIndexingInProgress 8 | FROM Search.tbl_IndexingUnit as IU join 9 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 10 | where IUCE.ChangeType = 'DataCrawl' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued')) as IndexingInProgressRepositories 11 | on TS.TFSEntityId = IndexingInProgressRepositories.RepositoryIndexingInProgress 12 | group by TS.TFSEntityId 13 | -------------------------------------------------------------------------------- /TFS_2017RTW/SqlScripts/QueueExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_GuidInt32Table 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2017RTW/SqlScripts/RepositoriesInFileDiscoveryPhase.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the count of repositories still in File Discovery phase 3 | */ 4 | 5 | 6 | SELECT TS.TFSEntityId, (Count(*)*500) as MaxFilesDiscovered 7 | FROM Search.tbl_TreeStore as TS join 8 | (SELECT Distinct(TfsEntityId) as RepositoryInFileDiscoveryPhase 9 | FROM Search.tbl_IndexingUnit as IU join 10 | Search.tbl_IndexingUnitChangeEvent as IUCE 11 | on IU.IndexingUnitId = IUCE.IndexingUnitId 12 | WHERE IUCE.ChangeType = 'BulkTreeCrawl' and IUCE.State in ('InProgress', 'Pending', 'Queued')) as RepositoriesInFileDiscoveryPhase 13 | on TS.TFSEntityId = RepositoriesInFileDiscoveryPhase.RepositoryInFileDiscoveryPhase 14 | group by TS.TFSEntityId -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2017Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/AccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/BulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex%Completed pipeline execution for IndexingUnit%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/BulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('TFVC_Repository', 'GIT_Repository') 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] 6 | DELETE FROM [Search].[tbl_JobYield] 7 | DELETE FROM [Search].[tbl_TreeStore] 8 | DELETE FROM [Search].[tbl_ResourceLockTable] 9 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/ContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/ContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType in ('TFVC_Repository', 'GIT_Repository') 11 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/CountRepositoryIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/FailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/IndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as RepositoryIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('TFVC_Repository', 'GIT_Repository') 10 | 11 | -------------------------------------------------------------------------------- /TFS_2017Update1/SqlScripts/QueueExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2017Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] 6 | DELETE FROM [Search].[tbl_JobYield] 7 | DELETE FROM [Search].[tbl_TreeStore] 8 | DELETE FROM [Search].[tbl_ResourceLockTable] 9 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CodeBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('TFVC_Repository', 'GIT_Repository') 10 | and IU.EntityType = 'Code' 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CodeContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType in ('Tfvc_Repository', 'Git_Repository') 11 | and IU.EntityType = 'Code' 12 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CodeIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as RepositoryIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Tfvc_Repository', 'Git_Repository') 10 | and IU.EntityType = 'Code' 11 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/QueueCodeExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | 12 | 13 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update2/SqlScripts/WorkItemIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as ProjectWorkItemIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType = 'Project' 10 | and IU.EntityType = 'WorkItem' 11 | -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2017Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] 6 | DELETE FROM [Search].[tbl_JobYield] 7 | DELETE FROM [Search].[tbl_TreeStore] 8 | DELETE FROM [Search].[tbl_ResourceLockTable] 9 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CodeBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('TFVC_Repository', 'GIT_Repository') 10 | and IU.EntityType = 'Code' 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CodeContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType in ('Tfvc_Repository', 'Git_Repository') 11 | and IU.EntityType = 'Code' 12 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CodeIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as RepositoryIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Tfvc_Repository', 'Git_Repository') 10 | and IU.EntityType = 'Code' 11 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/QueueCodeExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/QueuePeriodicMaintenanceJob.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue Periodic Maintenance Job for the given collection id. 2 | -- The script needs to be executed on the Configuration DB. 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | -- ID of Periodic Maintenance job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '1761D61B-4708-42A2-9E29-A39540141277' 9 | 10 | Declare @jobList dbo.typ_JobQueueUpdateTable 11 | Insert into @jobList values (@JobID, 10); 12 | 13 | Declare @priorityLevel int; 14 | SET @priorityLevel = 10 15 | 16 | Declare @delaySeconds int; 17 | SET @delaySeconds = 0; 18 | 19 | DECLARE @queueAsDormant bit; 20 | SET @queueAsDormant = 0; 21 | 22 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | 12 | 13 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2017Update3/SqlScripts/WorkItemIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as ProjectWorkItemIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType = 'Project' 10 | and IU.EntityType = 'WorkItem' 11 | -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2018RTW/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] 6 | DELETE FROM [Search].[tbl_JobYield] 7 | DELETE FROM [Search].[tbl_TreeStore] 8 | DELETE FROM [Search].[tbl_ResourceLockTable] 9 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for BulkIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CodeBulkIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as RepositoryIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 9 | and IU.IndexingUnitType in ('Tfvc_Repository', 'Git_Repository') 10 | and IU.EntityType = 'Code' 11 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for ContinuousIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CodeContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs in progress. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 9 | where (( IU.IndexingUnitType = 'Git_Repository' and IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData like '%PushEventNotification%') 10 | or 11 | ( IU.IndexingUnitType = 'TFVC_Repository' and IUCE.ChangeType = 'UpdateIndex')) 12 | and IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 13 | and IU.EntityType = 'Code' 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/QueueCodeExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/QueuePeriodicMaintenanceJob.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue Periodic Maintenance Job for the given collection id. 2 | -- The script needs to be executed on the Configuration DB. 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | -- ID of Periodic Maintenance job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '1761D61B-4708-42A2-9E29-A39540141277' 9 | 10 | Declare @jobList dbo.typ_JobQueueUpdateTable 11 | Insert into @jobList values (@JobID, 10); 12 | 13 | Declare @priorityLevel int; 14 | SET @priorityLevel = 10 15 | 16 | Declare @delaySeconds int; 17 | SET @delaySeconds = 0; 18 | 19 | DECLARE @queueAsDormant bit; 20 | SET @queueAsDormant = 0; 21 | 22 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | 12 | 13 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018RTW/SqlScripts/WorkItemIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as ProjectWorkItemIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType = 'Project' 10 | and IU.EntityType = 'WorkItem' 11 | -------------------------------------------------------------------------------- /TFS_2018RTW/Troubleshooting/SqlScripts/QueueJob.sql: -------------------------------------------------------------------------------- 1 | DECLARE @HostId UNIQUEIDENTIFIER = $(HostId) 2 | DECLARE @JobId UNIQUEIDENTIFIER = $(JobId) 3 | 4 | DECLARE @jobList dbo.typ_JobQueueUpdateTable 5 | INSERT INTO @jobList VALUES (@JobId, 10) 6 | DECLARE @priorityLevel INT = 10 7 | DECLARE @delaySeconds INT = 0 8 | DECLARE @queueAsDormant BIT = 0 9 | 10 | EXEC dbo.prc_QueueJobs @HostId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2018Update1/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] 6 | DELETE FROM [Search].[tbl_JobYield] 7 | DELETE FROM [Search].[tbl_TreeStore] 8 | DELETE FROM [Search].[tbl_ResourceLockTable] 9 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for BulkIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CodeBulkIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as RepositoryIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 9 | and IU.IndexingUnitType in ('Tfvc_Repository', 'Git_Repository') 10 | and IU.EntityType = 'Code' 11 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for ContinuousIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CodeContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs in progress. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 9 | where (( IU.IndexingUnitType = 'Git_Repository' and IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData like '%PushEventNotification%') 10 | or 11 | ( IU.IndexingUnitType = 'TFVC_Repository' and IUCE.ChangeType = 'UpdateIndex')) 12 | and IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 13 | and IU.EntityType = 'Code' 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/QueueCodeExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/QueuePeriodicMaintenanceJob.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue Periodic Maintenance Job for the given collection id. 2 | -- The script needs to be executed on the Configuration DB. 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | -- ID of Periodic Maintenance job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '1761D61B-4708-42A2-9E29-A39540141277' 9 | 10 | Declare @jobList dbo.typ_JobQueueUpdateTable 11 | Insert into @jobList values (@JobID, 10); 12 | 13 | Declare @priorityLevel int; 14 | SET @priorityLevel = 10 15 | 16 | Declare @delaySeconds int; 17 | SET @delaySeconds = 0; 18 | 19 | DECLARE @queueAsDormant bit; 20 | SET @queueAsDormant = 0; 21 | 22 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | 12 | 13 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update1/SqlScripts/WorkItemIndexingInProgressRepositoryCount.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the per repository status of indexing 3 | */ 4 | SELECT DISTINCT(TfsEntityId), substring(TfsEntityAttributes, CHARINDEX('', TFSEntityAttributes) + 16, 5 | (CHARINDEX('', TFSEntityAttributes) - (CHARINDEX('', TFSEntityAttributes) + 16))) as ProjectWorkItemIndexingInProgress 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeType = 'BeginBulkIndex' and IUCE.ChangeData Like '%AccountFaultIn%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType = 'Project' 10 | and IU.EntityType = 'WorkItem' 11 | -------------------------------------------------------------------------------- /TFS_2018Update1/Troubleshooting/SqlScripts/QueueJob.sql: -------------------------------------------------------------------------------- 1 | DECLARE @HostId UNIQUEIDENTIFIER = $(HostId) 2 | DECLARE @JobId UNIQUEIDENTIFIER = $(JobId) 3 | 4 | DECLARE @jobList dbo.typ_JobQueueUpdateTable 5 | INSERT INTO @jobList VALUES (@JobId, 10) 6 | DECLARE @priorityLevel INT = 10 7 | DECLARE @delaySeconds INT = 0 8 | DECLARE @queueAsDormant BIT = 0 9 | 10 | EXEC dbo.prc_QueueJobs @HostId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2018Update2/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] WHERE PartitionId > 0 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] WHERE PartitionId > 0 6 | DELETE FROM [Search].[tbl_JobYield] WHERE PartitionId > 0 7 | DELETE FROM [Search].[tbl_TreeStore] WHERE PartitionId > 0 8 | DELETE FROM [Search].[tbl_ResourceLockTable] WHERE PartitionId > 0 9 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for BulkIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') 14 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for ContinuousIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: Code%') 15 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%') 15 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/PauseWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/QueueCodeExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/QueuePeriodicMaintenanceJob.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue Periodic Maintenance Job for the given collection id. 2 | -- The script needs to be executed on the Configuration DB. 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | -- ID of Periodic Maintenance job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '1761D61B-4708-42A2-9E29-A39540141277' 9 | 10 | Declare @jobList dbo.typ_JobQueueUpdateTable 11 | Insert into @jobList values (@JobID, 10); 12 | 13 | Declare @priorityLevel int; 14 | SET @priorityLevel = 10 15 | 16 | Declare @delaySeconds int; 17 | SET @delaySeconds = 0; 18 | 19 | DECLARE @queueAsDormant bit; 20 | SET @queueAsDormant = 0; 21 | 22 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/QueueWikiExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the Wiki AccountFault In Job in case of fresh indexing for the given collection id. 2 | * DATABASE : CONFIGURATION DB 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @jobList dbo.typ_JobQueueUpdateTable 7 | 8 | -- ID of the Account Fault In job to be queued. 9 | DECLARE @JobID uniqueIdentifier = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 10 | Insert into @jobList values (@JobID, 10); 11 | Declare @priorityLevel int; 12 | SET @priorityLevel = 10 13 | Declare @delaySeconds int; 14 | SET @delaySeconds = 0; 15 | DECLARE @queueAsDormant bit; 16 | SET @queueAsDormant = 0; 17 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/ResumeWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WikiAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the WikiAccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory WITH (NOLOCK) 8 | WHERE JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WikiFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing operations failed in the given date range. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @Days int = $(DaysAgo); 7 | 8 | SELECT Count(Id) AS FailedIndexingCount 9 | FROM Search.tbl_IndexingUnitChangeEvent AS IUCE join 10 | Search.tbl_IndexingUnit as IU ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 11 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State = 'Failed' 12 | AND IU.IndexingUnitType = 'Git_Repository' 13 | AND IU.EntityType = 'Wiki' 14 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) 15 | AND IUCE.CreatedTimeUTC > DATEADD(DAY, -@Days, GETUTCDATE()) -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WikiIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id 2 | /* 3 | This script gets the number of repositories for which the indexing of a wiki git repository is in Progress. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | SELECT Count(DISTINCT(TfsEntityId)) AS IndexingInProgressCount 8 | FROM Search.tbl_IndexingUnit AS IU join 9 | Search.tbl_IndexingUnitChangeEvent as IUCE ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 10 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 11 | AND IU.IndexingUnitType = 'Git_Repository' 12 | AND IU.EntityType = 'Wiki' 13 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | and IU.PartitionId > 0 12 | and IUCE.PartitionId > 0 13 | 14 | 15 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | and IU.PartitionId > 0 13 | and IUCE.PartitionId > 0 14 | -------------------------------------------------------------------------------- /TFS_2018Update2/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update2/Troubleshooting/SqlScripts/QueueJob.sql: -------------------------------------------------------------------------------- 1 | DECLARE @HostId UNIQUEIDENTIFIER = $(HostId) 2 | DECLARE @JobId UNIQUEIDENTIFIER = $(JobId) 3 | 4 | DECLARE @jobList dbo.typ_JobQueueUpdateTable 5 | INSERT INTO @jobList VALUES (@JobId, 10) 6 | DECLARE @priorityLevel INT = 10 7 | DECLARE @delaySeconds INT = 0 8 | DECLARE @queueAsDormant BIT = 0 9 | 10 | EXEC dbo.prc_QueueJobs @HostId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/ClassificationNodeData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ProjectId] 2 | ,[Id] 3 | ,[Identifier] 4 | ,[Name] 5 | ,[Path] 6 | ,[NodeType] 7 | ,[ParentId] 8 | ,[Token] 9 | ,[SecurityHashcode] 10 | FROM [Search].[tbl_ClassificationNode] -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/DisabledFilesData.sql: -------------------------------------------------------------------------------- 1 | SELECT [RepositoryId] 2 | ,[BranchName] 3 | ,[FilePath] 4 | ,[DisableReason] 5 | ,[ContentHash] 6 | ,[LastUpdatedTimeStamp] 7 | FROM [Search].[tbl_DisabledFiles] -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitChangeEventData.sql: -------------------------------------------------------------------------------- 1 | SELECT [Id] 2 | ,[IndexingUnitId] 3 | ,[ChangeType] 4 | ,[ChangeData] 5 | ,[CurrentStage] 6 | ,[State] 7 | ,[AttemptCount] 8 | ,[Prerequisites] 9 | ,[CreatedTimeUTC] 10 | ,[LastModificationTimeUTC] 11 | ,[LeaseId] 12 | FROM [Search].[tbl_IndexingUnitChangeEvent] 13 | -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/IndexingUnitData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[IndexingUnitType] 3 | ,[EntityType] 4 | ,[IndexingUnitId] 5 | ,[TFSEntityAttributes] 6 | ,[ParentUnitId] 7 | ,[Properties] 8 | ,[AssociatedJobId] 9 | ,[CreatedTimeUTC] 10 | ,[IsDeleted] 11 | FROM [Search].[tbl_IndexingUnit] 12 | -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/ItemLevelFailuresData.sql: -------------------------------------------------------------------------------- 1 | IF (OBJECT_ID(N'Search.tbl_ItemLevelFailures') IS NOT NULL) 2 | BEGIN 3 | SELECT [IndexingUnitId] 4 | ,[Id] 5 | ,[Item] 6 | ,[AttemptCount] 7 | ,[Stage] 8 | ,[Reason] 9 | ,[Metadata] 10 | FROM [Search].[tbl_ItemLevelFailures] 11 | END -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/JobYieldData.sql: -------------------------------------------------------------------------------- 1 | SELECT [TFSEntityId] 2 | ,[EntityType] 3 | ,[BatchId] 4 | ,[Content] 5 | FROM [Search].[tbl_JobYield] -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/ResourceLockData.sql: -------------------------------------------------------------------------------- 1 | SELECT [ResourceName] 2 | ,[LockMode] 3 | ,[LockOwner] 4 | ,[LeaseId] 5 | FROM [Search].[tbl_ResourceLockTable] -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/CollectionDBDiagnosticScripts/SearchRegistryDataOfCollection.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings from Collection DB. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' 9 | -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobHistoryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job history data. 3 | */ 4 | 5 | Declare @Days int = $(DaysAgo); 6 | 7 | SELECT [JobSource] 8 | ,[JobId] 9 | ,[QueueTime] 10 | ,[StartTime] 11 | ,[EndTime] 12 | ,[Result] 13 | ,[ResultMessage] 14 | FROM tbl_JobHistory 15 | where QueueTime > DATEADD(DAY, -@Days, GETUTCDATE()) and 16 | (JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 17 | or ResultMessage like '%completed with status%' 18 | or ResultMessage like '%back to Pending state with requeueDelay%' 19 | or ResultMessage like '%Installed extension%') 20 | order by StartTime desc 21 | -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobQueueData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job queue status for the Account Fault-In jobs that trigger indexing. 3 | */ 4 | 5 | SELECT QueueTime, JobSource, JobId, JobState 6 | FROM tbl_JobQueue 7 | where JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' or JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' or JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 8 | -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/JobThrottlingData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the job throttling settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | (ChildItem = 'JobQueueControllerCpuHealthJobThrottleCount\' or ChildItem = 'JobQueueControllerCpuHealthThreshold\') -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchConnectionUrlData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the configured Search (Elasticsearch) connection URL string. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ChildItem like '%SearchPlatformConnectionString%' -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/SearchRegistryData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Search related registry settings. 3 | */ 4 | 5 | SELECT ParentPath, ChildItem, RegValue 6 | FROM tbl_RegistryItems 7 | where PartitionId > 0 and 8 | ParentPath like '%Search%' -------------------------------------------------------------------------------- /TFS_2018Update3/SearchDiagonistics/ConfigurationDBDiagnosticScripts/ServiceHostData.sql: -------------------------------------------------------------------------------- 1 | /* 2 | This script gets the Service Host table data. 3 | */ 4 | 5 | SELECT [HostId] 6 | ,[ParentHostId] 7 | ,[Name] 8 | ,[Status] 9 | ,[HostType] 10 | ,[ServiceLevel] 11 | FROM tbl_ServiceHost 12 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/CleanUpCollectionIndexingState_IndexDelete.sql: -------------------------------------------------------------------------------- 1 | /** 2 | This script cleans up all the tables which has the state of indexing for all the indexing units of the Collection. 3 | **/ 4 | DELETE FROM [Search].[tbl_IndexingUnit] WHERE PartitionId > 0 5 | DELETE FROM [Search].[tbl_IndexingUnitChangeEvent] WHERE PartitionId > 0 6 | DELETE FROM [Search].[tbl_JobYield] WHERE PartitionId > 0 7 | DELETE FROM [Search].[tbl_TreeStore] WHERE PartitionId > 0 8 | DELETE FROM [Search].[tbl_ResourceLockTable] WHERE PartitionId > 0 9 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/CodeAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/CodeBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for BulkIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%BeginBulkIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') 14 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/CodeContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ( ResultMessage like '%Git_Repository%Branches for ContinuousIndexing = (refs/heads%' or ResultMessage like '%Tfvc_Repository%%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: Code%') -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/CodeFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: Code%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/CountCodeIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: Code%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: Code%') 15 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/CountWorkItemIndexingCompleted.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as IndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and (ResultMessage like '%BeginBulkIndex-AccountFaultIn%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | or ResultMessage like '%BeginBulkIndex-ReindexCollection%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%') 15 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/PauseWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will disable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '0') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '0') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/QueueCodeExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the AccountFault In Job in case of fresh indexing for the given collection id. 2 | * Update the Collection id in the variable under the comment **UPDATE** 3 | * DATABASE : CONFIGURATION DB 4 | **/ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @jobList dbo.typ_JobQueueUpdateTable 8 | 9 | -- ID of the Account Fault In job to be queued. 10 | DECLARE @JobID uniqueIdentifier = '02F271F3-0D40-4FA0-9328-C77EBCA59B6F' 11 | Insert into @jobList values (@JobID, 10); 12 | Declare @priorityLevel int; 13 | SET @priorityLevel = 10 14 | Declare @delaySeconds int; 15 | SET @delaySeconds = 0; 16 | DECLARE @queueAsDormant bit; 17 | SET @queueAsDormant = 0; 18 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/QueuePeriodicMaintenanceJob.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue Periodic Maintenance Job for the given collection id. 2 | -- The script needs to be executed on the Configuration DB. 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | -- ID of Periodic Maintenance job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '1761D61B-4708-42A2-9E29-A39540141277' 9 | 10 | Declare @jobList dbo.typ_JobQueueUpdateTable 11 | Insert into @jobList values (@JobID, 10); 12 | 13 | Declare @priorityLevel int; 14 | SET @priorityLevel = 10 15 | 16 | Declare @delaySeconds int; 17 | SET @delaySeconds = 0; 18 | 19 | DECLARE @queueAsDormant bit; 20 | SET @queueAsDormant = 0; 21 | 22 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/QueueWikiExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the Wiki AccountFault In Job in case of fresh indexing for the given collection id. 2 | * DATABASE : CONFIGURATION DB 3 | **/ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @jobList dbo.typ_JobQueueUpdateTable 7 | 8 | -- ID of the Account Fault In job to be queued. 9 | DECLARE @JobID uniqueIdentifier = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 10 | Insert into @jobList values (@JobID, 10); 11 | Declare @priorityLevel int; 12 | SET @priorityLevel = 10 13 | Declare @delaySeconds int; 14 | SET @delaySeconds = 0; 15 | DECLARE @queueAsDormant bit; 16 | SET @queueAsDormant = 0; 17 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/QueueWorkItemExtensionInstallIndexing.sql: -------------------------------------------------------------------------------- 1 | /** This sql script is used to queue the WorkItem AccountFault In Job in case of fresh indexing of the WorkItems for the given collection id. 2 | **/ 3 | 4 | Declare @CollectionId uniqueidentifier = $(CollectionID); 5 | Declare @jobList dbo.typ_JobQueueUpdateTable 6 | 7 | -- ID of the WorkItem Account Fault In job to be queued. 8 | DECLARE @JobID uniqueIdentifier = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | Insert into @jobList values (@JobID, 10); 10 | Declare @priorityLevel int; 11 | SET @priorityLevel = 10 12 | Declare @delaySeconds int; 13 | SET @delaySeconds = 0; 14 | DECLARE @queueAsDormant bit; 15 | SET @queueAsDormant = 0; 16 | exec [dbo].[prc_QueueJobs] @CollectionId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/ResumeWikiIndexing.sql: -------------------------------------------------------------------------------- 1 | --This script will enable wiki indexing for Search. 2 | 3 | DECLARE @features dbo.typ_KeyValuePairStringTableNullable 4 | 5 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.Indexing\AvailabilityState\', '1') 6 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features 7 | INSERT INTO @features values('#\FeatureAvailability\Entries\Search.Server.Wiki.ContinuousIndexing\AvailabilityState\', '1') 8 | EXEC prc_UpdateRegistry @partitionId=1, @identityName = '00000000-0000-0000-0000-000000000000', @registryUpdates = @features -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WikiAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the WikiAccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory WITH (NOLOCK) 8 | WHERE JobId = '27B11FD5-1DA5-48B4-A732-761CE99F5A5F' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WikiFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing operations failed in the given date range. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | Declare @Days int = $(DaysAgo); 7 | 8 | SELECT Count(Id) AS FailedIndexingCount 9 | FROM Search.tbl_IndexingUnitChangeEvent AS IUCE join 10 | Search.tbl_IndexingUnit as IU ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 11 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State = 'Failed' 12 | AND IU.IndexingUnitType = 'Git_Repository' 13 | AND IU.EntityType = 'Wiki' 14 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) 15 | AND IUCE.CreatedTimeUTC > DATEADD(DAY, -@Days, GETUTCDATE()) -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WikiIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id 2 | /* 3 | This script gets the number of repositories for which the indexing of a wiki git repository is in Progress. 4 | */ 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | 7 | SELECT Count(DISTINCT(TfsEntityId)) AS IndexingInProgressCount 8 | FROM Search.tbl_IndexingUnit AS IU join 9 | Search.tbl_IndexingUnitChangeEvent as IUCE ON IU.IndexingUnitId = IUCE.IndexingUnitId and IU.PartitionId = IUCE.PartitionId 10 | where IUCE.ChangeType = 'BeginBulkIndex' AND IUCE.State in ('InProgress', 'Pending', 'Queued', 'FailedAndRetry') 11 | AND IU.IndexingUnitType = 'Git_Repository' 12 | AND IU.EntityType = 'Wiki' 13 | AND IU.PartitionId = (Select PartitionId from dbo.tbl_DatabasePartitionMap where ServiceHostId = @CollectionId) -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WorkItemAccountFaultInResult.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Gets the result of the AccountFaultIn Job for the collection 3 | */ 4 | 5 | Declare @CollectionId uniqueidentifier = $(CollectionID); 6 | SELECT Top 1 Result, ResultMessage 7 | FROM tbl_JobHistory 8 | WHERE JobId = '03CEE4B8-ECC1-4E57-95CE-FA430FE0DBFB' 9 | AND JobSource = @CollectionId 10 | ORDER BY StartTime DESC 11 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WorkItemBulkIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) has already completed. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as BulkIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WorkItemBulkIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of repositories for which the Fresh Indexing(new repository) is in Progress. 4 | */ 5 | SELECT Count(TfsEntityId) as BulkIndexingInProgressCount 6 | FROM Search.tbl_IndexingUnit as IU join 7 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 8 | where IUCE.ChangeData like '%WorkItemBulkIndexEventData%' and IUCE.State in ('InProgress', 'Pending', 'Queued') 9 | and IU.IndexingUnitType in ('Project') 10 | and IU.EntityType = 'WorkItem' 11 | and IU.PartitionId > 0 12 | and IUCE.PartitionId > 0 13 | 14 | 15 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WorkItemContinuousIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(JobId) as ContinuousIndexingCompletedCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%UpdateIndex%Completed pipeline execution for IndexingUnit%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WorkItemContinuousIndexingInProgressActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Continuous Indexing jobs completed in the given date range. 4 | */ 5 | 6 | SELECT Count(TfsEntityId) as ContinuousIndexingInProgressCount 7 | FROM Search.tbl_IndexingUnit as IU join 8 | Search.tbl_IndexingUnitChangeEvent as IUCE on IU.IndexingUnitId = IUCE.IndexingUnitId 9 | where IUCE.ChangeType = 'UpdateIndex' and IUCE.State in ('InProgress', 'Pending', 'Queued') 10 | and IU.IndexingUnitType = 'Project' 11 | and IU.EntityType = 'WorkItem' 12 | and IU.PartitionId > 0 13 | and IUCE.PartitionId > 0 14 | -------------------------------------------------------------------------------- /TFS_2018Update3/SqlScripts/WorkItemFailedIndexingActivity.sql: -------------------------------------------------------------------------------- 1 | --**UPDATE** Please enter the Collection id and Days 2 | /* 3 | This script gets the number of Indexing jobs failed in the given date range. 4 | */ 5 | 6 | Declare @CollectionId uniqueidentifier = $(CollectionID); 7 | Declare @Days int = $(DaysAgo); 8 | 9 | Select Count(Distinct(JobId)) as FailedIndexingCount from tbl_JobHistory 10 | where 11 | JobSource = @CollectionId 12 | and EndTime > DATEADD(DAY, -@Days, GETUTCDATE()) 13 | and ResultMessage like '%events%completed with status Failed.%EntityType: WorkItem%' 14 | -------------------------------------------------------------------------------- /TFS_2018Update3/Troubleshooting/SqlScripts/QueueJob.sql: -------------------------------------------------------------------------------- 1 | DECLARE @HostId UNIQUEIDENTIFIER = $(HostId) 2 | DECLARE @JobId UNIQUEIDENTIFIER = $(JobId) 3 | 4 | DECLARE @jobList dbo.typ_JobQueueUpdateTable 5 | INSERT INTO @jobList VALUES (@JobId, 10) 6 | DECLARE @priorityLevel INT = 10 7 | DECLARE @delaySeconds INT = 0 8 | DECLARE @queueAsDormant BIT = 0 9 | 10 | EXEC dbo.prc_QueueJobs @HostId, @jobList, @priorityLevel, @delaySeconds, @queueAsDormant --------------------------------------------------------------------------------