Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void rebuildReplicatedIdGeneratorsOnRecovery() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RebuildReplicatedIdGeneratorsOnRecovery()
        {
            DefaultFileSystemAbstraction fileSystem = FileSystemRule.get();
            File stickyGenerator      = new File(TestDirectory.databaseDir(), "stickyGenerator");
            File nodeStoreIdGenerator = TestDirectory.databaseLayout().idNodeStore();

            StoreFactory storeFactory = new StoreFactory(TestDirectory.databaseLayout(), Config.defaults(), GetIdGenerationFactory(fileSystem), PageCacheRule.getPageCache(fileSystem), fileSystem, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);

            using (NeoStores neoStores = storeFactory.OpenAllNeoStores(true))
            {
                NodeStore nodeStore = neoStores.NodeStore;
                for (int i = 0; i < 50; i++)
                {
                    NodeRecord nodeRecord = nodeStore.NewRecord();
                    nodeRecord.InUse = true;
                    nodeRecord.Id    = nodeStore.NextId();
                    if (i == 47)
                    {
                        FileUtils.copyFile(nodeStoreIdGenerator, stickyGenerator);
                    }
                    nodeStore.UpdateRecord(nodeRecord);
                }
            }

            FileUtils.copyFile(stickyGenerator, nodeStoreIdGenerator);
            using (NeoStores reopenedStores = storeFactory.OpenAllNeoStores())
            {
                reopenedStores.MakeStoreOk();
                assertEquals(51L, reopenedStores.NodeStore.nextId());
            }
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before()
        public virtual void Before()
        {
            FileSystemAbstraction fs           = this._fs.get();
            StoreFactory          storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(fs), _pageCacheRule.getPageCache(fs), fs, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);

            _neoStores = storeFactory.OpenAllNeoStores(true);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before()
        public virtual void Before()
        {
            StoreFactory storeFactory = new StoreFactory(_testDirectory.databaseLayout(), Config.defaults(), new DefaultIdGeneratorFactory(_fs.get()), PageCacheRule.getPageCache(_fs.get()), _fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);

            _neoStores = storeFactory.OpenAllNeoStores(true);
            _store     = _neoStores.PropertyStore;
            _converter = new PropertyPhysicalToLogicalConverter(_store);
        }
Example #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void lastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped()
        public virtual void LastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.StoreFactory storeFactory = new org.neo4j.kernel.impl.store.StoreFactory(org.neo4j.io.layout.DatabaseLayout.of(new java.io.File("store")), org.neo4j.kernel.configuration.Config.defaults(), new org.neo4j.kernel.impl.store.id.DefaultIdGeneratorFactory(fs.get()), pageCacheRule.getPageCache(fs.get()), fs.get(), org.neo4j.logging.NullLogProvider.getInstance(), org.neo4j.io.pagecache.tracing.cursor.context.EmptyVersionContextSupplier.EMPTY);
            StoreFactory storeFactory = new StoreFactory(DatabaseLayout.of(new File("store")), Config.defaults(), new DefaultIdGeneratorFactory(Fs.get()), PageCacheRule.getPageCache(Fs.get()), Fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.NeoStores neoStores = storeFactory.openAllNeoStores(true);
            NeoStores neoStores = storeFactory.OpenAllNeoStores(true);

            neoStores.Close();

            System.Func <long>   supplier           = () => neoStores.MetaDataStore.LastCommittedTransactionId;
            OnDiskLastTxIdGetter diskLastTxIdGetter = new OnDiskLastTxIdGetter(supplier);

            assertEquals(Org.Neo4j.Kernel.impl.transaction.log.TransactionIdStore_Fields.BASE_TX_ID, diskLastTxIdGetter.LastTxId);
        }
//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 progressReporter, String versionToMigrateFrom, String versionToMigrateTo) throws java.io.IOException
        public override void Migrate(DatabaseLayout directoryLayout, DatabaseLayout migrationLayout, ProgressReporter progressReporter, string versionToMigrateFrom, string versionToMigrateTo)
        {
            if (IsNativeLabelScanStoreMigrationRequired(directoryLayout))
            {
                StoreFactory storeFactory = GetStoreFactory(directoryLayout, versionToMigrateFrom);
                using (NeoStores neoStores = storeFactory.OpenAllNeoStores(), Lifespan lifespan = new Lifespan())
                {
                    neoStores.VerifyStoreOk();
                    // Remove any existing file to ensure we always do migration
                    DeleteNativeIndexFile(migrationLayout);

                    progressReporter.Start(neoStores.NodeStore.NumberOfIdsInUse);
                    NativeLabelScanStore nativeLabelScanStore = GetNativeLabelScanStore(migrationLayout, progressReporter, neoStores);
                    lifespan.Add(nativeLabelScanStore);
                }
                _nativeLabelScanStoreMigrated = true;
            }
        }