Issue Details (XML | Word | Printable)

Key: AMQ-1798
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Rob Davies
Reporter: Gary Tully
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ActiveMQ

store checkpoint repeatidly writes the same checkpoint record - results in unnecessary writes

Created: 13/Jun/08 04:02 AM   Updated: 22/Aug/08 03:27 AM
Component/s: Message Store
Affects Version/s: 5.1.0
Fix Version/s: 5.2.0

Time Tracking:
Not Specified

Environment: all - default config

Patch Info: Patch Available


 Description  « Hide
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);


 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Rob Davies added a comment - 19/Jun/08 09:40 AM
Fixed bu SVN revision 669265