ARTEMIS-2283 Bad WARN message "AMQ222211: Storage is back to stable now"

LocalMonitor::under on PagingManagerImpl won't log anymore with a
warning message if the producers got unblocked and with info
if disk it getting freed
This commit is contained in:
Francesco Nigro 2019-03-26 18:04:07 +01:00 committed by Justin Bertram
parent b62e081a7d
commit ac4cd4856c
3 changed files with 12 additions and 14 deletions

View File

@ -17,7 +17,6 @@
package org.apache.activemq.artemis.core.paging.impl;
import java.nio.file.FileStore;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
@ -180,13 +179,7 @@ public final class PagingManagerImpl implements PagingManager {
memoryReleased();
}
}
Iterator<PagingStore> storeIterator = blockedStored.iterator();
while (storeIterator.hasNext()) {
PagingStore store = storeIterator.next();
if (store.checkReleasedMemory()) {
storeIterator.remove();
}
}
blockedStored.removeIf(PagingStore::checkReleasedMemory);
}
}
@ -213,9 +206,12 @@ public final class PagingManagerImpl implements PagingManager {
@Override
public void under(FileStore store, double usage) {
final boolean diskFull = PagingManagerImpl.this.diskFull;
if (diskFull || !blockedStored.isEmpty() || !memoryCallback.isEmpty()) {
ActiveMQServerLogger.LOGGER.diskCapacityRestored();
diskFull = false;
if (diskFull) {
ActiveMQServerLogger.LOGGER.diskCapacityRestored();
PagingManagerImpl.this.diskFull = false;
}
checkMemoryRelease();
}
}

View File

@ -1337,7 +1337,7 @@ public interface ActiveMQServerLogger extends BasicLogger {
format = Message.Format.MESSAGE_FORMAT)
void diskBeyondCapacity();
@LogMessage(level = Logger.Level.WARN)
@LogMessage(level = Logger.Level.INFO)
@Message(id = 222211, value = "Storage is back to stable now, under max-disk-usage.",
format = Message.Format.MESSAGE_FORMAT)
void diskCapacityRestored();

View File

@ -58,6 +58,7 @@ public class AddressFullLoggingTest extends ActiveMQTestBase {
AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(10 * 1024).setMaxSizeBytes(20 * 1024).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
server.getAddressSettingsRepository().addMatch("#", defaultSetting);
server.getConfiguration().setDiskScanPeriod(100);
server.start();
internalTest(MAX_MESSAGES, MY_ADDRESS, MY_QUEUE, server);
@ -73,7 +74,7 @@ public class AddressFullLoggingTest extends ActiveMQTestBase {
AddressSettings defaultSetting = new AddressSettings().setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
server.getAddressSettingsRepository().addMatch("#", defaultSetting);
server.getConfiguration().setGlobalMaxSize(20 * 1024);
server.getConfiguration().setGlobalMaxSize(20 * 1024).setDiskScanPeriod(100);
server.start();
@ -122,7 +123,6 @@ public class AddressFullLoggingTest extends ActiveMQTestBase {
executor.shutdown();
session.close();
session = factory.createSession(false, true, true);
session.start();
ClientConsumer consumer = session.createConsumer(MY_QUEUE);
@ -132,7 +132,8 @@ public class AddressFullLoggingTest extends ActiveMQTestBase {
break;
msg.acknowledge();
}
//this is needed to allow to kick-in at least once disk scan
TimeUnit.MILLISECONDS.sleep(server.getConfiguration().getDiskScanPeriod() * 2);
session.close();
locator.close();
server.stop();
@ -140,6 +141,7 @@ public class AddressFullLoggingTest extends ActiveMQTestBase {
// Using the code only so the test doesn't fail just because someone edits the log text
Assert.assertTrue("Expected to find AMQ222183", AssertionLoggerHandler.findText("AMQ222183", "myAddress"));
Assert.assertTrue("Expected to find AMQ221046", AssertionLoggerHandler.findText("AMQ221046", "myAddress"));
Assert.assertFalse("Expected to not find AMQ222211", AssertionLoggerHandler.findText("AMQ222211"));
}
@AfterClass