Пример #1
0
  /**
   * Creates a new key-value store.
   *
   * @param path URI of the key-value store
   * @throws FileAlreadyExistsException if a key-value store URI exists
   */
  public synchronized void createStore(TachyonURI path)
      throws FileAlreadyExistsException, InvalidPathException {
    try {
      // Create this dir
      mFileSystemMaster.mkdir(
          path,
          new CreateDirectoryOptions.Builder(MasterContext.getConf()).setRecursive(true).build());
    } catch (IOException e) {
      // TODO(binfan): Investigate why mFileSystemMaster.mkdir throws IOException
      throw new InvalidPathException(
          String.format("Failed to createStore: can not create path %s", path), e);
    }
    final long fileId = mFileSystemMaster.getFileId(path);
    Preconditions.checkState(fileId != IdUtils.INVALID_FILE_ID);

    createStoreInternal(fileId);
    writeJournalEntry(newCreateStoreEntry(fileId));
    flushJournal();
  }