activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Tully (JIRA)" <j...@apache.org>
Subject [jira] Created: (AMQ-1798) store checkpoint repeatidly writes the same checkpoint record - results in unnecessary writes
Date Fri, 13 Jun 2008 11:04:00 GMT
store checkpoint repeatidly writes the same checkpoint record - results in unnecessary writes
---------------------------------------------------------------------------------------------

                 Key: AMQ-1798
                 URL: https://issues.apache.org/activemq/browse/AMQ-1798
             Project: ActiveMQ
          Issue Type: Improvement
          Components: Message Store
    Affects Versions: 5.1.0
         Environment: all - default config
            Reporter: Gary Tully
            Priority: Minor


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)) {
+                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);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message