public void DeleteIndex(string name)
        {
            IndexDefinitionStorage.RemoveIndex(name);
            IndexStorage.DeleteIndex(name);
            //we may run into a conflict when trying to delete if the index is currently
            //busy indexing documents
            for (var i = 0; i < 10; i++)
            {
                try
                {
                    TransactionalStorage.Batch(action =>
                    {
                        action.Indexing.DeleteIndex(name);

                        workContext.ShouldNotifyAboutWork();
                    });
                    return;
                }
                catch (EsentErrorException e)
                {
                    if (e.Error == JET_err.WriteConflict)
                    {
                        Thread.Sleep(100);
                        continue;
                    }
                    throw;
                }
            }
        }
Exemple #2
0
        public void DeleteIndex(string name)
        {
            name = IndexDefinitionStorage.FixupIndexName(name);
            IndexDefinitionStorage.RemoveIndex(name);
            IndexStorage.DeleteIndex(name);
            //we may run into a conflict when trying to delete if the index is currently
            //busy indexing documents, worst case scenario, we will have an orphaned index
            //row which will get cleaned up on next db restart.
            for (var i = 0; i < 10; i++)
            {
                try
                {
                    TransactionalStorage.Batch(action =>
                    {
                        action.Indexing.DeleteIndex(name);

                        workContext.ShouldNotifyAboutWork();
                    });
                    return;
                }
                catch (ConcurrencyException)
                {
                    Thread.Sleep(100);
                }
            }
        }
Exemple #3
0
        public void DeleteIndex(string name)
        {
            name = IndexDefinitionStorage.FixupIndexName(name);
            IndexDefinitionStorage.RemoveIndex(name);
            IndexStorage.DeleteIndex(name);
            //we may run into a conflict when trying to delete if the index is currently
            //busy indexing documents
            for (var i = 0; i < 10; i++)
            {
                try
                {
                    TransactionalStorage.Batch(action =>
                    {
                        action.Indexing.DeleteIndex(name);

                        workContext.ShouldNotifyAboutWork();
                    });
                    return;
                }
                catch (ConcurrencyException)
                {
                    Thread.Sleep(100);
                }
            }
        }
        public void ResetIndex(string index)
        {
            var indexDefinition = IndexDefinitionStorage.GetIndexDefinition(index);

            if (indexDefinition == null)
            {
                throw new InvalidOperationException("There is no index named: " + index);
            }
            IndexStorage.DeleteIndex(index);
            IndexStorage.CreateIndexImplementation(index, indexDefinition);
            TransactionalStorage.Batch(actions =>
            {
                actions.Indexing.DeleteIndex(index);
                AddIndexAndEnqueueIndexingTasks(actions, index);
            });
        }
Exemple #5
0
        public void ResetIndex(string index)
        {
            index = IndexDefinitionStorage.FixupIndexName(index);
            var indexDefinition = IndexDefinitionStorage.GetIndexDefinition(index);

            if (indexDefinition == null)
            {
                throw new InvalidOperationException("There is no index named: " + index);
            }
            IndexStorage.DeleteIndex(index);
            IndexStorage.CreateIndexImplementation(indexDefinition);
            TransactionalStorage.Batch(actions =>
            {
                actions.Indexing.DeleteIndex(index);
                actions.Indexing.AddIndex(index, indexDefinition.IsMapReduce);
                workContext.ShouldNotifyAboutWork();
            });
        }