Пример #1
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));
        }
Пример #2
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));
        }
        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);
        }
Пример #4
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));
        }
Пример #5
0
 internal static TemporalIndexProvider TemporalProvider(PageCache pageCache, FileSystemAbstraction fs, IndexDirectoryStructure.Factory directoryStructure, IndexProvider.Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, bool readOnly)
 {
     return(new TemporalIndexProvider(pageCache, fs, directoryStructure, monitor, recoveryCleanupWorkCollector, readOnly));
 }
Пример #6
0
 internal static NumberIndexProvider NumberProvider(PageCache pageCache, FileSystemAbstraction fs, IndexDirectoryStructure.Factory childDirectoryStructure, IndexProvider.Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, bool readOnly)
 {
     return(new NumberIndexProvider(pageCache, fs, childDirectoryStructure, monitor, recoveryCleanupWorkCollector, readOnly));
 }
Пример #7
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;
 }
Пример #8
0
 public NumberIndexProvider(PageCache pageCache, FileSystemAbstraction fs, IndexDirectoryStructure.Factory directoryStructure, Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, bool readOnly) : base(NativeProviderDescriptor, directoryStructure, pageCache, fs, monitor, recoveryCleanupWorkCollector, readOnly)
 {
 }