예제 #1
0
 public void DropAllIndexingInformation()
 {
     Batch(accessor =>
     {
         var schemaCreator = new SchemaCreator(configuration, tableStorage, Output, Log);
         var storage       = schemaCreator.storage;
         using (var tx = storage.Environment.NewTransaction(TransactionFlags.ReadWrite))
         {
             //deleting index related trees
             storage.Environment.DeleteTree(tx, Tables.IndexingStats.TableName);
             storage.Environment.DeleteTree(tx, Tables.LastIndexedEtags.TableName);
             storage.Environment.DeleteTree(tx, Tables.DocumentReferences.TableName);
             storage.Environment.DeleteTree(tx, storage.DocumentReferences.GetIndexKey(Tables.DocumentReferences.Indices.ByRef));
             storage.Environment.DeleteTree(tx, storage.DocumentReferences.GetIndexKey(Tables.DocumentReferences.Indices.ByView));
             storage.Environment.DeleteTree(tx, storage.DocumentReferences.GetIndexKey(Tables.DocumentReferences.Indices.ByViewAndKey));
             storage.Environment.DeleteTree(tx, storage.DocumentReferences.GetIndexKey(Tables.DocumentReferences.Indices.ByKey));
             storage.Environment.DeleteTree(tx, Tables.Tasks.TableName);
             storage.Environment.DeleteTree(tx, storage.Tasks.GetIndexKey(Tables.Tasks.Indices.ByIndexAndType));
             storage.Environment.DeleteTree(tx, storage.Tasks.GetIndexKey(Tables.Tasks.Indices.ByType));
             storage.Environment.DeleteTree(tx, storage.Tasks.GetIndexKey(Tables.Tasks.Indices.ByIndex));
             storage.Environment.DeleteTree(tx, Tables.ScheduledReductions.TableName);
             storage.Environment.DeleteTree(tx, storage.ScheduledReductions.GetIndexKey(Tables.ScheduledReductions.Indices.ByView));
             storage.Environment.DeleteTree(tx, storage.ScheduledReductions.GetIndexKey(Tables.ScheduledReductions.Indices.ByViewAndLevelAndReduceKey));
             storage.Environment.DeleteTree(tx, Tables.MappedResults.TableName);
             storage.Environment.DeleteTree(tx, storage.MappedResults.GetIndexKey(Tables.MappedResults.Indices.ByView));
             storage.Environment.DeleteTree(tx, storage.MappedResults.GetIndexKey(Tables.MappedResults.Indices.ByViewAndDocumentId));
             storage.Environment.DeleteTree(tx, storage.MappedResults.GetIndexKey(Tables.MappedResults.Indices.ByViewAndReduceKey));
             storage.Environment.DeleteTree(tx, storage.MappedResults.GetIndexKey(Tables.MappedResults.Indices.ByViewAndReduceKeyAndSourceBucket));
             storage.Environment.DeleteTree(tx, storage.MappedResults.GetIndexKey(Tables.MappedResults.Indices.Data));
             storage.Environment.DeleteTree(tx, Tables.ReduceKeyCounts.TableName);
             storage.Environment.DeleteTree(tx, storage.ReduceKeyCounts.GetIndexKey(Tables.ReduceKeyCounts.Indices.ByView));
             storage.Environment.DeleteTree(tx, Tables.ReduceKeyTypes.TableName);
             storage.Environment.DeleteTree(tx, storage.ReduceKeyTypes.GetIndexKey(Tables.ReduceKeyCounts.Indices.ByView));
             storage.Environment.DeleteTree(tx, Tables.ReduceResults.TableName);
             storage.Environment.DeleteTree(tx, storage.ReduceResults.GetIndexKey(Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevel));
             storage.Environment.DeleteTree(tx, storage.ReduceResults.GetIndexKey(Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevelAndSourceBucket));
             storage.Environment.DeleteTree(tx, storage.ReduceResults.GetIndexKey(Tables.ReduceResults.Indices.ByViewAndReduceKeyAndLevelAndBucket));
             storage.Environment.DeleteTree(tx, storage.ReduceResults.GetIndexKey(Tables.ReduceResults.Indices.ByView));
             storage.Environment.DeleteTree(tx, storage.ReduceResults.GetIndexKey(Tables.ReduceResults.Indices.Data));
             storage.Environment.DeleteTree(tx, Tables.ReduceStats.TableName);
             storage.Environment.DeleteTree(tx, Tables.IndexingMetadata.TableName);
             //creating the new empty indexes trees
             SchemaCreator.CreateIndexingStatsSchema(tx, storage);
             SchemaCreator.CreateLastIndexedEtagsSchema(tx, storage);
             SchemaCreator.CreateDocumentReferencesSchema(tx, storage);
             SchemaCreator.CreateTasksSchema(tx, storage);
             SchemaCreator.CreateScheduledReductionsSchema(tx, storage);
             SchemaCreator.CreateMappedResultsSchema(tx, storage);
             SchemaCreator.CreateReduceKeyCountsSchema(tx, storage);
             SchemaCreator.CreateReduceKeyTypesSchema(tx, storage);
             SchemaCreator.CreateReduceResultsSchema(tx, storage);
             SchemaCreator.CreateReduceStatsSchema(tx, storage);
             SchemaCreator.CreateIndexingMetadataSchema(tx, storage);
             tx.Commit();
         }
         accessor.Lists.RemoveAllOlderThan("Raven/Indexes/QueryTime", DateTime.MinValue);
         accessor.Lists.RemoveAllOlderThan("Raven/Indexes/PendingDeletion", DateTime.MinValue);
     });
 }