Пример #1
0
        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;
                }
            }
        }
Пример #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);
                }
            }
        }
Пример #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);
                }
            }
        }
Пример #4
0
        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);
            });
        }
Пример #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();
            });
        }