[
https://issues.apache.org/jira/browse/OAK-9170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17190719#comment-17190719
]
Marcel Reutegger commented on OAK-9170:
---------------------------------------
I suggest a slightly modified version of the the change proposed by Julian:
{noformat}
Index:
src/main/java/org/apache/jackrabbit/oak/segment/remote/persistentcache/PersistentDiskCache.java
===================================================================
---
src/main/java/org/apache/jackrabbit/oak/segment/remote/persistentcache/PersistentDiskCache.java
(Revision 1881455)
+++
src/main/java/org/apache/jackrabbit/oak/segment/remote/persistentcache/PersistentDiskCache.java
(Arbeitskopie)
@@ -139,8 +139,11 @@
Runnable task = () -> {
if (writesPending.add(segmentId)) {
- try (FileChannel channel = new
FileOutputStream(tempSegmentFile).getChannel()) {
- int fileSize = bufferCopy.write(channel);
+ try {
+ int fileSize;
+ try (FileChannel channel = new
FileOutputStream(tempSegmentFile).getChannel()) {
+ fileSize = bufferCopy.write(channel);
+ }
try {
Files.move(tempSegmentFile.toPath(),
segmentFile.toPath(), StandardCopyOption.ATOMIC_MOVE);
} catch (AtomicMoveNotSupportedException e) {
{noformat}
> Make loading segment disk cache fail safe in case when write operation is
> interrupted by failure
> ------------------------------------------------------------------------------------------------
>
> Key: OAK-9170
> URL: https://issues.apache.org/jira/browse/OAK-9170
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: segment-tar
> Reporter: Miroslav Smiljanic
> Assignee: Andrei Dulceanu
> Priority: Major
> Fix For: 1.36.0
>
> Attachments: OAK-9170.patch
>
>
> Failure while writing the segment to disk cache, can leave content of the
> segment partially persisted. That will cause the problems when that same file
> is later loaded.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)