Author: chirino
Date: Thu Sep 4 20:29:19 2008
New Revision: 692326
URL: http://svn.apache.org/viewvc?rev=692326&view=rev
Log:
Tweaking to make more test cases pass
Modified:
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/KahaDBPersistenceAdaptor.java
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/MessageDatabase.java
Modified:
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/KahaDBPersistenceAdaptor.java
URL:
http://svn.apache.org/viewvc/activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/KahaDBPersistenceAdaptor.java?rev=692326&r1=692325&r2=692326&view=diff
==============================================================================
---
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/KahaDBPersistenceAdaptor.java
(original)
+++
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/KahaDBPersistenceAdaptor.java
Thu Sep 4 20:29:19 2008
@@ -223,8 +223,11 @@
}
}
if( entry!=null ) {
- cursorPos = entry.getKey();
- cursorPos.setOffset( cursorPos.getOffset()+1 );
+ // Copy the location, cause the iterator gives us
the key by reference.. changing it
+ // would mess up the index.
+ cursorPos = new Location();
+
cursorPos.setDataFileId(entry.getKey().getDataFileId());
+ cursorPos.setOffset(entry.getKey().getOffset()+1 );
}
}
});
Modified:
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/MessageDatabase.java
URL:
http://svn.apache.org/viewvc/activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/MessageDatabase.java?rev=692326&r1=692325&r2=692326&view=diff
==============================================================================
---
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/MessageDatabase.java
(original)
+++
activemq/sandbox/kahadb/src/main/java/org/apache/kahadb/store/MessageDatabase.java
Thu Sep 4 20:29:19 2008
@@ -193,6 +193,8 @@
}
});
metadata = new Metadata();
+ pageFile.unload();
+ asyncDataManager.close();
}
@@ -398,8 +400,10 @@
private void updateIndex(Transaction tx, KahaRemoveMessageCommand command,
Location location) throws IOException {
StoredDestination sd = getStoredDestination(command.getDestination(),
tx);
- sd.orderIndex.remove(tx, location);
- sd.messageIdIndex.remove(tx, command.getMessageId());
+ Location l = sd.messageIdIndex.remove(tx, command.getMessageId());
+ if( l!=null ) {
+ sd.orderIndex.remove(tx, l);
+ }
}
private void updateIndex(Transaction tx, KahaRemoveDestinationCommand
command, Location location) throws IOException {