resolve issue with page file recovery replaying write buffer at wrong offest, also have schedualler flush writes on new store creation, issue visible with unclean shutdown - https://issues.apache.org/activemq/browse/AMQ-2935

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1004600 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-10-05 10:15:32 +00:00
parent 667f26a155
commit c94b4075e9
2 changed files with 3 additions and 3 deletions

View File

@ -201,6 +201,7 @@ public class JobSchedulerStore extends ServiceSupport {
if (isStarted()) { if (isStarted()) {
result.start(); result.start();
} }
this.pageFile.flush();
} }
return result; return result;
} }

View File

@ -335,7 +335,7 @@ public class PageFile {
loadFreeList(); loadFreeList();
} }
} else { } else {
LOG.debug("Recovering page file..."); LOG.debug(toString() + ", Recovering page file...");
nextTxid.set(redoRecoveryUpdates()); nextTxid.set(redoRecoveryUpdates());
// Scan all to find the free pages. // Scan all to find the free pages.
@ -1107,8 +1107,7 @@ public class PageFile {
// Re-apply all the writes in the recovery buffer. // Re-apply all the writes in the recovery buffer.
for (Map.Entry<Long, byte[]> e : batch.entrySet()) { for (Map.Entry<Long, byte[]> e : batch.entrySet()) {
writeFile.seek(e.getKey()); writeFile.seek(toOffset(e.getKey()));
e.getValue();
writeFile.write(e.getValue()); writeFile.write(e.getValue());
} }