/** * @return the ufs configuration to use for the journal operations */ protected static UnderFileSystemConfiguration getJournalUfsConf() { Map<String, String> ufsConf = Configuration.getNestedProperties(PropertyKey.MASTER_JOURNAL_UFS_OPTION); return UnderFileSystemConfiguration.defaults().setUserSpecifiedConf(ufsConf); }
/** * @return the instance of under file system for Alluxio root directory */ public static UnderFileSystem createForRoot() { String ufsRoot = Configuration.get(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS); boolean readOnly = Configuration.getBoolean(PropertyKey.MASTER_MOUNT_TABLE_ROOT_READONLY); boolean shared = Configuration.getBoolean(PropertyKey.MASTER_MOUNT_TABLE_ROOT_SHARED); Map<String, String> ufsConf = Configuration.getNestedProperties(PropertyKey.MASTER_MOUNT_TABLE_ROOT_OPTION); return create(ufsRoot, UnderFileSystemConfiguration.defaults().setReadOnly(readOnly) .setShared(shared).setUserSpecifiedConf(ufsConf)); } }
@Override public UfsClient getRoot() { synchronized (this) { if (mRootUfsClient == null) { String rootUri = Configuration.get(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS); boolean rootReadOnly = Configuration.getBoolean(PropertyKey.MASTER_MOUNT_TABLE_ROOT_READONLY); boolean rootShared = Configuration.getBoolean(PropertyKey.MASTER_MOUNT_TABLE_ROOT_SHARED); Map<String, String> rootConf = Configuration.getNestedProperties(PropertyKey.MASTER_MOUNT_TABLE_ROOT_OPTION); addMount(IdUtils.ROOT_MOUNT_ID, new AlluxioURI(rootUri), UnderFileSystemConfiguration.defaults().setReadOnly(rootReadOnly).setShared(rootShared) .setUserSpecifiedConf(rootConf)); try { mRootUfsClient = get(IdUtils.ROOT_MOUNT_ID); } catch (NotFoundException | UnavailableException e) { throw new RuntimeException("We should never reach here", e); } } return mRootUfsClient; } }
@Override public void resetState() { mInodeTree.reset(); String rootUfsUri = Configuration.get(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS); Map<String, String> rootUfsConf = Configuration.getNestedProperties(PropertyKey.MASTER_MOUNT_TABLE_ROOT_OPTION); mMountTable.clear(); // Initialize the root mount if it doesn't exist yet. if (!mMountTable.isMountPoint(new AlluxioURI(MountTable.ROOT))) { try (CloseableResource<UnderFileSystem> ufsResource = mUfsManager.getRoot().acquireUfsResource()) { // The root mount is a part of the file system master's initial state. The mounting is not // journaled, so the root will be re-mounted based on configuration whenever the master // starts. long rootUfsMountId = IdUtils.ROOT_MOUNT_ID; mMountTable.add(new AlluxioURI(MountTable.ROOT), new AlluxioURI(rootUfsUri), rootUfsMountId, MountOptions.defaults() .setShared(ufsResource.get().isObjectStorage() && Configuration .getBoolean(PropertyKey.UNDERFS_OBJECT_STORE_MOUNT_SHARED_PUBLICLY)) .setProperties(rootUfsConf)); } catch (FileAlreadyExistsException | InvalidPathException e) { throw new IllegalStateException(e); } } }