From ddd9c8ef7d9be33eaae7aaf4675621f267b0809a Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 14 Dec 2017 19:25:01 +1100 Subject: [PATCH] Do a lock check on the index on startup and unlock it if it is, this is a safety check since we are now using the simplefs dir --- src/Umbraco.Web/ExamineStartup.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/ExamineStartup.cs b/src/Umbraco.Web/ExamineStartup.cs index e149caabb3..0a7cab9522 100644 --- a/src/Umbraco.Web/ExamineStartup.cs +++ b/src/Umbraco.Web/ExamineStartup.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using Examine; using Examine.Config; @@ -94,6 +95,17 @@ namespace Umbraco.Web foreach (var luceneIndexer in ExamineManager.Instance.IndexProviderCollection.OfType()) { luceneIndexer.WaitForIndexQueueOnShutdown = false; + + //we should check if the index is locked ... it shouldn't be! We are using simple fs lock now and we are also ensuring that + //the indexes are not operational unless MainDom is true so if _disableExamineIndexing is false then we should be in charge + if (_disableExamineIndexing == false) + { + var dir = luceneIndexer.GetLuceneDirectory(); + if (IndexWriter.IsLocked(dir)) + { + IndexWriter.Unlock(dir); + } + } } //Ok, now that everything is complete we'll check if we've stored any references to index that need rebuilding and run them