Search code examples
jmshornetqjournal

Removal of hornetq journal files in JMS


I know there is a similar question asnwered already, but I would need some clarification on the case.

I'm sorry if I bring up this rather old topic, but that question is the only hook I find in the entire web.

Let's imagine the journal directory of my JMS is full of old crap I need to get rid of (hornetq-data-$id.hq files n months old, still lingering there after a disaster) and I know (happened, on another system) that when the jms will restart all that content will be streamed out with troubling consequences.

Let's also imagine that I cannot stop the jms and the restart will be made in an automated fashion I am not allowed to interfere with.

My question is, if I delete those old files (not the entire directory, just the ones from months ago) with a simple 'rm' will it cause any trouble (e.g. there is an indexing that will go awry) or will I simply lose those messages (which I no longer care about, so it is ok)?


Solution

  • I would expect it to cause trouble, even potentially stopping the broker. The journal is an integral part of the broker and any I/O operation failure with the journal will be deemed "critical" and will result in a broker shut-down.

    Furthermore, the journal files are reused in a cyclical fashion so it's highly unlikely that all of the messages you want to delete are located in specific journal files without any messages you'd want to keep. To reiterate, you should not remove any journal files. Simply use the management API. It will allow you to remove messages from individual queues. You can delete all the messages from a particular queue or supply a filter to selectively delete certain messages. You can use this via JMX or management messages (i.e. specially constructed JMS messages sent to the management address).