Search in sources :

Example 1 with NullLogService

use of org.neo4j.logging.internal.NullLogService in project neo4j by neo4j.

the class StoreUpgraderTest method newUpgrader.

private StoreUpgrader newUpgrader(StoreVersionCheck storeVersionCheck, PageCache pageCache, Config config, MigrationProgressMonitor progressMonitor, PageCacheTracer pageCacheTracer, boolean forceUpgrade) {
    NullLogService instance = NullLogService.getInstance();
    BatchImporterFactory batchImporterFactory = BatchImporterFactory.withHighestPriority();
    RecordStorageMigrator defaultMigrator = new RecordStorageMigrator(fileSystem, pageCache, getTuningConfig(), instance, jobScheduler, pageCacheTracer, batchImporterFactory, INSTANCE);
    StorageEngineFactory storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
    SchemaIndexMigrator indexMigrator = new SchemaIndexMigrator("Indexes", fileSystem, pageCache, IndexProvider.EMPTY.directoryStructure(), storageEngineFactory, true);
    LegacyTransactionLogsLocator logsLocator = new LegacyTransactionLogsLocator(config, databaseLayout);
    DatabaseHealth databaseHealth = new DatabaseHealth(NO_OP, NullLog.getInstance());
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependencies(new Monitors());
    LogsUpgrader logsUpgrader = new LogsUpgrader(fileSystem, storageEngineFactory, databaseLayout, pageCache, logsLocator, config, dependencies, pageCacheTracer, INSTANCE, databaseHealth, forceUpgrade);
    StoreUpgrader upgrader = new StoreUpgrader(storeVersionCheck, progressMonitor, config, fileSystem, NullLogProvider.getInstance(), logsUpgrader, pageCacheTracer);
    upgrader.addParticipant(indexMigrator);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(NOT_PARTICIPATING);
    upgrader.addParticipant(defaultMigrator);
    return upgrader;
}
Also used : DatabaseHealth(org.neo4j.monitoring.DatabaseHealth) StorageEngineFactory(org.neo4j.storageengine.api.StorageEngineFactory) Monitors(org.neo4j.monitoring.Monitors) NullLogService(org.neo4j.logging.internal.NullLogService) BatchImporterFactory(org.neo4j.internal.batchimport.BatchImporterFactory) Dependencies(org.neo4j.collection.Dependencies) SchemaIndexMigrator(org.neo4j.storageengine.migration.SchemaIndexMigrator)

Example 2 with NullLogService

use of org.neo4j.logging.internal.NullLogService in project neo4j by neo4j.

the class FragmentedMessageDeliveryTest method testPermutation.

private void testPermutation(byte[] unfragmented, ByteBuf[] fragments) throws Exception {
    // Given
    channel = new EmbeddedChannel();
    BoltChannel boltChannel = newTestBoltChannel(channel);
    BoltStateMachine machine = mock(BoltStateMachine.class);
    SynchronousBoltConnection boltConnection = new SynchronousBoltConnection(machine);
    NullLogService logging = NullLogService.getInstance();
    var bookmarksParser = mock(BookmarksParser.class);
    var memoryTracker = mock(MemoryTracker.class);
    BoltProtocol boltProtocol = new BoltProtocolV4(boltChannel, (ch, s, messageWriter) -> boltConnection, (v, ch, hints, mem) -> machine, Config.defaults(), bookmarksParser, logging, mock(TransportThrottleGroup.class), mock(ChannelProtector.class), memoryTracker);
    boltProtocol.install();
    // When data arrives split up according to the current permutation
    for (ByteBuf fragment : fragments) {
        channel.writeInbound(fragment.readerIndex(0).retain());
    }
    // Then the session should've received the specified messages, and the protocol should be in a nice clean state
    try {
        RequestMessage run = new RunMessage("Mjölnir", EMPTY_MAP);
        verify(machine).process(eq(run), any(BoltResponseHandler.class));
    } catch (AssertionError e) {
        throw new AssertionError("Failed to handle fragmented delivery.\n" + "Messages: " + Arrays.toString(messages) + "\n" + "Chunk size: " + chunkSize + "\n" + "Serialized data delivered in fragments: " + describeFragments(fragments) + "\n" + "Unfragmented data: " + HexPrinter.hex(unfragmented) + "\n", e);
    }
}
Also used : SynchronousBoltConnection(org.neo4j.bolt.runtime.SynchronousBoltConnection) BoltProtocolV4(org.neo4j.bolt.v4.BoltProtocolV4) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) NullLogService(org.neo4j.logging.internal.NullLogService) BoltResponseHandler(org.neo4j.bolt.runtime.BoltResponseHandler) ByteBuf(io.netty.buffer.ByteBuf) RunMessage(org.neo4j.bolt.v4.messaging.RunMessage) ChannelProtector(org.neo4j.bolt.transport.pipeline.ChannelProtector) BoltProtocol(org.neo4j.bolt.BoltProtocol) BoltStateMachine(org.neo4j.bolt.runtime.statemachine.BoltStateMachine) BoltChannel(org.neo4j.bolt.BoltChannel) BoltTestUtil.newTestBoltChannel(org.neo4j.bolt.testing.BoltTestUtil.newTestBoltChannel) RequestMessage(org.neo4j.bolt.messaging.RequestMessage) TransportThrottleGroup(org.neo4j.bolt.transport.TransportThrottleGroup)

Aggregations

NullLogService (org.neo4j.logging.internal.NullLogService)2 ByteBuf (io.netty.buffer.ByteBuf)1 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)1 BoltChannel (org.neo4j.bolt.BoltChannel)1 BoltProtocol (org.neo4j.bolt.BoltProtocol)1 RequestMessage (org.neo4j.bolt.messaging.RequestMessage)1 BoltResponseHandler (org.neo4j.bolt.runtime.BoltResponseHandler)1 SynchronousBoltConnection (org.neo4j.bolt.runtime.SynchronousBoltConnection)1 BoltStateMachine (org.neo4j.bolt.runtime.statemachine.BoltStateMachine)1 BoltTestUtil.newTestBoltChannel (org.neo4j.bolt.testing.BoltTestUtil.newTestBoltChannel)1 TransportThrottleGroup (org.neo4j.bolt.transport.TransportThrottleGroup)1 ChannelProtector (org.neo4j.bolt.transport.pipeline.ChannelProtector)1 BoltProtocolV4 (org.neo4j.bolt.v4.BoltProtocolV4)1 RunMessage (org.neo4j.bolt.v4.messaging.RunMessage)1 Dependencies (org.neo4j.collection.Dependencies)1 BatchImporterFactory (org.neo4j.internal.batchimport.BatchImporterFactory)1 DatabaseHealth (org.neo4j.monitoring.DatabaseHealth)1 Monitors (org.neo4j.monitoring.Monitors)1 StorageEngineFactory (org.neo4j.storageengine.api.StorageEngineFactory)1 SchemaIndexMigrator (org.neo4j.storageengine.migration.SchemaIndexMigrator)1