XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.12, 1.4
    • Component/s: segmentmk
    • Labels:

      Description

      At about 1kLOC and dozens of methods, the SegmentWriter class currently a bit too complex for one of the key components of the TarMK. It also uses a somewhat non-obvious mix of synchronized and unsynchronized code to coordinate multiple concurrent threads that may be writing content at the same time. The synchronization blocks are also broader than what really would be needed, which in some cases causes unnecessary lock contention in concurrent write loads.

      To improve the readability and maintainability of the code, and to increase performance of concurrent writes, it would be useful to split part of the SegmentWriter functionality to a separate RecordWriter class that would be responsible for writing individual records into a segment. The SegmentWriter.prepare() method would return a new RecordWriter instance, and the higher-level SegmentWriter methods would use the returned instance for all the work that's currently guarded in synchronization blocks.

        Attachments

        1. record-writers-v0.patch
          38 kB
          Alex Deparvu
        2. record-writers-v1.patch
          39 kB
          Alex Deparvu
        3. record-writers-v2.patch
          41 kB
          Alex Deparvu

          Issue Links

            Activity

              People

              • Assignee:
                stillalex Alex Deparvu
                Reporter:
                jukkaz Jukka Zitting
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: