Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maobaolong committed Sep 4, 2023
1 parent 3bb5d25 commit 282c77a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3608,11 +3608,7 @@ public void mount(AlluxioURI alluxioPath, AlluxioURI ufsPath, MountContext conte
}
mMountTable.checkUnderWritableMountPoint(alluxioPath);

MountInfo mountInfo = mMountTable.getMountTable().get(alluxioPath);
Map<String, String> propertyMap = context.getOptions().getPropertiesMap();
if (mountInfo != null && propertyMap != null
&& Boolean.parseBoolean(propertyMap.get("remount"))) {
context.getOptions().removeProperties("remount");
if (context.getOptions().getRemount()) {
unmountInternal(rpcContext, inodePath);
}
mountInternal(rpcContext, inodePath, ufsPath, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ message MountPOptions {
map<string, string> properties = 2;
optional bool shared = 3;
optional FileSystemMasterCommonPOptions commonOptions = 4;
optional bool remount = 5;
}
message MountPRequest {
/** the path of alluxio mount point */
Expand Down
5 changes: 5 additions & 0 deletions core/transport/src/main/proto/proto.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3276,6 +3276,11 @@
"id": 4,
"name": "commonOptions",
"type": "FileSystemMasterCommonPOptions"
},
{
"id": 5,
"name": "remount",
"type": "bool"
}
],
"maps": [
Expand Down
14 changes: 12 additions & 2 deletions shell/src/main/java/alluxio/cli/fs/command/MountCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ public final class MountCommand extends AbstractFileSystemCommand {
.hasArg(false)
.desc("mount point is shared")
.build();
private static final Option REMOUNT_OPTION =
Option.builder()
.longOpt("remount")
.required(false)
.hasArg(false)
.desc("unmount and mount together")
.build();
private static final Option OPTION_OPTION =
Option.builder()
.longOpt("option")
Expand All @@ -77,7 +84,7 @@ public String getCommandName() {
@Override
public Options getOptions() {
return new Options().addOption(READONLY_OPTION).addOption(SHARED_OPTION)
.addOption(OPTION_OPTION);
.addOption(REMOUNT_OPTION).addOption(OPTION_OPTION);
}

@Override
Expand All @@ -98,6 +105,9 @@ public int run(CommandLine cl) throws AlluxioException, IOException {
if (cl.hasOption(SHARED_OPTION.getLongOpt())) {
optionsBuilder.setShared(true);
}
if (cl.hasOption(REMOUNT_OPTION.getLongOpt())) {
optionsBuilder.setRemount(true);
}
if (cl.hasOption(OPTION_OPTION.getLongOpt())) {
Properties properties = cl.getOptionProperties(OPTION_OPTION.getLongOpt());
optionsBuilder.putAllProperties(Maps.fromProperties(properties));
Expand All @@ -109,7 +119,7 @@ public int run(CommandLine cl) throws AlluxioException, IOException {

@Override
public String getUsage() {
return "mount [--readonly] [--shared] [--option <key=val>] <alluxioPath> <ufsURI>";
return "mount [--readonly] [--shared] [--remount] [--option <key=val>] <alluxioPath> <ufsURI>";
}

@Override
Expand Down

0 comments on commit 282c77a

Please sign in to comment.