Ejemplo n.º 1
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.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void coreShouldStartWithSeedHavingPartialTransactionWriteCrash() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CoreShouldStartWithSeedHavingPartialTransactionWriteCrash()
        {
            // given: a fully synced cluster with some data
            dataMatchesEventually(createEmptyNodes(_cluster, 10), _cluster.coreMembers());

            // when: shutting down a core
            CoreClusterMember core = _cluster.getCoreMemberById(0);

            core.Shutdown();

            // and making sure there will be something new to pull
            CoreClusterMember lastWrites = createEmptyNodes(_cluster, 10);

            // and writing a partial tx
            WritePartialTx(core.DatabaseDirectory());

            // and deleting the cluster state, making sure a snapshot is required during startup
            // effectively a seeding scenario -- representing the use of the unbind command on a crashed store
            _fs.deleteRecursively(core.ClusterStateDirectory());

            // then: we should still be able to start
            core.Start();

            // and become fully synced again
            dataMatchesEventually(lastWrites, singletonList(core));
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void doWorkOnMember(org.neo4j.causalclustering.discovery.ClusterMember member) throws Exception
        public override void DoWorkOnMember(ClusterMember member)
        {
            Optional <File> backupDir = _backupHelper.backup(member);

            if (backupDir.Present)
            {
                _fs.deleteRecursively(backupDir.get());
            }
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void cleanup() throws java.io.IOException
        private void Cleanup()
        {
            File tempStoreDirectory = _temporaryDatabaseLayout.StoreLayout.storeDirectory();

            if (!tempStoreDirectory.ParentFile.Equals(_databaseLayout.databaseDirectory()))
            {
                throw new System.InvalidOperationException("Temporary store is dislocated. It should be located under current database directory but instead located in: " + tempStoreDirectory.Parent);
            }
            _fileSystem.deleteRecursively(tempStoreDirectory);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void deleteIndexes(java.io.File indexRootDirectory) throws java.io.IOException
        private void DeleteIndexes(File indexRootDirectory)
        {
            _fileSystem.deleteRecursively(indexRootDirectory);
        }