The way you use deleteMessages in your example will attempt to delete messages

- 1 when receiving message 1
- 1,2 when receiving message 2
- 1,2,3 when receiving message 3
- ...
- 1,2,3..n when receiving message n

resulting in (n*n + n)/2 delete operations for n messages (with n = 1000000). Even when you use permanent=false, LevelDB doesn't delete entries immediately but writes deletion markers internally, which are garbage-collected (together with the marked messages) during next compaction. I didn't look yet into LevelDB details what it does when attempting to write this huge amount of deletion markers but it may well be the reason for the observed journal growth.

Anyway, the only proper way of deleting messages in your example is to call

- deleteMessage(i) for every received message (where i is the message's sequence number) or
- deleteMessages(n) *only once* after all n messages have been received

Hope that helps.

On 09.01.14 16:24, Vadim Bobrov wrote:
Second update: with deleteMessage(sequenceNr, permanent = false) the database doesn't grow either (but I would expect it should as the messages should be preserved). Summary:

deleteMessages in any combination (permanent true or false) - database grows and doesn't shrink
deleteMessage in any combination - database stays at a constant size

On Thursday, January 9, 2014 9:40:02 AM UTC-5, Vadim Bobrov wrote:

    UPDATE: actually running deleteMessage (single) instead of
    deleteMessages did fix it. Could be a bug in deleteMessages? I am
    using 1.3-M2

    On Thursday, January 9, 2014 9:23:31 AM UTC-5, Vadim Bobrov wrote:

        Oops, I mean to add permanent = true but forgot, apologies. It
        doesn't fix the problem though. To be exact - it doesn't
        change anything, which is a bit surprising. I did read about
        leveldb compactions but coouldn't find anything that would
        have explained the growth


--
Martin Krasser

blog:    http://krasserm.blogspot.com
code:    http://github.com/krasserm
twitter: http://twitter.com/mrt1nz

--
     Read the docs: http://akka.io/docs/
     Check the FAQ: http://akka.io/faq/
     Search the archives: https://groups.google.com/group/akka-user
--- You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to