Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void moveMigratedFiles(org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.io.layout.DatabaseLayout directoryLayout, String versionToUpgradeFrom, String versionToMigrateTo) throws java.io.IOException
        public override void MoveMigratedFiles(DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, string versionToUpgradeFrom, string versionToMigrateTo)
        {
            if (_deleteObsoleteIndexes)
            {
                DeleteIndexes(_schemaIndexDirectory);
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static java.io.File createNeoStoreFile(org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException
        private static File CreateNeoStoreFile(FileSystemAbstraction fileSystem, DatabaseLayout databaseLayout)
        {
            File neoStoreFile = databaseLayout.MetadataStore();

            fileSystem.Create(neoStoreFile).close();
            return(neoStoreFile);
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.util.Optional<long> getLatestTransactionLogIndex(long startTxId, org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException
        private long?GetLatestTransactionLogIndex(long startTxId, DatabaseLayout databaseLayout)
        {
            if (!HasTxLogs(databaseLayout))
            {
                return(null);
            }

            // this is not really a read-only store, because it will create an empty transaction log if there is none
            ReadOnlyTransactionStore txStore = new ReadOnlyTransactionStore(_pageCache, _fs, databaseLayout, _config, new Monitors());

            long lastTxId = BASE_TX_ID;

            try
            {
                using (Lifespan ignored = new Lifespan(txStore), TransactionCursor cursor = txStore.GetTransactions(startTxId))
                {
                    while (cursor.next())
                    {
                        CommittedTransactionRepresentation tx = cursor.get();
                        lastTxId = tx.CommitEntry.TxId;
                    }

                    return(lastTxId);
                }
            }
            catch (NoSuchTransactionException)
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void prepareNeoStoreFile(org.neo4j.io.fs.FileSystemAbstraction fileSystem, org.neo4j.io.layout.DatabaseLayout databaseLayout, String storeVersion, org.neo4j.io.pagecache.PageCache pageCache) throws java.io.IOException
        private static void PrepareNeoStoreFile(FileSystemAbstraction fileSystem, DatabaseLayout databaseLayout, string storeVersion, PageCache pageCache)
        {
            File neoStoreFile = CreateNeoStoreFile(fileSystem, databaseLayout);
            long value        = MetaDataStore.versionStringToLong(storeVersion);

            MetaDataStore.setRecord(pageCache, neoStoreFile, STORE_VERSION, value);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSetLastPulledTransactionId() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSetLastPulledTransactionId()
        {
            // given
            long    lastFlushedTxId           = 12;
            StoreId wantedStoreId             = new StoreId(1, 2, 3, 4);
            AdvertisedSocketAddress localhost = new AdvertisedSocketAddress("127.0.0.1", 1234);
            CatchupAddressProvider  catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(localhost);

            StoreCopyClient storeCopyClient = mock(typeof(StoreCopyClient));

            when(storeCopyClient.CopyStoreFiles(eq(catchupAddressProvider), eq(wantedStoreId), any(typeof(StoreFileStreamProvider)), any(), any())).thenReturn(lastFlushedTxId);

            TxPullClient txPullClient = mock(typeof(TxPullClient));

            when(txPullClient.PullTransactions(eq(localhost), eq(wantedStoreId), anyLong(), any())).thenReturn(new TxPullRequestResult(SUCCESS_END_OF_STREAM, 13));

            TransactionLogCatchUpWriter writer = mock(typeof(TransactionLogCatchUpWriter));

            RemoteStore remoteStore = new RemoteStore(NullLogProvider.Instance, mock(typeof(FileSystemAbstraction)), null, storeCopyClient, txPullClient, Factory(writer), Config.defaults(), new Monitors());

            // when
            remoteStore.Copy(catchupAddressProvider, wantedStoreId, DatabaseLayout.of(new File("destination")), true);

            // then
            long previousTxId = lastFlushedTxId - 1;               // the interface is defined as asking for the one preceding

            verify(txPullClient).pullTransactions(eq(localhost), eq(wantedStoreId), eq(previousTxId), any());
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void recoveryForRelationshipCommandsOnly() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RecoveryForRelationshipCommandsOnly()
        {
            // shutdown db here
            DatabaseLayout databaseLayout = Db.databaseLayout();

            ShutdownDB();

            using (Transaction tx = Db.beginTx())
            {
                Index <Relationship> index = Db.index().forRelationships("myIndex");
                Node         node          = Db.createNode();
                Relationship relationship  = Db.createNode().createRelationshipTo(node, RelationshipType.withName("KNOWS"));

                index.Add(relationship, "key", "value");
                tx.Success();
            }

            Db.shutdown();

            Config           config     = Config.defaults();
            IndexConfigStore indexStore = new IndexConfigStore(databaseLayout, FileSystemRule.get());
            LuceneDataSource ds         = new LuceneDataSource(databaseLayout, config, indexStore, FileSystemRule.get(), OperationalMode.single);

            ds.Start();
            ds.Stop();
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleMultipleIdSpaces() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldHandleMultipleIdSpaces()
        {
            // GIVEN
            string           indexName      = "name";
            string           key            = "key";
            DatabaseLayout   databaseLayout = _testDirectory.databaseLayout();
            IndexConfigStore configStore    = new IndexConfigStore(databaseLayout, _fs);

            configStore.Set(typeof(Node), indexName, EXACT_CONFIG);
            using (Lifespan lifespan = new Lifespan())
            {
                Config           dataSourceConfig   = Config.defaults(LuceneDataSource.Configuration.Ephemeral, Settings.TRUE);
                LuceneDataSource originalDataSource = new LuceneDataSource(databaseLayout, dataSourceConfig, configStore, _fs, OperationalMode.single);
                LuceneDataSource dataSource         = lifespan.Add(spy(originalDataSource));

                using (LuceneCommandApplier applier = new LuceneCommandApplier(dataSource, false))
                {
                    // WHEN issuing a command where the index name is mapped to a certain id
                    IndexDefineCommand definitions = definitions(ObjectIntHashMap.newWithKeysValues(indexName, 0), ObjectIntHashMap.newWithKeysValues(key, 0));
                    applier.VisitIndexDefineCommand(definitions);
                    applier.VisitIndexAddNodeCommand(AddNodeToIndex(definitions, indexName, 0L));
                    // and then later issuing a command for that same index, but in another transaction where
                    // the local index name id is a different one
                    definitions = definitions(ObjectIntHashMap.newWithKeysValues(indexName, 1), ObjectIntHashMap.newWithKeysValues(key, 0));
                    applier.VisitIndexDefineCommand(definitions);
                    applier.VisitIndexAddNodeCommand(AddNodeToIndex(definitions, indexName, 1L));
                }

                // THEN both those updates should have been directed to the same index
                verify(dataSource, times(1)).getIndexSearcher(any(typeof(IndexIdentifier)));
            }
        }
Ejemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseDownTxLogWriterIfTxStreamingFails() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCloseDownTxLogWriterIfTxStreamingFails()
        {
            // given
            StoreId                     storeId                = new StoreId(1, 2, 3, 4);
            StoreCopyClient             storeCopyClient        = mock(typeof(StoreCopyClient));
            TxPullClient                txPullClient           = mock(typeof(TxPullClient));
            TransactionLogCatchUpWriter writer                 = mock(typeof(TransactionLogCatchUpWriter));
            CatchupAddressProvider      catchupAddressProvider = CatchupAddressProvider.fromSingleAddress(null);

            RemoteStore remoteStore = new RemoteStore(NullLogProvider.Instance, mock(typeof(FileSystemAbstraction)), null, storeCopyClient, txPullClient, Factory(writer), Config.defaults(), new Monitors());

            doThrow(typeof(CatchUpClientException)).when(txPullClient).pullTransactions(Null, eq(storeId), anyLong(), any());

            // when
            try
            {
                remoteStore.Copy(catchupAddressProvider, storeId, DatabaseLayout.of(new File(".")), true);
            }
            catch (StoreCopyFailedException)
            {
                // expected
            }

            // then
            verify(writer).close();
        }
Ejemplo n.º 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGenerateTransactionInformationWhenLogsAreEmpty() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGenerateTransactionInformationWhenLogsAreEmpty()
        {
            // given
            long           txId           = 1;
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           neoStore       = databaseLayout.MetadataStore();

            neoStore.createNewFile();
            Config     config     = mock(typeof(Config));
            LogService logService = new SimpleLogService(NullLogProvider.Instance, NullLogProvider.Instance);

            // when
            // ... transaction info not in neo store
            assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_ID));
            assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_CHECKSUM));
            assertEquals(FIELD_NOT_PRESENT, getRecord(_pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP));
            // ... and with migrator
            StoreMigrator migrator = new StoreMigrator(_fileSystemRule.get(), _pageCache, config, logService, _jobScheduler);
            TransactionId actual   = migrator.ExtractTransactionIdInformation(neoStore, txId);

            // then
            assertEquals(txId, actual.TransactionIdConflict());
            assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_CHECKSUM, actual.Checksum());
            assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_COMMIT_TIMESTAMP, actual.CommitTimestamp());
        }
Ejemplo n.º 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            _databaseLayout = _testDirectory.databaseLayout();
            _storeDir       = _databaseLayout.databaseDirectory();
            _fileSystem     = _fileSystemRule.get();
            (new TestGraphDatabaseFactory()).setFileSystem(_fileSystem).newImpermanentDatabase(_storeDir).shutdown();
        }
Ejemplo n.º 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void extractTransactionInformationFromLogsInCustomAbsoluteLocation() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ExtractTransactionInformationFromLogsInCustomAbsoluteLocation()
        {
            DatabaseLayout databaseLayout    = _directory.databaseLayout();
            File           customLogLocation = databaseLayout.File("customLogLocation");

            ExtractTransactionalInformationFromLogs(customLogLocation.AbsolutePath, customLogLocation, databaseLayout, _directory.databaseDir());
        }
Ejemplo n.º 12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExtractTransactionInformationFromMetaDataStore() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldExtractTransactionInformationFromMetaDataStore()
        {
            // given
            // ... variables
            long          txId      = 42;
            long          checksum  = 123456789123456789L;
            long          timestamp = 919191919191919191L;
            TransactionId expected  = new TransactionId(txId, checksum, timestamp);

            // ... and files
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           neoStore       = databaseLayout.MetadataStore();

            neoStore.createNewFile();

            // ... and mocks
            Config     config     = mock(typeof(Config));
            LogService logService = mock(typeof(LogService));

            // when
            // ... data in record
            setRecord(_pageCache, neoStore, LAST_TRANSACTION_ID, txId);
            setRecord(_pageCache, neoStore, LAST_TRANSACTION_CHECKSUM, checksum);
            setRecord(_pageCache, neoStore, LAST_TRANSACTION_COMMIT_TIMESTAMP, timestamp);

            // ... and with migrator
            StoreMigrator migrator = new StoreMigrator(_fileSystemRule.get(), _pageCache, config, logService, _jobScheduler);
            TransactionId actual   = migrator.ExtractTransactionIdInformation(neoStore, txId);

            // then
            assertEquals(expected, actual);
        }
Ejemplo n.º 13
0
 public Builder(RecordStorageEngineRule outerInstance, FileSystemAbstraction fs, PageCache pageCache, DatabaseLayout databaseLayout)
 {
     this._outerInstance = outerInstance;
     this.Fs             = fs;
     this.PageCache      = pageCache;
     this.DatabaseLayout = databaseLayout;
 }
Ejemplo n.º 14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void execute() throws java.io.IOException, org.neo4j.commandline.admin.CommandFailed
        public virtual void Execute()
        {
            if (!_fs.fileExists(_fromDatabasePath))
            {
                throw new System.ArgumentException(format("Source directory does not exist [%s]", _fromDatabasePath));
            }

            try
            {
                Validators.CONTAINS_EXISTING_DATABASE.validate(_fromDatabasePath);
            }
            catch (System.ArgumentException)
            {
                throw new System.ArgumentException(format("Source directory is not a database backup [%s]", _fromDatabasePath));
            }

            if (_fs.fileExists(_toDatabaseDir) && !_forceOverwrite)
            {
                throw new System.ArgumentException(format("Database with name [%s] already exists at %s", _toDatabaseName, _toDatabaseDir));
            }

            checkLock(DatabaseLayout.of(_toDatabaseDir).StoreLayout);

            _fs.deleteRecursively(_toDatabaseDir);

            if (!isSameOrChildFile(_toDatabaseDir, _transactionLogsDirectory))
            {
                _fs.deleteRecursively(_transactionLogsDirectory);
            }
            LogFiles backupLogFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_fromDatabasePath, _fs).build();

            RestoreDatabaseFiles(backupLogFiles, _fromDatabasePath.listFiles());
        }
Ejemplo n.º 15
0
        public override Fallible <BackupStageOutcome> PerformFullBackup(DatabaseLayout targetDatabaseLayout, Config config, OptionalHostnamePort userProvidedAddress)
        {
            AdvertisedSocketAddress fromAddress = _addressResolver.resolveCorrectCCAddress(config, userProvidedAddress);

            _log.info("Resolved address for catchup protocol is " + fromAddress);
            StoreId storeId;

            try
            {
                storeId = _backupDelegator.fetchStoreId(fromAddress);
                _log.info("Remote store id is " + storeId);
            }
            catch (StoreIdDownloadFailedException e)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.WrongProtocol, e));
            }

            Optional <StoreId> expectedStoreId = ReadLocalStoreId(targetDatabaseLayout);

            if (expectedStoreId.Present)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Failure, new StoreIdDownloadFailedException(format("Cannot perform a full backup onto preexisting backup. Remote store id was %s but local is %s", storeId, expectedStoreId))));
            }

            try
            {
                _backupDelegator.copy(fromAddress, storeId, targetDatabaseLayout);
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Success, null));
            }
            catch (StoreCopyFailedException e)
            {
                return(new Fallible <BackupStageOutcome>(BackupStageOutcome.Failure, e));
            }
        }
Ejemplo n.º 16
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.nio.channels.FileLock createLockedStoreLockFileIn(java.nio.file.Path databaseDir) throws java.io.IOException
        private FileLock CreateLockedStoreLockFileIn(Path databaseDir)
        {
            Path storeLockFile = Files.createFile(DatabaseLayout.of(databaseDir.toFile()).StoreLayout.storeLockFile().toPath());

            _channel = FileChannel.open(storeLockFile, READ, WRITE);
            return(_channel.@lock(0, long.MaxValue, true));
        }
Ejemplo n.º 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void makeSureBackupCanBePerformed() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MakeSureBackupCanBePerformed()
        {
            // Run backup
            CoreGraphDatabase leader = createSomeData(_cluster);

            ReadReplicaGraphDatabase readReplica = _cluster.findAnyReadReplica().database();

            awaitEx(() => ReadReplicasUpToDateAsTheLeader(leader, readReplica), 1, TimeUnit.MINUTES);

            DbRepresentation beforeChange  = DbRepresentation.of(readReplica);
            string           backupAddress = transactionAddress(readReplica);

            string[] args = backupArguments(backupAddress, _backupPath, "readreplica");

            File configFile = ConfigFileBuilder.builder(ClusterRule.clusterDirectory()).build();

            assertEquals(STATUS_SUCCESS, runBackupToolFromOtherJvmToGetExitCode(ClusterRule.clusterDirectory(), args));

            // Add some new data
            DbRepresentation afterChange = DbRepresentation.of(createSomeData(_cluster));

            // Verify that backed up database can be started and compare representation
            DbRepresentation backupRepresentation = DbRepresentation.of(DatabaseLayout.of(_backupPath, "readreplica").databaseDirectory(), Config);

            assertEquals(beforeChange, backupRepresentation);
            assertNotEquals(backupRepresentation, afterChange);
        }
Ejemplo n.º 18
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static org.neo4j.kernel.impl.transaction.log.files.LogFiles readLogFiles(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException
        internal static LogFiles ReadLogFiles(DatabaseLayout databaseLayout)
        {
            FileSystemAbstraction fileSystemAbstraction = new DefaultFileSystemAbstraction();
            PageCache             pageCache             = ConfigurableStandalonePageCacheFactory.createPageCache(fileSystemAbstraction, new ThreadPoolJobScheduler());

            return(LogFilesBuilder.activeFilesBuilder(databaseLayout, fileSystemAbstraction, pageCache).build());
        }
Ejemplo n.º 19
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void putStoreInDirectory(java.nio.file.Path databaseDirectory) throws java.io.IOException
        private static void PutStoreInDirectory(Path databaseDirectory)
        {
            Files.createDirectories(databaseDirectory);
            Path storeFile = DatabaseLayout.of(databaseDirectory.toFile()).metadataStore().toPath();

            Files.createFile(storeFile);
        }
Ejemplo n.º 20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void cleanup(org.neo4j.io.layout.DatabaseLayout migrationLayout) throws java.io.IOException
        public override void Cleanup(DatabaseLayout migrationLayout)
        {
            if (IndexMigrationDirectoryExists)
            {
                _fileSystem.deleteRecursively(_migrationExplicitIndexesRoot);
            }
        }
Ejemplo n.º 21
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public TemporaryStoreDirectory(org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache, java.io.File parent) throws java.io.IOException
        public TemporaryStoreDirectory(FileSystemAbstraction fs, PageCache pageCache, File parent)
        {
            this._tempStoreDir       = new File(parent, TEMP_COPY_DIRECTORY_NAME);
            this._tempDatabaseLayout = DatabaseLayout.of(_tempStoreDir, GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
            _storeFiles   = new StoreFiles(fs, pageCache, (directory, name) => true);
            _tempLogFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_tempDatabaseLayout.databaseDirectory(), fs).build();
            _storeFiles.delete(_tempStoreDir, _tempLogFiles);
        }
Ejemplo n.º 22
0
        private StoreFactory StoreFactory(Config config, params OpenOption[] openOptions)
        {
            LogProvider    logProvider    = NullLogProvider.Instance;
            DatabaseLayout databaseLayout = _testDirectory.databaseLayout();
            RecordFormats  recordFormats  = selectForStoreOrConfig(config, databaseLayout, _fsRule, _pageCache, logProvider);

            return(new StoreFactory(databaseLayout, config, _idGeneratorFactory, _pageCache, _fsRule.get(), recordFormats, logProvider, EmptyVersionContextSupplier.EMPTY, openOptions));
        }
Ejemplo n.º 23
0
        private StoreFactory GetStoreFactory(DatabaseLayout directoryStructure, string versionToMigrateFrom)
        {
            NullLogProvider    logProvider        = NullLogProvider.Instance;
            RecordFormats      recordFormats      = selectForVersion(versionToMigrateFrom);
            IdGeneratorFactory idGeneratorFactory = new ReadOnlyIdGeneratorFactory(_fileSystem);

            return(new StoreFactory(directoryStructure, _config, idGeneratorFactory, _pageCache, _fileSystem, recordFormats, logProvider, EmptyVersionContextSupplier.EMPTY));
        }
Ejemplo n.º 24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void moveMigratedFiles(org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.io.layout.DatabaseLayout directoryLayout, String versionToMigrateFrom, String versionToMigrateTo) throws java.io.IOException
        public override void MoveMigratedFiles(DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, string versionToMigrateFrom, string versionToMigrateTo)
        {
            if (_explicitIndexMigrated)
            {
                _fileSystem.deleteRecursively(_originalExplicitIndexesRoot);
                _fileSystem.moveToDirectory(_migrationExplicitIndexesRoot, _originalExplicitIndexesRoot.ParentFile);
            }
        }
Ejemplo n.º 25
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private java.io.File createNeoStoreFile() throws java.io.IOException
        private File CreateNeoStoreFile()
        {
            FsRule.get().mkdir(_databaseDirectory.toFile());
            File neoStoreFile = DatabaseLayout.of(_databaseDirectory.toFile()).metadataStore();

            FsRule.get().create(neoStoreFile).close();
            return(neoStoreFile);
        }
Ejemplo n.º 26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static void assertConsistentStore(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
        public static void AssertConsistentStore(DatabaseLayout databaseLayout)
        {
            Config configuration         = Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m");
            AssertableLogProvider logger = new AssertableLogProvider();

            ConsistencyCheckService.Result result = (new ConsistencyCheckService()).runFullConsistencyCheck(databaseLayout, configuration, ProgressMonitorFactory.NONE, NullLogProvider.Instance, false);

            assertTrue("Consistency check for " + databaseLayout + " found inconsistencies:\n\n" + logger.Serialize(), result.Successful);
        }
Ejemplo n.º 27
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void moveMigratedFiles(org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.io.layout.DatabaseLayout directoryLayout, String versionToUpgradeFrom, String versionToMigrateTo) throws java.io.IOException
        public override void MoveMigratedFiles(DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, string versionToUpgradeFrom, string versionToMigrateTo)
        {
            if (_nativeLabelScanStoreMigrated)
            {
                File nativeLabelIndex = migrationLayout.LabelScanStore();
                MoveNativeIndexFile(directoryLayout, nativeLabelIndex);
                DeleteLuceneLabelIndex(GetLuceneStoreDirectory(directoryLayout));
            }
        }
Ejemplo n.º 28
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;
 }
Ejemplo n.º 29
0
        private void DeleteCounts(FileSystemAbstraction snapshot)
        {
            DatabaseLayout databaseLayout = TestDirectory.databaseLayout();
            File           alpha          = databaseLayout.CountStoreA();
            File           beta           = databaseLayout.CountStoreB();

            assertTrue(snapshot.DeleteFile(alpha));
            assertTrue(snapshot.DeleteFile(beta));
        }
Ejemplo n.º 30
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void moveNativeIndexFile(org.neo4j.io.layout.DatabaseLayout storeStructure, java.io.File nativeLabelIndex) throws java.io.IOException
        private void MoveNativeIndexFile(DatabaseLayout storeStructure, File nativeLabelIndex)
        {
            Optional <FileHandle> nativeIndexFileHandle = _fileSystem.streamFilesRecursive(nativeLabelIndex).findFirst();

            if (nativeIndexFileHandle.Present)
            {
                nativeIndexFileHandle.get().rename(storeStructure.LabelScanStore());
            }
        }