Search in sources :

Example 21 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class IgniteWalReaderTest method testTxRecordsReadWoBinaryMeta.

/**
 * Tests transaction generation and WAL for putAll cache operation.
 *
 * @throws Exception if failed.
 */
@Test
public void testTxRecordsReadWoBinaryMeta() throws Exception {
    Ignite ignite = startGrid("node0");
    ignite.cluster().state(ClusterState.ACTIVE);
    Map<Object, IndexedObject> map = new TreeMap<>();
    for (int i = 0; i < 1000; i++) map.put(i, new IndexedObject(i));
    ignite.cache(CACHE_NAME).putAll(map);
    ignite.cluster().state(ClusterState.INACTIVE);
    String workDir = U.defaultWorkDirectory();
    String subfolderName = genDbSubfolderName(ignite, 0);
    stopAllGrids();
    IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(new NullLogger());
    IteratorParametersBuilder params = createIteratorParametersBuilder(workDir, subfolderName);
    scanIterateAndCount(factory, params.filesOrDirs(workDir), 1000, 1, null, null);
}
Also used : IgniteWalIteratorFactory(org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory) NullLogger(org.apache.ignite.logger.NullLogger) IteratorParametersBuilder(org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder) Ignite(org.apache.ignite.Ignite) BinaryObject(org.apache.ignite.binary.BinaryObject) CacheObject(org.apache.ignite.internal.processors.cache.CacheObject) KeyCacheObject(org.apache.ignite.internal.processors.cache.KeyCacheObject) TreeMap(java.util.TreeMap) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 22 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class StandaloneWalRecordsIteratorTest method testBinaryMetadataWriterStopped.

/**
 * Checks if binary-metadata-writer thread is not hung after standalone iterator is closed.
 *
 * @throws Exception if test failed.
 */
@Test
public void testBinaryMetadataWriterStopped() throws Exception {
    String dir = createWalFiles();
    final IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(new NullLogger());
    IgniteWalIteratorFactory.IteratorParametersBuilder iterParametersBuilder = new IgniteWalIteratorFactory.IteratorParametersBuilder().filesOrDirs(dir).pageSize(4096);
    try (WALIterator stIt = factory.iterator(iterParametersBuilder)) {
    }
    boolean binaryMetadataWriterStopped = GridTestUtils.waitForCondition(new GridAbsPredicate() {

        @Override
        public boolean apply() {
            Set<String> threadNames = Thread.getAllStackTraces().keySet().stream().map(Thread::getName).collect(Collectors.toSet());
            return threadNames.stream().noneMatch(t -> t.startsWith("binary-metadata-writer"));
        }
    }, 10_000L);
    assertTrue(binaryMetadataWriterStopped);
}
Also used : FileWriteAheadLogManager(org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager) WALIterator(org.apache.ignite.internal.pagemem.wal.WALIterator) Arrays(java.util.Arrays) SnapshotRecord(org.apache.ignite.internal.pagemem.wal.record.SnapshotRecord) IgniteBiPredicate(org.apache.ignite.lang.IgniteBiPredicate) RandomAccessFileIO(org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIO) U(org.apache.ignite.internal.util.typedef.internal.U) Random(java.util.Random) IgniteEx(org.apache.ignite.internal.IgniteEx) WALPointer(org.apache.ignite.internal.processors.cache.persistence.wal.WALPointer) FileIO(org.apache.ignite.internal.processors.cache.persistence.file.FileIO) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) NullLogger(org.apache.ignite.logger.NullLogger) GridAbsPredicate(org.apache.ignite.internal.util.lang.GridAbsPredicate) DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) RolloverType(org.apache.ignite.internal.pagemem.wal.record.RolloverType) RandomAccessFileIOFactory(org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) OpenOption(java.nio.file.OpenOption) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) WALRecord(org.apache.ignite.internal.pagemem.wal.record.WALRecord) StandardOpenOption(java.nio.file.StandardOpenOption) Set(java.util.Set) IOException(java.io.IOException) Test(org.junit.Test) Ignite(org.apache.ignite.Ignite) Collectors(java.util.stream.Collectors) File(java.io.File) IgniteBiTuple(org.apache.ignite.lang.IgniteBiTuple) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) IgniteCacheDatabaseSharedManager(org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) IteratorParametersBuilder(org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder) IgniteWriteAheadLogManager(org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager) Collections(java.util.Collections) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) FileDescriptor(org.apache.ignite.internal.processors.cache.persistence.wal.FileDescriptor) NullLogger(org.apache.ignite.logger.NullLogger) Set(java.util.Set) WALIterator(org.apache.ignite.internal.pagemem.wal.WALIterator) GridAbsPredicate(org.apache.ignite.internal.util.lang.GridAbsPredicate) IteratorParametersBuilder(org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder) IteratorParametersBuilder(org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 23 with NullLogger

use of org.apache.ignite.logger.NullLogger in project ignite by apache.

the class CleanupRestoredCachesSlowTest method testLongOperationAsyncExecutor.

/**
 * @throws Throwable if failed.
 */
@Test
public void testLongOperationAsyncExecutor() throws Throwable {
    FilePageStoreManagerChild.LongOperationAsyncExecutorChild executor = new FilePageStoreManagerChild.LongOperationAsyncExecutorChild("test", new NullLogger());
    final AtomicInteger ai = new AtomicInteger(1);
    AtomicReference<Throwable> throwable = new AtomicReference<>();
    for (int i = 0; i < 1000; i++) {
        executor.async(() -> {
            ai.set(0);
            doSleep(3);
            try {
                assertEquals(0, ai.get());
            } catch (AssertionError e) {
                throwable.set(e);
            }
            ai.set(1);
        });
        executor.afterAsyncCompletion(() -> {
            assertEquals(1, ai.get());
            return null;
        });
    }
    if (throwable.get() != null)
        throw throwable.get();
}
Also used : NullLogger(org.apache.ignite.logger.NullLogger) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AtomicReference(java.util.concurrent.atomic.AtomicReference) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

NullLogger (org.apache.ignite.logger.NullLogger)23 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)17 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)10 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)10 MarshallerContextTestImpl (org.apache.ignite.marshaller.MarshallerContextTestImpl)10 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)8 Test (org.junit.Test)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 IgniteException (org.apache.ignite.IgniteException)4 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)4 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)4 Ignite (org.apache.ignite.Ignite)3 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)3 File (java.io.File)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)2 GridDiscoveryManager (org.apache.ignite.internal.managers.discovery.GridDiscoveryManager)2 GridSystemViewManager (org.apache.ignite.internal.managers.systemview.GridSystemViewManager)2 JmxSystemViewExporterSpi (org.apache.ignite.internal.managers.systemview.JmxSystemViewExporterSpi)2 WALIterator (org.apache.ignite.internal.pagemem.wal.WALIterator)2