Allow segmented journal to flush periodically Flushes to disk end up dominating our use of disk resources, as we issue a flush after each write. This is not entirely efficient, as we may have multiple outstanding writes in the actor queue -- and we ignore the batching opportunity. This patch makes it possible to configure an upper bound of the number of outstanding bytes written which can remainin unflushed. We flush whenever we reach this watermark or when we flush all messages that have been submitted at the time the flush batch has been started. JIRA: CONTROLLER-2108 Change-Id: I6f18de7871c89b5feffecc71580e1f440024f2a3 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
JournalReader is not an Iterator Iterator dictating a two method API, which is not quite appropriate, as the writer could be manipulated between hasNext() and next() methods -- and next() has to perform validation again. Introduce JournalReader.tryNext(), which returns a @Nullable Indexed -- either the next entry (as next()), or null (indicating !hasNext() case). JIRA: CONTROLLER-2106 Change-Id: Ie0338a9869ece8e6381ae719a29e97fd569b442f Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Hide SegmentedJournal{Reader,Writer} These classes are define by Journal{Reader,Writer} interfaces, hide them as they are pure implementation details. JIRA: CONTROLLER-2098 Change-Id: I1149b970001cb64ffe503f128cce3864e396280a Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Rename DataJournalEntrySerializer DataJournalEntrySerdes is the proper name, use that. JIRA: CONTROLLER-2089 Change-Id: I53247f7b226ed7ab0ff42ac24ad6f4d549e5db97 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Modernize sal-akka-segmented-journal Use local variable type inference, instanceof patterns and seal DataJournalEntry. JIRA: CONTROLLER-2089 Change-Id: I3c2ee2de5eaae6874e2f75a44dfd6fce0942e8ae Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Introduce atomix.storage.journal.JournalSerdes The interfaces are tightly coupled with namespace implementation, which in turn is tightly coupled to Kryo. As a first step to disconnect these three, introduce JournalSerdes, which acts as the public API implemented by Namespace. This allows us to hide atomix.utils.serializer package at least from OSGi. Change-Id: I9668ba2eb3e0a58d7ed27ee09ec1bb3cee069eb4 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Fix a few warnings Eclipse complains about unaccessed field, which we need for serialization -- fix that by exposing the class to the entire package. Also use local variable type inference to remove nullness warning. Change-Id: Ib37d8e6b5d535c68eb578a67ac980e5de370c94f Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Eliminate io.atomix.storage package This package hosts only two classes, move them to storage.journal and tighten Export-Package instruction. JIRA: CONTROLLER-2071 Change-Id: Ifdd0c7a8dff5fb310d4a44d2e0c3dd71033689ab Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Improve SegmentedJournalActor logging Log timing around journal open and each write message. Also include the number of bytes written in each message, so there is a correlation. JIRA: CONTROLLER-2043 Change-Id: I27bb6bc6edf0baf4ec0b3ec0d07f6bfd1adf867e Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Correct tracing arguments We have arguments switched around, resulting in a confusing message. Fix that up. JIRA: CONTROLLER-2043 Change-Id: I7f99b8665a1790aa9fd9d5607bfb44c69cf2a03d Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Add more tracing to DataJournalV0 We seem to have a problem with completing a specific write, add a few more traces to try to pin the problem down. JIRA: CONTROLLER-2043 Change-Id: I9efb37fd40e48ff81c988da7edcb0ae0010f7baf Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Update DataJournal interface The interface is not documented and we need to differentiate between indices as viewed from segmented journal and the persistence journal views. JIRA: CONTROLLER-1954 Change-Id: Ibbc384b88f8d5567e9af18d83b9a84f7c9b9634c Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Add a segmented DataJournal abstraction We are going to change the way we organize journal entries within a segmented file. Add DataJournal abstraction which exposes a unified interface towards the SegmentedJournalActor. Current implementation is split out from SegmentedJournalActor as DataJournalV0. JIRA: CONTROLLER-1954 Change-Id: I0d1de42b22e75610d0434548483091e3359123e4 Signed-off-by: Robert Varga <robert.varga@pantheon.tech>