https://issues.apache.org/jira/browse/AMQ-4662 - kahadb default checksumJournalFiles = true - validate no migration impact as we currently store default checksum value of 0

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1509178 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2013-08-01 11:44:30 +00:00
parent ed5d841c21
commit 5cadb04ad3
3 changed files with 23 additions and 5 deletions

View File

@ -240,7 +240,7 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
private boolean ignoreMissingJournalfiles = false;
private int indexCacheSize = 10000;
private boolean checkForCorruptJournalFiles = false;
private boolean checksumJournalFiles = false;
private boolean checksumJournalFiles = true;
protected boolean forceRecoverIndex = false;
private final Object checkpointThreadLock = new Object();
private boolean rewriteOnRedelivery = false;

View File

@ -68,7 +68,6 @@ public class AMQ4368Test {
broker.getDestinationPolicy().setDefaultEntry(policy);
KahaDBPersistenceAdapter kahadb = new KahaDBPersistenceAdapter();
kahadb.setChecksumJournalFiles(true);
kahadb.setCheckForCorruptJournalFiles(true);
kahadb.setCleanupInterval(1000);

View File

@ -108,7 +108,7 @@ public class KahaDBTest extends TestCase {
public void testCheckCorruptionNotIgnored() throws Exception {
KahaDBStore kaha = createStore(true);
assertFalse(kaha.isChecksumJournalFiles());
assertTrue(kaha.isChecksumJournalFiles());
assertFalse(kaha.isCheckForCorruptJournalFiles());
kaha.setJournalMaxFileLength(1024*100);
@ -135,6 +135,27 @@ public class KahaDBTest extends TestCase {
}
public void testMigrationOnNewDefaultForChecksumJournalFiles() throws Exception {
KahaDBStore kaha = createStore(true);
kaha.setChecksumJournalFiles(false);
assertFalse(kaha.isChecksumJournalFiles());
assertFalse(kaha.isCheckForCorruptJournalFiles());
kaha.setJournalMaxFileLength(1024*100);
BrokerService broker = createBroker(kaha);
sendMessages(1000);
broker.stop();
kaha = createStore(false);
kaha.setJournalMaxFileLength(1024*100);
kaha.setCheckForCorruptJournalFiles(true);
assertFalse(kaha.isIgnoreMissingJournalfiles());
createBroker(kaha);
assertEquals(1000, receiveMessages());
}
private void assertExistsAndCorrupt(File file) throws IOException {
assertTrue(file.exists());
RandomAccessFile f = new RandomAccessFile(file, "rw");
@ -150,7 +171,6 @@ public class KahaDBTest extends TestCase {
public void testCheckCorruptionIgnored() throws Exception {
KahaDBStore kaha = createStore(true);
kaha.setJournalMaxFileLength(1024*100);
kaha.setChecksumJournalFiles(true);
BrokerService broker = createBroker(kaha);
sendMessages(1000);
broker.stop();
@ -162,7 +182,6 @@ public class KahaDBTest extends TestCase {
kaha = createStore(false);
kaha.setIgnoreMissingJournalfiles(true);
kaha.setJournalMaxFileLength(1024*100);
kaha.setChecksumJournalFiles(true);
kaha.setCheckForCorruptJournalFiles(true);
broker = createBroker(kaha);