예제 #1
0
 public LuceneIndexProvider(FileSystemAbstraction fileSystem, DirectoryFactory directoryFactory, IndexDirectoryStructure.Factory directoryStructureFactory, Monitor monitor, Config config, OperationalMode operationalMode) : base(LuceneIndexProviderFactory.ProviderDescriptor, directoryStructureFactory)
 {
     this._monitor             = monitor;
     this._indexStorageFactory = BuildIndexStorageFactory(fileSystem, directoryFactory);
     this._fileSystem          = fileSystem;
     this._config          = config;
     this._operationalMode = operationalMode;
 }
        protected internal override IndexProvider CreateIndexProvider(PageCache pageCache, FileSystemAbstraction fs, File graphDbDir)
        {
            IndexProvider.Monitor monitor = IndexProvider.Monitor_Fields.EMPTY;
            Config          config        = Config.defaults(stringMap(default_schema_provider.name(), NATIVE10.providerName()));
            OperationalMode mode          = OperationalMode.single;
            RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = RecoveryCleanupWorkCollector.immediate();

            return(NativeLuceneFusionIndexProviderFactory10.Create(pageCache, graphDbDir, fs, monitor, config, mode, recoveryCleanupWorkCollector));
        }
예제 #3
0
 public LuceneKernelExtension(File databaseDirectory, Config config, System.Func <IndexConfigStore> indexStore, FileSystemAbstraction fileSystemAbstraction, IndexProviders indexProviders, OperationalMode operationalMode)
 {
     this._databaseLayout        = DatabaseLayout.of(databaseDirectory);
     this._config                = config;
     this._indexStore            = indexStore;
     this._fileSystemAbstraction = fileSystemAbstraction;
     this._indexProviders        = indexProviders;
     this._operationalMode       = operationalMode;
 }
        public override Lifecycle NewInstance(KernelContext context, Dependencies dependencies)
        {
            Config config    = dependencies.Config;
            bool   ephemeral = config.Get(GraphDatabaseSettings.ephemeral);
            FileSystemAbstraction fileSystemAbstraction = dependencies.FileSystem();
            DirectoryFactory      directoryFactory      = directoryFactory(ephemeral);
            OperationalMode       operationalMode       = context.DatabaseInfo().OperationalMode;
            JobScheduler          scheduler             = dependencies.Scheduler();

            IndexDirectoryStructure.Factory directoryStructureFactory = SubProviderDirectoryStructure(context.Directory());
            TokenHolders tokenHolders = dependencies.TokenHolders();
            Log          log          = dependencies.LogService.getInternalLog(typeof(FulltextIndexProvider));
            AuxiliaryTransactionStateManager auxiliaryTransactionStateManager;

            try
            {
                auxiliaryTransactionStateManager = dependencies.AuxiliaryTransactionStateManager();
            }
            catch (UnsatisfiedDependencyException e)
            {
                string message = "Fulltext indexes failed to register as transaction state providers. This means that, if queried, they will not be able to " +
                                 "uncommitted transactional changes into account. This is fine if the indexes are opened for non-transactional work, such as for " +
                                 "consistency checking. The reason given is: " + e.Message;
                LogDependencyException(context, log.ErrorLogger(), message);
                auxiliaryTransactionStateManager = new NullAuxiliaryTransactionStateManager();
            }

            FulltextIndexProvider provider = new FulltextIndexProvider(Descriptor, directoryStructureFactory, fileSystemAbstraction, config, tokenHolders, directoryFactory, operationalMode, scheduler, auxiliaryTransactionStateManager, log);

            string procedureRegistrationFailureMessage = "Failed to register the fulltext index procedures. The fulltext index provider will be loaded and " +
                                                         "updated like normal, but it might not be possible to query any fulltext indexes. The reason given is: ";

            try
            {
                dependencies.Procedures().registerComponent(typeof(FulltextAdapter), procContext => provider, true);
                dependencies.Procedures().registerProcedure(typeof(FulltextProcedures));
            }
            catch (KernelException e)
            {
                string message = procedureRegistrationFailureMessage + e.getUserMessage(new NonTransactionalTokenNameLookup(tokenHolders));
                // We use the 'warn' logger in this case, because it can occur due to multi-database shenanigans, or due to internal restarts in HA.
                // These scenarios are less serious, and will _probably_ not prevent FTS from working. Hence we only warn about this.
                LogDependencyException(context, log.WarnLogger(), message);
            }
            catch (UnsatisfiedDependencyException e)
            {
                string message = procedureRegistrationFailureMessage + e.Message;
                LogDependencyException(context, log.ErrorLogger(), message);
            }

            return(provider);
        }
예제 #5
0
        public override IndexProvider NewInstance(KernelContext context, DEPENDENCIES dependencies)
        {
            PageCache             pageCache   = dependencies.PageCache();
            File                  databaseDir = context.Directory();
            FileSystemAbstraction fs          = dependencies.FileSystem();
            Log      log      = dependencies.LogService.InternalLogProvider.getLog(LoggingClass());
            Monitors monitors = dependencies.Monitors();

            monitors.AddMonitorListener(new LoggingMonitor(log), DescriptorString());
            IndexProvider.Monitor monitor   = monitors.NewMonitor(typeof(IndexProvider.Monitor), DescriptorString());
            Config          config          = dependencies.Config;
            OperationalMode operationalMode = context.DatabaseInfo().OperationalMode;
            RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = dependencies.RecoveryCleanupWorkCollector();

            return(InternalCreate(pageCache, databaseDir, fs, monitor, config, operationalMode, recoveryCleanupWorkCollector));
        }
예제 #6
0
        internal static LuceneIndexProvider LuceneProvider(FileSystemAbstraction fs, IndexDirectoryStructure.Factory directoryStructure, IndexProvider.Monitor monitor, Config config, OperationalMode operationalMode)
        {
            bool             ephemeral        = config.Get(GraphDatabaseSettings.ephemeral);
            DirectoryFactory directoryFactory = directoryFactory(ephemeral);

            return(new LuceneIndexProvider(fs, directoryFactory, directoryStructure, monitor, config, operationalMode));
        }
예제 #7
0
 internal static bool IsReadOnly(Config config, OperationalMode operationalMode)
 {
     return(config.Get(GraphDatabaseSettings.read_only) && (OperationalMode.single == operationalMode));
 }
예제 #8
0
 internal ExtendedRecordStorageEngine(DatabaseLayout databaseLayout, Config config, PageCache pageCache, FileSystemAbstraction fs, LogProvider logProvider, LogProvider userLogProvider, TokenHolders tokenHolders, SchemaState schemaState, ConstraintSemantics constraintSemantics, JobScheduler scheduler, TokenNameLookup tokenNameLookup, LockService lockService, IndexProviderMap indexProviderMap, IndexingService.Monitor indexingServiceMonitor, DatabaseHealth databaseHealth, ExplicitIndexProvider explicitIndexProviderLookup, IndexConfigStore indexConfigStore, IdOrderingQueue explicitIndexTransactionOrdering, IdGeneratorFactory idGeneratorFactory, IdController idController, System.Func <BatchTransactionApplierFacade, BatchTransactionApplierFacade> transactionApplierTransformer, Monitors monitors, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, OperationalMode operationalMode) : base(databaseLayout, config, pageCache, fs, logProvider, userLogProvider, tokenHolders, schemaState, constraintSemantics, scheduler, tokenNameLookup, lockService, indexProviderMap, indexingServiceMonitor, databaseHealth, explicitIndexProviderLookup, indexConfigStore, explicitIndexTransactionOrdering, idGeneratorFactory, idController, monitors, recoveryCleanupWorkCollector, operationalMode, EmptyVersionContextSupplier.EMPTY)
 {
     this.TransactionApplierTransformer = transactionApplierTransformer;
 }
예제 #9
0
        public static FusionIndexProvider Create(PageCache pageCache, File databaseDirectory, FileSystemAbstraction fs, IndexProvider.Monitor monitor, Config config, OperationalMode operationalMode, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector)
        {
            IndexDirectoryStructure.Factory childDirectoryStructure = SubProviderDirectoryStructure(databaseDirectory);
            bool readOnly           = IndexProviderFactoryUtil.IsReadOnly(config, operationalMode);
            bool archiveFailedIndex = config.Get(GraphDatabaseSettings.archive_failed_index);

            NumberIndexProvider   number   = IndexProviderFactoryUtil.NumberProvider(pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly);
            SpatialIndexProvider  spatial  = IndexProviderFactoryUtil.SpatialProvider(pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly, config);
            TemporalIndexProvider temporal = IndexProviderFactoryUtil.TemporalProvider(pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly);
            LuceneIndexProvider   lucene   = IndexProviderFactoryUtil.LuceneProvider(fs, childDirectoryStructure, monitor, config, operationalMode);

            return(new FusionIndexProvider(EMPTY, number, spatial, temporal, lucene, new FusionSlotSelector10(), Descriptor, directoriesByProvider(databaseDirectory), fs, archiveFailedIndex));
        }
예제 #10
0
 protected internal override IndexProvider InternalCreate(PageCache pageCache, File storeDir, FileSystemAbstraction fs, IndexProvider.Monitor monitor, Config config, OperationalMode operationalMode, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector)
 {
     return(Create(pageCache, storeDir, fs, monitor, config, operationalMode, recoveryCleanupWorkCollector));
 }
예제 #11
0
        public static GenericNativeIndexProvider Create(PageCache pageCache, File storeDir, FileSystemAbstraction fs, IndexProvider.Monitor monitor, Config config, OperationalMode mode, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector)
        {
            IndexDirectoryStructure.Factory directoryStructure = directoriesByProvider(storeDir);
            bool readOnly = config.Get(GraphDatabaseSettings.read_only) && (OperationalMode.single == mode);

            return(new GenericNativeIndexProvider(directoryStructure, pageCache, fs, monitor, recoveryCleanupWorkCollector, readOnly, config));
        }
예제 #12
0
 /// <summary>
 /// Specify db operational mode </summary>
 /// <param name="operationalMode"> operational mode </param>
 /// <returns> index builder </returns>
 public virtual T WithOperationalMode(OperationalMode operationalMode)
 {
     this._operationalMode = operationalMode;
     return(( T )this);
 }
예제 #13
0
 protected internal abstract IndexProvider InternalCreate(PageCache pageCache, File storeDir, FileSystemAbstraction fs, IndexProvider.Monitor monitor, Config config, OperationalMode operationalMode, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector);