[rabbitmq-discuss] persistent messages can't survive restart with new persister b6324e288cfd (bug21673)
Matthew Sackman
matthew at lshift.net
Fri Dec 11 14:20:18 GMT 2009
Hello Anton,
This is entirely correct. When you publish a message with delivery
mode 2 you are *not* _guaranteed_ that it hits disk. Publishing is an
async operation and you get no confirmation that it goes to disk. The
new persister does very aggressive caching in order to avoid doing lots
of tiny and expensive writes. As such, there will frequently be times
where if you restart the broker, you will lose several (maybe hundreds)
of messages.
If you really want a guarantee that the message has hit disk then you
must, as with the old persister, use a transaction. When you receive the
tx.commit-ok back from the broke, you have a guarantee that the messages
have been flushed to disk and appropriate fsync's called.
Whilst this behaviour may seem different from the old persister, it is
in fact not different, it's simply that the window of time in which a
message now waits before being sent to disk is probably bigger. There is
certainly no concerted effort in either the new or old persister to
offer any sort of guarantee that messages published outside of a
transaction, with delivery mode 2, are "promptly" written to disk.
Matthew
More information about the rabbitmq-discuss
mailing list