use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class IgniteWalRebalanceLoggingTest method testFullRebalanceWithShortCpHistoryLogMsgs.
/**
* Test checks log messages in case of short history of checkpoint.
*
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_PDS_MAX_CHECKPOINT_MEMORY_HISTORY_SIZE, value = "2")
@WithSystemProperty(key = IGNITE_PDS_WAL_REBALANCE_THRESHOLD, value = "1")
public void testFullRebalanceWithShortCpHistoryLogMsgs() throws Exception {
LogListener expMsgsLsnr = LogListener.matches(str -> str.startsWith("Partitions were reserved, but maximum available counter is greater than " + "demanded or WAL contains too many updates: ") && str.contains("grp=cache_group1") && str.contains("grp=cache_group2")).andMatches(str -> str.startsWith("Starting rebalance routine") && (str.contains("cache_group1") || str.contains("cache_group2")) && str.contains("fullPartitions=[0-7], histPartitions=[]")).times(2).build();
checkFollowingPartitionsWereReservedForPotentialHistoryRebalanceMsg(expMsgsLsnr);
assertTrue(expMsgsLsnr.check());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class IgniteWalRebalanceLoggingTest method testHistoricalRebalanceLogMsg.
/**
* Check that in case of Historical rebalance we log appropriate messages.
* <p>
* <b>Steps:</b>
* <ol>
* <li>set IGNITE_PDS_WAL_REBALANCE_THRESHOLD to 1</li>
* <li>Start two nodes.</li>
* <li>Create two caches each in it's own cache group and populate them with some data.</li>
* <li>Stop second node and add more data to both caches.</li>
* <li>Wait checkpoint frequency * 2. This is required to guarantee that at least one checkpoint would be
* created.</li>
* <li>Start, previously stopped node and await for PME.</li>
* </ol>
* <p>
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_PDS_WAL_REBALANCE_THRESHOLD, value = "1")
public void testHistoricalRebalanceLogMsg() throws Exception {
LogListener expMsgsLsnr = LogListener.matches(str -> str.startsWith("Cache groups with earliest reserved checkpoint and a reason why a previous checkpoint was inapplicable:") && str.contains("cache_group1") && str.contains("cache_group2")).times(3).andMatches(str -> str.startsWith("Starting rebalance routine") && (str.contains("cache_group1") || str.contains("cache_group2")) && str.contains("fullPartitions=[], histPartitions=[0-7]")).times(2).build();
LogListener unexpectedMessagesLsnr = LogListener.matches((str) -> str.startsWith("Partitions weren't present in any history reservation:") || str.startsWith("Partitions were reserved, but maximum available counter is greater than demanded:")).build();
checkFollowingPartitionsWereReservedForPotentialHistoryRebalanceMsg(expMsgsLsnr, unexpectedMessagesLsnr);
assertTrue(expMsgsLsnr.check());
assertFalse(unexpectedMessagesLsnr.check());
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class WalArchiveSizeConfigurationTest method testIncorrectIgniteThresholdWalArchiveSizePercentageProperty.
/**
* Check that if the {@link IgniteSystemProperties#IGNITE_THRESHOLD_WAL_ARCHIVE_SIZE_PERCENTAGE}
* are set to more than 1.0, then there will be an error when starting the node.
*/
@Test
@WithSystemProperty(key = IGNITE_THRESHOLD_WAL_ARCHIVE_SIZE_PERCENTAGE, value = "2")
public void testIncorrectIgniteThresholdWalArchiveSizePercentageProperty() {
DataStorageConfiguration dsCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true));
assertThrowsAnyCause(log, () -> startGrid(0, (IgniteConfiguration cfg) -> cfg.setDataStorageConfiguration(dsCfg)), IgniteCheckedException.class, "IGNITE_THRESHOLD_WAL_ARCHIVE_SIZE_PERCENTAGE must be less than or equal to 1.0");
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class WalCompactionNoArchiverTest method testNoCompressionErrors.
/**
* Tests that attempts to compress WAL segment don't result with error.
*/
@Test
@WithSystemProperty(key = "IGNITE_WAL_COMPRESSOR_WORKER_THREAD_CNT", value = "1")
public void testNoCompressionErrors() throws Exception {
IgniteEx ig = startGrid(0);
ig.cluster().active(true);
IgniteCache<Integer, byte[]> cache = ig.cache(CACHE_NAME);
for (int i = 0; i < ENTRIES; i++) {
// At least 20MB of raw data in total.
final byte[] val = new byte[40000];
val[i] = 1;
cache.put(i, val);
}
stopAllGrids();
ig = startGrid(0);
cache = ig.cache(CACHE_NAME);
for (int i = 0; i < ENTRIES; i++) {
// At least 20MB of raw data in total.
final byte[] val = new byte[40000];
val[i] = 1;
cache.put(i, val);
}
IgniteWriteAheadLogManager wal = ig.context().cache().context().wal();
Object compressor = U.field(wal, "compressor");
assertNotNull(compressor);
Object error = U.field(compressor, "lastCompressionError");
if (error != null)
fail("Unexpected error in FileCompressor: " + error);
}
use of org.apache.ignite.testframework.junits.WithSystemProperty in project ignite by apache.
the class FailureHandlingConfigurationTest method testOverridingBySysProps.
/**
* @throws Exception If failed.
*/
@Test
@WithSystemProperty(key = IGNITE_SYSTEM_WORKER_BLOCKED_TIMEOUT, value = "80000")
@WithSystemProperty(key = IGNITE_CHECKPOINT_READ_LOCK_TIMEOUT, value = "90000")
public void testOverridingBySysProps() throws Exception {
sysWorkerBlockedTimeout = 1L;
checkpointReadLockTimeout = 2L;
IgniteEx ignite = startGrid(0);
ignite.cluster().active(true);
WorkersRegistry reg = ignite.context().workersRegistry();
IgniteCacheDatabaseSharedManager dbMgr = ignite.context().cache().context().database();
FailureHandlingMxBean mBean = getMBean();
assertEquals(sysWorkerBlockedTimeout, ignite.configuration().getSystemWorkerBlockedTimeout());
assertEquals(checkpointReadLockTimeout, ignite.configuration().getDataStorageConfiguration().getCheckpointReadLockTimeout());
long workerPropVal = Long.getLong(IGNITE_SYSTEM_WORKER_BLOCKED_TIMEOUT);
long checkpointPropVal = Long.getLong(IGNITE_CHECKPOINT_READ_LOCK_TIMEOUT);
assertEquals(workerPropVal, reg.getSystemWorkerBlockedTimeout());
assertEquals(checkpointPropVal, dbMgr.checkpointReadLockTimeout());
assertEquals(workerPropVal, mBean.getSystemWorkerBlockedTimeout());
assertEquals(checkpointPropVal, mBean.getCheckpointReadLockTimeout());
}
Aggregations