ARTEMIS-3434 Fixing Journal Retention Wrong month

This commit is contained in:
Clebert Suconic 2021-08-20 09:04:56 -04:00
parent 5445933559
commit ed4c915d50
5 changed files with 9 additions and 7 deletions

View File

@ -68,7 +68,7 @@ public class RecoverMessages extends DBOption {
recover(configuration, getJournal(), journalOutput, new File(getLargeMessages()), reclaimed);
}
} catch (Exception e) {
treatError(e, "data", "print");
treatError(e, "data", "recover");
}
return null;
}

View File

@ -53,7 +53,7 @@ ${jdbc}
it is recommended to use a separate storage unit from the journal for performance considerations.
<journal-retention-directory period="7" unit="DAYS" storage-limit="10G">data/retention</journal-retention-directory>>
<journal-retention-directory period="7" unit="DAYS" storage-limit="10G">data/retention</journal-retention-directory>
-->
<journal-datasync>${fsync}</journal-datasync>

View File

@ -589,6 +589,7 @@ public interface ActiveMQServerControl {
@Parameter(name = "durable", desc = "Is the queue durable?") boolean durable,
@Parameter(name = "routingType", desc = "The routing type used for this address, MULTICAST or ANYCAST") String routingType) throws Exception;
/**
* Create a queue.
* <br>

View File

@ -2550,7 +2550,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
public String getHistoryFileName(long sequence, Calendar calendar) {
String fileName = String.format("%s-%04d%02d%02d%02d%02d%02d-%d.%s", filesRepository.getFilePrefix(), calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.HOUR_OF_DAY),
(calendar.get(Calendar.MONTH) + 1), calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND), sequence, filesRepository.getFileExtension());
return fileName;
@ -2576,10 +2576,11 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal
int minutes = Integer.parseInt(datePortion.substring(10, 12));
int seconds = Integer.parseInt(datePortion.substring(12, 14));
calendar.set(year, month, day, hour, minutes, seconds);
calendar.clear();
calendar.set(year, month - 1, day, hour, minutes, seconds);
return calendar.getTimeInMillis();
}
public String getDatePortion(String name) {
return name.substring(filesRepository.getFilePrefix().length() + 1, name.indexOf("-", filesRepository.getFilePrefix().length() + 1));
}

View File

@ -84,7 +84,7 @@ public class JournaHistorylBackupTest extends ActiveMQTestBase {
@Test
public void verifyFileName() throws Throwable {
GregorianCalendar clebertsBirthday = new GregorianCalendar(1972, 1, 19, 4, 5, 7);
GregorianCalendar clebertsBirthday = new GregorianCalendar(1972, 0, 19, 4, 5, 7);
JournalImpl journal = new JournalImpl(10 * 1024, 10, 10, 0, 100, new FakeSequentialFileFactory(), "cleberts", "birthday", 1);
@ -100,7 +100,7 @@ public class JournaHistorylBackupTest extends ActiveMQTestBase {
compareCalendar.setTimeInMillis(d);
Assert.assertEquals(1972, compareCalendar.get(Calendar.YEAR));
Assert.assertEquals(1, compareCalendar.get(Calendar.MONTH));
Assert.assertEquals(0, compareCalendar.get(Calendar.MONTH));
Assert.assertEquals(19, compareCalendar.get(Calendar.DAY_OF_MONTH));
Assert.assertEquals(4, compareCalendar.get(Calendar.HOUR_OF_DAY));
Assert.assertEquals(5, compareCalendar.get(Calendar.MINUTE));