Initial size of the Chronicle Vanilla Queue

39 views
Skip to first unread message

Dmitry Shilovich

unread,
Dec 19, 2015, 6:06:15 AM12/19/15
to Chronicle
Hi.
My question is about Chronicle.size() after process restart. Situation:

1) I create a Chronicle and Appender.
2) Append 2 items
3) Close Apender, Chronicle and stop process.
4) Start process again and expect Chronicle.size() to return 2, but it returns 0. It's because size() is based on lastWrittenIndex which is always initialized to -1 on startup.
And only after single append size() returns correct value.

There is lastIndex() method which scans the underlying data and returns the correct size = 2. So why don't initialize value of lastWrittenIndex field to result of the call lastIndex()?
Does this makes sense?

And another question about the fact that size() returns very huge long values even if the size is very small. For example, if i append 1 item size() returns 18458601207103489. 
I have to cast long to int to get normal value. Is this by design?

Thank you.
Reply all
Reply to author
Forward
0 new messages