I left a simple test running over night to find that the data file index was incrementing, it turns out that the checkpoint functionality does not remember its last mark and will always write a mark, even if it is the same as the last written mark, with a small dataFileSize I found that the current data file index was not as expected.
This is really just odd behaviour rather than bug as I don't think it has any really adverse effects unless there is a cap on the file id. (which there is not!)
the following change ensures that checkpoint will only write a record if there is a change to the last recorded mark.
Index: src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
===================================================================
— src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java (revision 667120)
+++ src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java (working copy)
@@ -375,12 +375,13 @@
LOG.debug("Checkpoint started.");
}
- Location newMark = null;
+ Location currentMark = asyncDataManager.getMark();
+ Location newMark = currentMark;
Iterator<AMQMessageStore> queueIterator = queues.values().iterator();
while (queueIterator.hasNext()) {
final AMQMessageStore ms = queueIterator.next();
Location mark = (Location)ms.getMark();
- if (mark != null && (newMark == null || newMark.compareTo(mark) < 0))
Unknown macro: {+ if (mark != null && mark.compareTo(newMark) > 0) {
newMark = mark;
}
}
@@ -388,12 +389,12 @@
while (topicIterator.hasNext()) {
final AMQTopicMessageStore ms = topicIterator.next();
Location mark = (Location)ms.getMark();
- if (mark != null && (newMark == null || newMark.compareTo(mark) < 0)) {
+ if (mark != null && mark.compareTo(newMark) > 0) { newMark = mark; } }
}
try {
- if (newMark != null) {
+ if (newMark != currentMark) {
if (LOG.isDebugEnabled()) {
LOG.debug("Marking journal at: " + newMark);