[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Journal Cleanup and Journal Compactor
clebert.suconic@jboss.com
do-not-reply at jboss.com
Tue Jun 23 11:58:47 EDT 2009
This is what I have been doing on the journal compacting.
- I first need to elect what files will be compacted. This needs to be a sequential list, starting at the first file. But I can't compact a file with pending transactions as I don't know if the user will later decide for a rollback or not.
- I have created another field on the Header with a orderID. The JournalFile now has a fileID and a orderID. (fileID will be aways equals to orderID with the exception on compacting files).
- I open a file with the same orderID as the first file on the journal.
(create or open, getting it from the list of available files).
- I open a transaction on the that file, and I add a record stating that I am compacting files (with the list of fileID)
- As I read the files, I add the valid records at the compacting output. When I'm done I commit the transaction at the compacting output.
I keep opening files over demand (getting them from the available files list, or creating over demand)
- If the server crash now, I will have the compacting record stating there are files that need to be deleted (reload will handle that also)
- I now delete the old files (delete here means.. putting them back to available files).
- As soon as all the files are deleted, I can delete the compacting record within the transaction.
By using the transaction approach we already have in the journal, will simplify things, as we won't need any temporary files.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239482#4239482
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239482
More information about the jboss-dev-forums
mailing list