Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-9094

Error message "Could not access the Lucene index" / FileNotFoundException

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.32.0
    • None
    • None

    Description

      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.

      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();
              }
          }
      

       

      Attachments

        Activity

          People

            mkataria Mohit Kataria
            mkataria Mohit Kataria
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: