resolve https://issues.apache.org/activemq/browse/AMQ-2584 for AMQ store, if a write was outstanding when a second add arrives, the addition was ignored but the additonal file reference was not ignored leading to a dangling ref to a data file that prevented it being reclaimed

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@986734 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-08-18 15:20:15 +00:00
parent 815c2f32bc
commit c5da5f829a
2 changed files with 5 additions and 2 deletions

View File

@ -159,7 +159,10 @@ public class AMQMessageStore extends AbstractMessageStore {
lock.lock(); lock.lock();
try { try {
lastLocation = location; lastLocation = location;
messages.put(message.getMessageId(), data); ReferenceData prev = messages.put(message.getMessageId(), data);
if (prev != null) {
AMQMessageStore.this.peristenceAdapter.removeInProgressDataFile(AMQMessageStore.this, prev.getFileId());
}
} finally { } finally {
lock.unlock(); lock.unlock();
} }

View File

@ -57,7 +57,7 @@ public class AMQ2584Test extends org.apache.activemq.TestSupport {
public void initCombosForTestSize() throws Exception { public void initCombosForTestSize() throws Exception {
this.addCombinationValues("defaultPersistenceAdapter", this.addCombinationValues("defaultPersistenceAdapter",
new Object[]{ new Object[]{
// PersistenceAdapterChoice.AMQ, PersistenceAdapterChoice.AMQ,
PersistenceAdapterChoice.KahaDB PersistenceAdapterChoice.KahaDB
}); });
} }