Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-2098

Refactor Journal{Reader,Writer} class hierarchy

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 7.0.12, 8.0.5, 9.0.1
    • None
    • clustering

      Navigating through the implementation details is rather daunting, as there are four implementations of JournalWriter:

      1. SegmentedJournalWriter, given out via SegmentedJournalWriter.openWriter()
      2. MappableJournalSegmentWriter, used by JournalSegment, which forwards requests to one of
      3. FileChannelJournalSegmentWriter, used for buffered access
      4. MappedJournalSegmentWriter, used for memory-mapped access

      The same holds true for JournalReader and makes navigating the codebase rather strange, as it would seem those four are equivalent, but they are not.

      First, SegmentedJournalWriter is the only real implementation, hence it should be hosting the interface definition and be a final class.

      Second, we should have an abstract class named JournalSegmentWriter, which holds the API contract and code shared between FileChannelJournalSegmentWriter and MappedJournalSegmentWriter.

      Third, MappableJournalSegmentWriter seems to only be a lifecycle helper to deal with closing the channel, indexing and switching (potentially) mapping the file into memory. I think that class should just get integrated into JournalSegment.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: