You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Mohit Kataria (Jira)" <ji...@apache.org> on 2020/05/29 13:39:00 UTC

[jira] [Resolved] (OAK-9094) Error message "Could not access the Lucene index" / FileNotFoundException

     [ https://issues.apache.org/jira/browse/OAK-9094?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mohit Kataria resolved OAK-9094.
--------------------------------
    Resolution: Fixed

> Error message "Could not access the Lucene index" / FileNotFoundException
> -------------------------------------------------------------------------
>
>                 Key: OAK-9094
>                 URL: https://issues.apache.org/jira/browse/OAK-9094
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>            Reporter: Mohit Kataria
>            Assignee: Mohit Kataria
>            Priority: Minor
>
> It may happen that between retrieving files from remote and evaluating size of file, the remote file may get get removed leading to IO exception. Adding a check to handle this case.
> {noformat}
> IndexSanityChecker
>     private boolean isThereASizeMismatch() throws IOException {
>         for (String fileName : remote.listAll()){
>             long localLength = DirectoryUtils.getFileLength(local, fileName);
>             long remoteLength = remote.fileLength(fileName); // <== line 81
>             //This is a weak check based on length.
>             if (localLength > 0 && localLength != remoteLength){
>                 log.warn("[{}] Found local copy for {} in {} but size of local {} differs from remote {}. ",
>                         indexPath, fileName, local, localLength, remoteLength);
>                 return true;
>             }
>             if (localLength > 0) {
>                 localDirSize += localLength;
>                 localFileCount++;
>             }
>             remoteDirSize += remoteLength;
>             remoteFileCount++;
>         }
>         return false;
>     }
> OakDirectory:
>    @Override
>     public long fileLength(String name) throws IOException {
>         NodeBuilder file = directoryBuilder.getChildNode(name);
>         if (!file.exists()) {
>             String msg = String.format("[%s] %s", indexName, name);
>             throw new FileNotFoundException(msg);
>         }
>         OakIndexInput input = new OakIndexInput(name, file, indexName, blobFactory);
>         try {
>             return input.length();
>         } finally {
>             input.close();
>         }
>     }
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)