Reindex site on ApplicationStarted leads to corrupt indexes
We are attempting to deploy umbraco 7.1.x websites with a full file/DB copy. After this full copy is completed successfully, we want to do the following:
Regenerate the XML Cache (umbraco.config) file
reindex examine
This is proving very problematic.
In ApplicationStarted, I put the following code:
var cs = ApplicationContext.Current.Services.ContentService;
cs.RePublishAll();
var deployingFlag = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/deploying.txt");
if (File.Exists(deployingFlag))
{
File.Delete(deployingFlag);
LogHelper.Info<ReindexOnStartHandlers>(string.Format("Preparing to Reindexing on ApplicationStart"));
foreach (var index in _indexes)
{
LogHelper.Info<ReindexOnStartHandlers>(string.Format("Reindexing {0} on ApplicationStart", index));
var indexer = ExamineManager.Instance.IndexProviderCollection[index] as LuceneIndexer;
indexer.RebuildIndex();
}
}
else
{
LogHelper.Info<ReindexOnStartHandlers>(string.Format("Skipping Reindexing on ApplicationStart because deployingFlag was not set"));
}
When the website boots up, the indexes are corrupted. This particular site has uBlogsy. The uBlogsy Latest Posts feed leverages examine. The Latest Posts is empty after a site deploy, so I can tell the examine indexes failed. If I go into the Examine Dashboard and reindex the site there, my latest posts come back.
I suspect that what is happening is that on ApplicationStarted, I programatically reindex things and then umbraco automatically reindexes things. I think there is some sort of race condition maybe and then things are corrupted.
Anyone ever tried anything like this? Any clues? Thanks!
Aha! I'm pretty confident that some sort of race condition is at fault. I can do the deploy over and over and the indexes are only corrupted some of the time. I'm reasonably confident that our ApplicationStart code and some other umbraco default reindexing are working together to corrupt the indexes.
I pulled out the deployment piece and just kept recycling the app pool to see if I could get the indexes to break and they wont. I'm actually going to redirect my attention to sql server being down. The full site and db copy actually turns off sql server and copies the database files and then turns sql server back on. Logs are telling me that when the index corruption occurs, before the indexing on ApplicationStart, there is an error connecting to sql server.
It appears that the issue has nothing to do with SQL Server turning off. I upgraded the deployment process to actually backup / restore the database. I think it is an issue with umbraco 6.1.6
Reindex site on ApplicationStarted leads to corrupt indexes
We are attempting to deploy umbraco 7.1.x websites with a full file/DB copy. After this full copy is completed successfully, we want to do the following:
This is proving very problematic.
In ApplicationStarted, I put the following code:
When the website boots up, the indexes are corrupted. This particular site has uBlogsy. The uBlogsy Latest Posts feed leverages examine. The Latest Posts is empty after a site deploy, so I can tell the examine indexes failed. If I go into the Examine Dashboard and reindex the site there, my latest posts come back.
I suspect that what is happening is that on ApplicationStarted, I programatically reindex things and then umbraco automatically reindexes things. I think there is some sort of race condition maybe and then things are corrupted.
Anyone ever tried anything like this? Any clues? Thanks!
Aha! I'm pretty confident that some sort of race condition is at fault. I can do the deploy over and over and the indexes are only corrupted some of the time. I'm reasonably confident that our ApplicationStart code and some other umbraco default reindexing are working together to corrupt the indexes.
Does anyone have any insight?
I pulled out the deployment piece and just kept recycling the app pool to see if I could get the indexes to break and they wont. I'm actually going to redirect my attention to sql server being down. The full site and db copy actually turns off sql server and copies the database files and then turns sql server back on. Logs are telling me that when the index corruption occurs, before the indexing on ApplicationStart, there is an error connecting to sql server.
yay external processing!
It appears that the issue has nothing to do with SQL Server turning off. I upgraded the deployment process to actually backup / restore the database. I think it is an issue with umbraco 6.1.6
is working on a reply...