Skip to content

Commit

Permalink
ARTEMIS-3581 - allow max-size-bytes=0 configuration force paging for …
Browse files Browse the repository at this point in the history
…an address, independent of the page-size-bytes
  • Loading branch information
gtully committed Nov 18, 2021
1 parent 778ab44 commit 8d50aa9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
Expand Up @@ -166,15 +166,6 @@ public PagingStoreImpl(final SimpleString address,

applySetting(addressSettings);

if (addressFullMessagePolicy == AddressFullMessagePolicy.PAGE && maxSize != -1 && pageSize >= maxSize) {
throw new IllegalStateException("pageSize for address " + address +
" >= maxSize. Normally pageSize should" +
" be significantly smaller than maxSize, ms: " +
maxSize +
" ps " +
pageSize);
}

this.executor = executor;

this.pagingManager = pagingManager;
Expand Down Expand Up @@ -259,8 +250,8 @@ public long getAddressSize() {

@Override
public long getMaxSize() {
if (maxSize < 0) {
// if maxSize < 0, we will return 2 pages for depage purposes
if (maxSize <= 0) {
// if maxSize <= 0, we will return 2 pages for de-page purposes
return pageSize * 2;
} else {
return maxSize;
Expand Down
5 changes: 3 additions & 2 deletions docs/user-manual/en/paging.md
Expand Up @@ -53,14 +53,15 @@ You can configure the location of the paging folder in `broker.xml`.
## Paging Mode

As soon as messages delivered to an address exceed the configured size,
that address alone goes into page mode.
that address alone goes into page mode. If max-size-bytes == 0, an address
will immediately enter into page mode.

> **Note:**
>
> Paging is done individually per address. If you configure a max-size-bytes
> for an address, that means each matching address will have a maximum size
> that you specified. It DOES NOT mean that the total overall size of all
> matching addresses is limited to max-size-bytes.
> matching addresses is limited to max-size-bytes. Use [global-max-size](#global-max-size) for that!
### Configuration

Expand Down
Expand Up @@ -4648,7 +4648,7 @@ public void testPagingOneDestinationOnly() throws Exception {

addresses.put("#", new AddressSettings());

AddressSettings pagedDestination = new AddressSettings().setPageSizeBytes(1024).setMaxSizeBytes(10 * 1024);
AddressSettings pagedDestination = new AddressSettings().setPageSizeBytes(1024).setMaxSizeBytes(0);

addresses.put(PAGED_ADDRESS.toString(), pagedDestination);

Expand Down

0 comments on commit 8d50aa9

Please sign in to comment.