use of org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder in project ignite by apache.
the class IgniteWalReaderTest method testFillWalForExactSegmentsCount.
/**
* Tests archive completed event is fired.
*
* @throws Exception if failed.
*/
@Test
public void testFillWalForExactSegmentsCount() throws Exception {
customWalMode = WALMode.FSYNC;
CountDownLatch reqSegments = new CountDownLatch(15);
Ignite ignite = startGrid();
ignite.cluster().active(true);
final IgniteEvents evts = ignite.events();
if (!evts.isEnabled(EVT_WAL_SEGMENT_ARCHIVED))
fail("nothing to test");
evts.localListen(e -> {
WalSegmentArchivedEvent archComplEvt = (WalSegmentArchivedEvent) e;
long idx = archComplEvt.getAbsWalSegmentIdx();
log.info("Finished archive for segment [" + idx + ", " + archComplEvt.getArchiveFile() + "]: [" + e + "]");
reqSegments.countDown();
return true;
}, EVT_WAL_SEGMENT_ARCHIVED);
int totalEntries = 0;
while (reqSegments.getCount() > 0) {
int write = 500;
putAllDummyRecords(ignite, write);
totalEntries += write;
Assert.assertTrue("Too much entries generated, but segments was not become available", totalEntries < 10000);
}
String subfolderName = genDbSubfolderName(ignite, 0);
stopGrid();
String workDir = U.defaultWorkDirectory();
IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(log);
IteratorParametersBuilder iterParametersBuilder = createIteratorParametersBuilder(workDir, subfolderName);
iterParametersBuilder.filesOrDirs(workDir);
scanIterateAndCount(factory, iterParametersBuilder, totalEntries, 0, null, null);
}
use of org.apache.ignite.internal.processors.cache.persistence.wal.reader.IgniteWalIteratorFactory.IteratorParametersBuilder 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);
}
Aggregations