ARTEMIS-1455 Fixing issues on Large Message conversion

This commit is contained in:
Clebert Suconic 2017-10-09 13:36:22 -04:00
parent 484e939698
commit ba1323c8b2
4 changed files with 17 additions and 2 deletions

View File

@ -2207,7 +2207,11 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
*/
@Override
public long getMaxRecordSize() {
return Math.min(getFileSize(), fileFactory.getBufferSize());
if (fileFactory.getBufferSize() == 0) {
return getFileSize();
} else {
return Math.min(getFileSize(), fileFactory.getBufferSize());
}
}
private void flushExecutor(Executor executor) throws InterruptedException {

View File

@ -65,6 +65,11 @@ import org.apache.activemq.artemis.utils.IDGenerator;
*/
public interface StorageManager extends IDGenerator, ActiveMQComponent {
default long getMaxRecordSize() {
/** Null journal is pretty much memory */
return Long.MAX_VALUE;
}
void criticalError(Throwable error);
/**

View File

@ -228,6 +228,12 @@ public abstract class AbstractJournalStorageManager extends CriticalComponentImp
idGenerator = new BatchingIDGenerator(0, CHECKPOINT_BATCH_SIZE, this);
}
public long getMaxRecordSize() {
return messageJournal.getMaxRecordSize();
}
/**
* Called during initialization. Used by implementations to setup Journals, Stores etc...
*

View File

@ -1333,7 +1333,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
boolean noAutoCreateQueue) throws Exception {
final Message message;
if ((msg.getEncodeSize() > storageManager.getMessageJournal().getMaxRecordSize()) && !msg.isLargeMessage()) {
if ((msg.getEncodeSize() > storageManager.getMaxRecordSize()) && !msg.isLargeMessage()) {
message = messageToLargeMessage(msg);
} else {
message = msg;