|
8 | 8 |
|
9 | 9 | package org.elasticsearch.common.blobstore.fs;
|
10 | 10 |
|
| 11 | +import org.apache.logging.log4j.LogManager; |
| 12 | +import org.apache.logging.log4j.Logger; |
| 13 | +import org.apache.lucene.util.Constants; |
11 | 14 | import org.elasticsearch.common.UUIDs;
|
12 | 15 | import org.elasticsearch.common.blobstore.BlobContainer;
|
13 | 16 | import org.elasticsearch.common.blobstore.BlobPath;
|
|
19 | 22 | import org.elasticsearch.common.io.Streams;
|
20 | 23 | import org.elasticsearch.core.CheckedConsumer;
|
21 | 24 | import org.elasticsearch.core.IOUtils;
|
| 25 | +import org.elasticsearch.core.Strings; |
22 | 26 |
|
23 | 27 | import java.io.FileNotFoundException;
|
24 | 28 | import java.io.IOException;
|
25 | 29 | import java.io.InputStream;
|
26 | 30 | import java.io.OutputStream;
|
27 | 31 | import java.nio.channels.Channels;
|
28 | 32 | import java.nio.channels.SeekableByteChannel;
|
| 33 | +import java.nio.file.AccessDeniedException; |
29 | 34 | import java.nio.file.DirectoryStream;
|
30 | 35 | import java.nio.file.FileAlreadyExistsException;
|
31 | 36 | import java.nio.file.FileVisitResult;
|
|
53 | 58 | */
|
54 | 59 | public class FsBlobContainer extends AbstractBlobContainer {
|
55 | 60 |
|
| 61 | + private static final Logger logger = LogManager.getLogger(FsBlobContainer.class); |
| 62 | + |
56 | 63 | private static final String TEMP_FILE_PREFIX = "pending-";
|
57 | 64 |
|
58 | 65 | protected final FsBlobStore blobStore;
|
@@ -94,7 +101,12 @@ public Map<String, BlobMetadata> listBlobsByPrefix(String blobNamePrefix) throws
|
94 | 101 | try {
|
95 | 102 | attrs = Files.readAttributes(file, BasicFileAttributes.class);
|
96 | 103 | } catch (FileNotFoundException | NoSuchFileException e) {
|
97 |
| - // The file was concurrently deleted between listing files and trying to get its attributes so we skip it here |
| 104 | + // The file was concurrently deleted trying to get its attributes so we skip it here |
| 105 | + continue; |
| 106 | + } catch (AccessDeniedException e) { |
| 107 | + // The file became inaccessible for some reason, possibly an artefact of concurrent deletion (Windows?): warn and skip |
| 108 | + logger.warn(Strings.format("file [%s] became inaccessible while listing [%s/%s]", file, path, blobNamePrefix), e); |
| 109 | + assert Constants.WINDOWS : e; |
98 | 110 | continue;
|
99 | 111 | }
|
100 | 112 | if (attrs.isRegularFile()) {
|
|
0 commit comments