示例#1
0
        public override void Migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressReporter, string versionToMigrateFrom, string versionToMigrateTo)
        {
            RecordFormats from = RecordFormatSelector.selectForVersion(versionToMigrateFrom);
            RecordFormats to   = RecordFormatSelector.selectForVersion(versionToMigrateTo);

            if (!from.HasCompatibleCapabilities(to, CapabilityType.INDEX))
            {
                _schemaIndexDirectory = _indexProvider.directoryStructure().rootDirectory();
                if (_schemaIndexDirectory != null)
                {
                    _deleteObsoleteIndexes = true;
                }
                // else this schema index provider doesn't have any persistent storage to delete.
            }
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotOpenStoreWithNodesOrRelationshipsInIt() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotOpenStoreWithNodesOrRelationshipsInIt()
        {
            // GIVEN
            SomeDataInTheDatabase();

            // WHEN
            try
            {
                using (JobScheduler jobScheduler = new ThreadPoolJobScheduler())
                {
                    RecordFormats recordFormats = RecordFormatSelector.selectForConfig(Config.defaults(), NullLogProvider.Instance);
                    using (BatchingNeoStores store = BatchingNeoStores.BatchingNeoStoresConflict(Storage.fileSystem(), Storage.directory().databaseDir(), recordFormats, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults(), jobScheduler))
                    {
                        store.CreateNew();
                        fail("Should fail on existing data");
                    }
                }
            }
            catch (System.InvalidOperationException e)
            {
                // THEN
                assertThat(e.Message, containsString("already contains"));
            }
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void migrate(org.neo4j.io.layout.DatabaseLayout directoryLayout, org.neo4j.io.layout.DatabaseLayout migrationLayout, org.neo4j.kernel.impl.util.monitoring.ProgressReporter progressMonitor, String versionToMigrateFrom, String versionToMigrateTo) throws java.io.IOException
        public override void Migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressMonitor, string versionToMigrateFrom, string versionToMigrateTo)
        {
            IndexImplementation indexImplementation = _explicitIndexProvider.getProviderByName(LUCENE_EXPLICIT_INDEX_PROVIDER_NAME);

            if (indexImplementation != null)
            {
                RecordFormats from = RecordFormatSelector.selectForVersion(versionToMigrateFrom);
                RecordFormats to   = RecordFormatSelector.selectForVersion(versionToMigrateTo);
                if (!from.HasCompatibleCapabilities(to, CapabilityType.INDEX))
                {
                    _originalExplicitIndexesRoot  = indexImplementation.GetIndexImplementationDirectory(directoryLayout);
                    _migrationExplicitIndexesRoot = indexImplementation.GetIndexImplementationDirectory(migrationLayout);
                    if (IsNotEmptyDirectory(_originalExplicitIndexesRoot))
                    {
                        MigrateExplicitIndexes(progressMonitor);
                        _explicitIndexMigrated = true;
                    }
                }
            }
            else
            {
                _log.debug("Lucene index provider not found, nothing to migrate.");
            }
        }
示例#4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: UnusedLabelTokenStore() throws java.io.IOException
            internal UnusedLabelTokenStore(LabelTokenStoreTest outerInstance) : base(outerInstance.file, outerInstance.idFile, outerInstance.config, outerInstance.generatorFactory, outerInstance.cache, outerInstance.logProvider, outerInstance.dynamicStringStore, RecordFormatSelector.defaultFormat())
            {
                this._outerInstance = outerInstance;
                pagedFile           = mock(typeof(PagedFile));

                when(pagedFile.io(any(typeof(Long)), any(typeof(Integer)))).thenReturn(outerInstance.pageCursor);
                when(pagedFile.pageSize()).thenReturn(1);
                when(outerInstance.pageCursor.Next()).thenReturn(true);
            }
示例#5
0
        public static bool CheckNeoStoreHasDefaultFormatVersion(StoreVersionCheck check, DatabaseLayout databaseLayout)
        {
            File metadataStore = databaseLayout.MetadataStore();

            return(check.HasVersion(metadataStore, RecordFormatSelector.defaultFormat().storeVersion()).Outcome.Successful);
        }
示例#6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord()
        public virtual void ShouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord()
        {
            // given
            PageCache pageCache = PageCacheRule.getPageCache(_fileSystemAbstraction);
            Config    config    = Config.defaults(GraphDatabaseSettings.rebuild_idgenerators_fast, "true");

            DynamicStringStore stringPropertyStore = mock(typeof(DynamicStringStore));

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final PropertyStore store = new PropertyStore(storeFile, idFile, config, new org.neo4j.kernel.impl.core.JumpingIdGeneratorFactory(1), pageCache, org.neo4j.logging.NullLogProvider.getInstance(), stringPropertyStore, mock(PropertyKeyTokenStore.class), mock(DynamicArrayStore.class), org.neo4j.kernel.impl.store.format.RecordFormatSelector.defaultFormat());
            PropertyStore store = new PropertyStore(_storeFile, _idFile, config, new JumpingIdGeneratorFactory(1), pageCache, NullLogProvider.Instance, stringPropertyStore, mock(typeof(PropertyKeyTokenStore)), mock(typeof(DynamicArrayStore)), RecordFormatSelector.defaultFormat());

            store.Initialise(true);

            try
            {
                store.MakeStoreOk();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long propertyRecordId = store.nextId();
                long propertyRecordId = store.NextId();

                PropertyRecord record = new PropertyRecord(propertyRecordId);
                record.InUse = true;

                DynamicRecord dynamicRecord = dynamicRecord();
                PropertyBlock propertyBlock = PropertyBlockWith(dynamicRecord);
                record.PropertyBlock = propertyBlock;

                doAnswer(invocation =>
                {
                    PropertyRecord recordBeforeWrite = store.GetRecord(propertyRecordId, store.NewRecord(), FORCE);
                    assertFalse(recordBeforeWrite.inUse());
                    return(null);
                }).when(stringPropertyStore).updateRecord(dynamicRecord);

                // when
                store.UpdateRecord(record);

                // then verify that our mocked method above, with the assert, was actually called
                verify(stringPropertyStore).updateRecord(dynamicRecord);
            }
            finally
            {
                store.Close();
            }
        }