core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java
private void readNameIdMapV2() throws IOException, InterruptedException {
    nameIdMap.clear();

    long localFileCounter = -1;

    nameIdMapHolder.position(0);

    NameFileIdEntry nameFileIdEntry;

    final Map<Integer, String> idFileNameMap = new HashMap<>(1_000);

    while ((nameFileIdEntry = readNextNameIdEntryV2()) != null) {
      final long absFileId = Math.abs(nameFileIdEntry.fileId);

      if (localFileCounter < absFileId) {
        localFileCounter = absFileId;
      }

      nameIdMap.put(nameFileIdEntry.name, nameFileIdEntry.fileId);

      if (nameFileIdEntry.fileId >= 0) {
        idNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.name);
      }

      idFileNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.fileSystemName);
    }

    if (localFileCounter > 0 && nextInternalId < localFileCounter) {
      nextInternalId = (int) localFileCounter;
    }

    for (final Map.Entry<String, Integer> nameIdEntry : nameIdMap.entrySet()) {
      final int fileId = nameIdEntry.getValue();

      if (fileId >= 0) {
        final long externalId = composeFileId(id, nameIdEntry.getValue());

        if (files.get(externalId) == null) {
          final Path path = storagePath.resolve(idFileNameMap.get((nameIdEntry.getValue())));
          final OFileClassic fileClassic = new OFileClassic(path);

          if (fileClassic.exists()) {
            fileClassic.open();
            files.add(externalId, fileClassic);
          } else {
            nameIdMap.put(nameIdEntry.getKey(), -fileId);
            idNameMap.remove(fileId);
          }
        }
      }
    }
  }
private void readNameIdMapV2() throws IOException, InterruptedException {
    nameIdMap.clear();

    long localFileCounter = -1;

    nameIdMapHolder.position(0);

    NameFileIdEntry nameFileIdEntry;

    final Map<Integer, String> idFileNameMap = new HashMap<>(1_000);

    while ((nameFileIdEntry = readNextNameIdEntryV2()) != null) {
      final long absFileId = Math.abs(nameFileIdEntry.fileId);

      if (localFileCounter < absFileId) {
        localFileCounter = absFileId;
      }

      nameIdMap.put(nameFileIdEntry.name, nameFileIdEntry.fileId);

      if (nameFileIdEntry.fileId >= 0) {
        idNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.name);
      }

      idFileNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.fileSystemName);
    }

    if (localFileCounter > 0 && nextInternalId < localFileCounter) {
      nextInternalId = (int) localFileCounter;
    }

    for (final Map.Entry<String, Integer> nameIdEntry : nameIdMap.entrySet()) {
      final int fileId = nameIdEntry.getValue();

      if (fileId >= 0) {
        final long externalId = composeFileId(id, nameIdEntry.getValue());

        if (files.get(externalId) == null) {
          final Path path = storagePath.resolve(idFileNameMap.get((nameIdEntry.getValue())));
          final OFileClassic fileClassic = new OFileClassic(path);

          if (fileClassic.exists()) {
            fileClassic.open();
            files.add(externalId, fileClassic);
          } else {
            nameIdMap.put(nameIdEntry.getKey(), -fileId);
            idNameMap.remove(fileId);
          }
        }
      }
    }
  }
private void readNameIdMapV2 ( ) throws IOException , InterruptedException { nameIdMap . clear ( ) ; long localFileCounter = - 1 ; nameIdMapHolder . position ( 0 ) ; NameFileIdEntry nameFileIdEntry ; final Map < Integer , String > idFileNameMap = new HashMap <> ( 1_000 ) ; while ( ( nameFileIdEntry = readNextNameIdEntryV2 ( ) ) != null ) { final long absFileId = Math . abs ( nameFileIdEntry . fileId ) ; if ( localFileCounter < absFileId ) { localFileCounter = absFileId ; } nameIdMap . put ( nameFileIdEntry . name , nameFileIdEntry . fileId ) ; if ( nameFileIdEntry . fileId >= 0 ) { idNameMap . put ( nameFileIdEntry . fileId , nameFileIdEntry . name ) ; } idFileNameMap . put ( nameFileIdEntry . fileId , nameFileIdEntry . fileSystemName ) ; } if ( localFileCounter > 0 && nextInternalId < localFileCounter ) { nextInternalId = ( int ) localFileCounter ; } for ( final Map . Entry < String , Integer > nameIdEntry : nameIdMap . entrySet ( ) ) { final int fileId = nameIdEntry . getValue ( ) ; if ( fileId >= 0 ) { final long externalId = composeFileId ( id , nameIdEntry . getValue ( ) ) ; if ( files . get ( externalId ) == null ) { final Path path = storagePath . resolve ( idFileNameMap . get ( ( nameIdEntry . getValue ( ) ) ) ) ; final OFileClassic fileClassic = new OFileClassic ( path ) ; if ( fileClassic . exists ( ) ) { fileClassic . open ( ) ; files . add ( externalId , fileClassic ) ; } else { nameIdMap . put ( nameIdEntry . getKey ( ) , - fileId ) ; idNameMap . remove ( fileId ) ; } } } } }
Read information about files are registered inside of write cache/storage
File consist of rows of variable length which contains following entries: <ol> <li>Internal file id, may be positive or
negative depends on whether file is removed or not</li> <li>Name of file inside of write cache, this name is case
sensitive</li> <li>Name of file which is used inside file system it can be different from name of file used inside write
cache</li> </ol>
Read information about files are registered inside of write cache / storage File consist of rows of variable length which contains following entries : <ol > <li > Internal file id may be positive or negative depends on whether file is removed or not< / li > <li > Name of file inside of write cache this name is case sensitive< / li > <li > Name of file which is used inside file system it can be different from name of file used inside write cache< / li > < / ol >