ARTEMIS-890 Improving Paging consistencies with broker.persistent = false. Block, Page and Drop will now work under non persistent
(cherry picked from commit 332338d018
)
This commit is contained in:
parent
af443d7052
commit
99a62f75f2
|
@ -714,6 +714,12 @@ public class Create extends InputAbstract {
|
||||||
filters.put("${hornetq-acceptor}", applyFilters(readTextFile(ETC_HORNETQ_ACCEPTOR_TXT), filters));
|
filters.put("${hornetq-acceptor}", applyFilters(readTextFile(ETC_HORNETQ_ACCEPTOR_TXT), filters));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (disablePersistence) {
|
||||||
|
filters.put("${full-policy}", "BLOCK");
|
||||||
|
} else {
|
||||||
|
filters.put("${full-policy}", "PAGE");
|
||||||
|
}
|
||||||
|
|
||||||
performAutoTune(filters, aio, dataFolder);
|
performAutoTune(filters, aio, dataFolder);
|
||||||
|
|
||||||
write(ETC_BROKER_XML, filters, false);
|
write(ETC_BROKER_XML, filters, false);
|
||||||
|
|
|
@ -95,7 +95,7 @@ ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-st
|
||||||
<!-- with -1 only the global-max-size is in use for limiting -->
|
<!-- with -1 only the global-max-size is in use for limiting -->
|
||||||
<max-size-bytes>-1</max-size-bytes>
|
<max-size-bytes>-1</max-size-bytes>
|
||||||
<message-counter-history-day-limit>10</message-counter-history-day-limit>
|
<message-counter-history-day-limit>10</message-counter-history-day-limit>
|
||||||
<address-full-policy>PAGE</address-full-policy>
|
<address-full-policy>${full-policy}</address-full-policy>
|
||||||
</address-setting>
|
</address-setting>
|
||||||
</address-settings>
|
</address-settings>
|
||||||
</core>
|
</core>
|
||||||
|
|
|
@ -797,7 +797,9 @@ public class PagingStoreImpl implements PagingStore {
|
||||||
lock.readLock().unlock();
|
lock.readLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (managerLock != null) {
|
||||||
managerLock.lock();
|
managerLock.lock();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
lock.writeLock().lock();
|
lock.writeLock().lock();
|
||||||
|
|
||||||
|
@ -852,9 +854,11 @@ public class PagingStoreImpl implements PagingStore {
|
||||||
lock.writeLock().unlock();
|
lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
if (managerLock != null) {
|
||||||
managerLock.unlock();
|
managerLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will disable cleanup of pages. No page will be deleted after this call.
|
* This method will disable cleanup of pages. No page will be deleted after this call.
|
||||||
|
|
|
@ -529,12 +529,23 @@ public class NullStorageManager implements StorageManager {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addToPage(PagingStore s,
|
public boolean addToPage(PagingStore store,
|
||||||
ServerMessage msg,
|
ServerMessage msg,
|
||||||
Transaction tx,
|
Transaction tx,
|
||||||
RouteContextList listCtx) throws Exception {
|
RouteContextList listCtx) throws Exception {
|
||||||
return false;
|
/**
|
||||||
|
* Exposing the read-lock here is an encapsulation violation done in order to keep the code
|
||||||
|
* simpler. The alternative would be to add a second method, say 'verifyPaging', to
|
||||||
|
* PagingStore.
|
||||||
|
* <p>
|
||||||
|
* Adding this second method would also be more surprise prone as it would require a certain
|
||||||
|
* calling order.
|
||||||
|
* <p>
|
||||||
|
* The reasoning is that exposing the lock is more explicit and therefore `less bad`.
|
||||||
|
*/
|
||||||
|
return store.page(msg, tx, listCtx, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3327,7 +3327,16 @@ public class PagingTest extends ActiveMQTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDropMessages() throws Exception {
|
public void testDropMessagesPersistent() throws Exception {
|
||||||
|
testDropMessages(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDropMessagesNonPersistent() throws Exception {
|
||||||
|
testDropMessages(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testDropMessages(final boolean persistent) throws Exception {
|
||||||
clearDataRecreateServerDirs();
|
clearDataRecreateServerDirs();
|
||||||
|
|
||||||
HashMap<String, AddressSettings> settings = new HashMap<>();
|
HashMap<String, AddressSettings> settings = new HashMap<>();
|
||||||
|
@ -3337,7 +3346,7 @@ public class PagingTest extends ActiveMQTestBase {
|
||||||
|
|
||||||
settings.put(PagingTest.ADDRESS.toString(), set);
|
settings.put(PagingTest.ADDRESS.toString(), set);
|
||||||
|
|
||||||
server = createServer(true, createDefaultInVMConfig(), 1024, 10 * 1024, settings);
|
server = createServer(persistent, createDefaultInVMConfig(), 1024, 10 * 1024, settings);
|
||||||
|
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue