[
https://issues.apache.org/jira/browse/OAK-11154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17885302#comment-17885302
]
Nicolas Ettlin commented on OAK-11154:
--------------------------------------
PR created here: [GitHub Pull Request
#1746|https://github.com/apache/jackrabbit-oak/pull/1746]
> Support reading partial segments from SegmentWriter
> ---------------------------------------------------
>
> Key: OAK-11154
> URL: https://issues.apache.org/jira/browse/OAK-11154
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: segment-tar
> Reporter: Nicolas Ettlin
> Priority: Minor
>
> oak-segment-tar writes new segments using an implementation of SegmentWriter.
> Since segments are immutable, the state of a segment that hasn’t been flushed
> yet isn’t visible outside of the SegmentWriter instance. However, in some
> cases, code using SegmentWriter might want to access the partial segment data.
> Currently, the only possible way to do it is to call flush, which will force
> the segment to be flushed right away, and then get the full segment from the
> underlying segment store. This is bad for performance, because we need to do
> more flushes that necessary, and because there’s a risk of creating a lot of
> segments that have a size much smaller than MAX_SEGMENT_SIZE.
> To avoid this, I suggest that we add a readPartialSegmentState method to
> SegmentWriter, which takes the segment ID of an unflushed segment and returns
> it if possible. The return value would be a new data structure,
> PartialSegmentState, which would make it clear that it only contains partial
> segment data and that it is not to be confused with Segment. To make the new
> method backwards-compatible, it wouldn’t necessarily be implemented by all
> implementations of SegmentWriter, and would throw
> UnsupportedOperationException by default.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)