Beispiel #1
0
 public ParallelBatchImporter(DatabaseLayout directoryStructure, FileSystemAbstraction fileSystem, PageCache externalPageCache, Configuration config, LogService logService, ExecutionMonitor executionMonitor, AdditionalInitialIds additionalInitialIds, Config dbConfig, RecordFormats recordFormats, ImportLogic.Monitor monitor, JobScheduler jobScheduler)
 {
     this._externalPageCache    = externalPageCache;
     this._directoryStructure   = directoryStructure;
     this._fileSystem           = fileSystem;
     this._config               = config;
     this._logService           = logService;
     this._dbConfig             = dbConfig;
     this._recordFormats        = recordFormats;
     this._executionMonitor     = executionMonitor;
     this._additionalInitialIds = additionalInitialIds;
     this._monitor              = monitor;
     this._jobScheduler         = jobScheduler;
 }
Beispiel #2
0
 private BatchingNeoStores(FileSystemAbstraction fileSystem, PageCache pageCache, File databaseDirectory, RecordFormats recordFormats, Config neo4jConfig, Configuration importConfiguration, LogService logService, AdditionalInitialIds initialIds, bool externalPageCache, IoTracer ioTracer)
 {
     this._fileSystem              = fileSystem;
     this._recordFormats           = recordFormats;
     this._importConfiguration     = importConfiguration;
     this._initialIds              = initialIds;
     this._logProvider             = logService.InternalLogProvider;
     this._databaseLayout          = DatabaseLayout.of(databaseDirectory);
     this._temporaryDatabaseLayout = DatabaseLayout.of(_databaseLayout.file(TEMP_STORE_NAME), TEMP_STORE_NAME);
     this._neo4jConfig             = neo4jConfig;
     this._pageCache          = pageCache;
     this._ioTracer           = ioTracer;
     this._externalPageCache  = externalPageCache;
     this._idGeneratorFactory = new DefaultIdGeneratorFactory(fileSystem);
 }
Beispiel #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void migrateWithBatchImporter(org.neo4j.io.layout.DatabaseLayout sourceDirectoryStructure, org.neo4j.io.layout.DatabaseLayout migrationDirectoryStructure, long lastTxId, long lastTxChecksum, long lastTxLogVersion, long lastTxLogByteOffset, org.neo4j.kernel.impl.util.monitoring.ProgressReporter progressReporter, org.neo4j.kernel.impl.store.format.RecordFormats oldFormat, org.neo4j.kernel.impl.store.format.RecordFormats newFormat) throws java.io.IOException
        private void MigrateWithBatchImporter(DatabaseLayout sourceDirectoryStructure, DatabaseLayout migrationDirectoryStructure, long lastTxId, long lastTxChecksum, long lastTxLogVersion, long lastTxLogByteOffset, ProgressReporter progressReporter, RecordFormats oldFormat, RecordFormats newFormat)
        {
            PrepareBatchImportMigration(sourceDirectoryStructure, migrationDirectoryStructure, oldFormat, newFormat);

            bool requiresDynamicStoreMigration = !newFormat.Dynamic().Equals(oldFormat.Dynamic());
            bool requiresPropertyMigration     = !newFormat.Property().Equals(oldFormat.Property()) || requiresDynamicStoreMigration;
            File badFile = sourceDirectoryStructure.File([email protected]_Fields.BAD_FILE_NAME);

            using (NeoStores legacyStore = InstantiateLegacyStore(oldFormat, sourceDirectoryStructure), Stream badOutput = new BufferedOutputStream(new FileStream(badFile, false)))
            {
                Configuration        importConfig         = new Configuration_OverriddenAnonymousInnerClass(this, _config, sourceDirectoryStructure);
                AdditionalInitialIds additionalInitialIds = ReadAdditionalIds(lastTxId, lastTxChecksum, lastTxLogVersion, lastTxLogByteOffset);

                // We have to make sure to keep the token ids if we're migrating properties/labels
                BatchImporter   importer          = BatchImporterFactory.withHighestPriority().instantiate(migrationDirectoryStructure, _fileSystem, _pageCache, importConfig, _logService, withDynamicProcessorAssignment(MigrationBatchImporterMonitor(legacyStore, progressReporter, importConfig), importConfig), additionalInitialIds, _config, newFormat, NO_MONITOR, _jobScheduler);
                InputIterable   nodes             = () => LegacyNodesAsInput(legacyStore, requiresPropertyMigration);
                InputIterable   relationships     = () => LegacyRelationshipsAsInput(legacyStore, requiresPropertyMigration);
                long            propertyStoreSize = StoreSize(legacyStore.PropertyStore) / 2 + StoreSize(legacyStore.PropertyStore.StringStore) / 2 + StoreSize(legacyStore.PropertyStore.ArrayStore) / 2;
                Input_Estimates estimates         = knownEstimates(legacyStore.NodeStore.NumberOfIdsInUse, legacyStore.RelationshipStore.NumberOfIdsInUse, legacyStore.PropertyStore.NumberOfIdsInUse, legacyStore.PropertyStore.NumberOfIdsInUse, propertyStoreSize / 2, propertyStoreSize / 2, 0);
                importer.DoImport(Inputs.input(nodes, relationships, IdMappers.actual(), Collectors.badCollector(badOutput, 0), estimates));

                // During migration the batch importer doesn't necessarily writes all entities, depending on
                // which stores needs migration. Node, relationship, relationship group stores are always written
                // anyways and cannot be avoided with the importer, but delete the store files that weren't written
                // (left empty) so that we don't overwrite those in the real store directory later.
                ICollection <DatabaseFile> storesToDeleteFromMigratedDirectory = new List <DatabaseFile>();
                storesToDeleteFromMigratedDirectory.Add(DatabaseFile.METADATA_STORE);
                if (!requiresPropertyMigration)
                {
                    // We didn't migrate properties, so the property stores in the migrated store are just empty/bogus
                    storesToDeleteFromMigratedDirectory.addAll(asList(DatabaseFile.PROPERTY_STORE, DatabaseFile.PROPERTY_STRING_STORE, DatabaseFile.PROPERTY_ARRAY_STORE));
                }
                if (!requiresDynamicStoreMigration)
                {
                    // We didn't migrate labels (dynamic node labels) or any other dynamic store
                    storesToDeleteFromMigratedDirectory.addAll(asList(DatabaseFile.NODE_LABEL_STORE, DatabaseFile.LABEL_TOKEN_STORE, DatabaseFile.LABEL_TOKEN_NAMES_STORE, DatabaseFile.RELATIONSHIP_TYPE_TOKEN_STORE, DatabaseFile.RELATIONSHIP_TYPE_TOKEN_NAMES_STORE, DatabaseFile.PROPERTY_KEY_TOKEN_STORE, DatabaseFile.PROPERTY_KEY_TOKEN_NAMES_STORE, DatabaseFile.SCHEMA_STORE));
                }
                fileOperation(DELETE, _fileSystem, migrationDirectoryStructure, migrationDirectoryStructure, storesToDeleteFromMigratedDirectory, true, null);
            }
        }
 public override BatchImporter Instantiate(DatabaseLayout directoryStructure, FileSystemAbstraction fileSystem, PageCache externalPageCache, Configuration config, LogService logService, ExecutionMonitor executionMonitor, AdditionalInitialIds additionalInitialIds, Config dbConfig, RecordFormats recordFormats, ImportLogic.Monitor monitor, JobScheduler scheduler)
 {
     return(new ParallelBatchImporter(directoryStructure, fileSystem, externalPageCache, config, logService, executionMonitor, additionalInitialIds, dbConfig, recordFormats, monitor, scheduler));
 }
Beispiel #5
0
        public static BatchingNeoStores BatchingNeoStoresWithExternalPageCache(FileSystemAbstraction fileSystem, PageCache pageCache, PageCacheTracer tracer, File storeDir, RecordFormats recordFormats, Configuration config, LogService logService, AdditionalInitialIds initialIds, Config dbConfig)
        {
            Config neo4jConfig = GetNeo4jConfig(config, dbConfig);

            return(new BatchingNeoStores(fileSystem, pageCache, storeDir, recordFormats, neo4jConfig, config, logService, initialIds, true, tracer.bytesWritten));
        }
Beispiel #6
0
//JAVA TO C# CONVERTER NOTE: Members cannot have the same name as their enclosing type:
        public static BatchingNeoStores BatchingNeoStoresConflict(FileSystemAbstraction fileSystem, File storeDir, RecordFormats recordFormats, Configuration config, LogService logService, AdditionalInitialIds initialIds, Config dbConfig, JobScheduler jobScheduler)
        {
            Config neo4jConfig = GetNeo4jConfig(config, dbConfig);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.io.pagecache.tracing.PageCacheTracer tracer = new org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer();
            PageCacheTracer tracer    = new DefaultPageCacheTracer();
            PageCache       pageCache = CreatePageCache(fileSystem, neo4jConfig, logService.InternalLogProvider, tracer, DefaultPageCursorTracerSupplier.INSTANCE, EmptyVersionContextSupplier.EMPTY, jobScheduler);

            return(new BatchingNeoStores(fileSystem, pageCache, storeDir, recordFormats, neo4jConfig, config, logService, initialIds, false, tracer.bytesWritten));
        }
Beispiel #7
0
 public abstract BatchImporter Instantiate(DatabaseLayout directoryStructure, FileSystemAbstraction fileSystem, PageCache externalPageCache, Configuration config, LogService logService, ExecutionMonitor executionMonitor, AdditionalInitialIds additionalInitialIds, Config dbConfig, RecordFormats recordFormats, ImportLogic.Monitor monitor, JobScheduler jobScheduler);