You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by zhangleilmy <zh...@yahoo.com.cn> on 2008/09/08 10:31:42 UTC

AMQPersist may not delete some date file where messages already bean consumed.

1. In AMQMessageStore.java, this is a function(doAsyncWrite), I think there
should delete message in cpdeledMessageIds.entrySet(). 
I add code like this:
############################################################
Iterator<Entry<MessageId, ReferenceData>> iterator2 =
cpdeledMessageIds.entrySet().iterator();
                while (iterator2.hasNext()) {
                    Entry<MessageId, ReferenceData> entry =
iterator2.next();
                    try {
                       
AMQMessageStore.this.peristenceAdapter.removeInProgressDataFile(AMQMessageStore.this,entry.getValue().getFileId());
                    } catch (Throwable e) {
                        LOG.warn("Add by ZL Message could not be added to
long term store: " + e.getMessage(), e);
                    }
                }
#############################################################
before
#############################################################
persitanceAdapter.commitTransaction(context);
persitanceAdapter.beginTransaction(context);

// Checkpoint the removed messages.
                for (MessageAck ack : cpRemovedMessageLocations) {
                    try {
                       
referenceStore.removeMessage(transactionTemplate.getContext(), ack);
                    } catch (Throwable e) {
                        LOG.warn("Message could not be removed from long
term store: " + e.getMessage(), e);
                    }
                }
#############################################################


2. the index file getting bigger and bigger.
If message produced more and more but not bean comsumed, the index file will
become bigger. even after messages have bean consumed, next time when
messages were produced, the index file become more bigger. I think there are
some wrong in link structure.

In org.apache.activemq.kaha.impl.index.IndexManager 
In function freeIndex() createNewIndex(), I think may be where are something
wrong.


My english is poor, I don't know if I have expressed clearly.







-- 
View this message in context: http://www.nabble.com/AMQPersist-may-not-delete-some-date-file-where-messages-already-bean-consumed.-tp19367985p19367985.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: AMQPersist may not delete some date file where messages already bean consumed.

Posted by Gary Tully <ga...@gmail.com>.
best thing to do is to write a Junit test case for trunk that
demonstrates the behavior you are seeing, then raise a jira issue with
the test case and possible fix.
An example test case that could provide the starting point code is
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/DataFileNotDeletedTest.java?view=markup


2008/9/8 zhangleilmy <zh...@yahoo.com.cn>:
>
> 1. In AMQMessageStore.java, this is a function(doAsyncWrite), I think there
> should delete message in cpdeledMessageIds.entrySet().
> I add code like this:
> ############################################################
> Iterator<Entry<MessageId, ReferenceData>> iterator2 =
> cpdeledMessageIds.entrySet().iterator();
>                while (iterator2.hasNext()) {
>                    Entry<MessageId, ReferenceData> entry =
> iterator2.next();
>                    try {
>
> AMQMessageStore.this.peristenceAdapter.removeInProgressDataFile(AMQMessageStore.this,entry.getValue().getFileId());
>                    } catch (Throwable e) {
>                        LOG.warn("Add by ZL Message could not be added to
> long term store: " + e.getMessage(), e);
>                    }
>                }
> #############################################################
> before
> #############################################################
> persitanceAdapter.commitTransaction(context);
> persitanceAdapter.beginTransaction(context);
>
> // Checkpoint the removed messages.
>                for (MessageAck ack : cpRemovedMessageLocations) {
>                    try {
>
> referenceStore.removeMessage(transactionTemplate.getContext(), ack);
>                    } catch (Throwable e) {
>                        LOG.warn("Message could not be removed from long
> term store: " + e.getMessage(), e);
>                    }
>                }
> #############################################################
>
>
> 2. the index file getting bigger and bigger.
> If message produced more and more but not bean comsumed, the index file will
> become bigger. even after messages have bean consumed, next time when
> messages were produced, the index file become more bigger. I think there are
> some wrong in link structure.
>
> In org.apache.activemq.kaha.impl.index.IndexManager
> In function freeIndex() createNewIndex(), I think may be where are something
> wrong.
>
>
> My english is poor, I don't know if I have expressed clearly.
>
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/AMQPersist-may-not-delete-some-date-file-where-messages-already-bean-consumed.-tp19367985p19367985.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>