jojochuang commented on code in PR #7988:
URL: https://github.com/apache/ozone/pull/7988#discussion_r2072456869
##########
hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/snapshot/InfoSnapshotHandler.java:
##########
@@ -50,12 +56,19 @@ protected void execute(OzoneClient client, OzoneAddress
address)
String volumeName = snapshotPath.getValue().getVolumeName();
String bucketName = snapshotPath.getValue().getBucketName();
- OzoneSnapshot ozoneSnapshot = client.getObjectStore()
- .getSnapshotInfo(volumeName, bucketName, snapshotName);
+ OzoneSnapshot ozoneSnapshot;
+ if (StringUtils.isEmpty(omNodeId)) {
Review Comment:
is there a test to validate that when omNodeId is empty, it is routed to the
leader OM;
and a test to validate that if omNodeId is non-empty:
(1) error out if omNodeId is not valid.
(2) if OM is old version, reject.
(3) if omNodeId is the leader it should work just as if omNodeId is empty.
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -1009,14 +1009,29 @@ public void deleteSnapshot(String volumeName,
public OzoneSnapshot getSnapshotInfo(String volumeName,
String bucketName,
String snapshotName) throws IOException
{
+ return getSnapshotInfo(volumeName, bucketName, snapshotName, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public OzoneSnapshot getSnapshotInfo(String volumeName,
+ String bucketName,
+ String snapshotName,
+ String omNodeId) throws IOException {
Preconditions.checkArgument(StringUtils.isNotBlank(volumeName),
"volume can't be null or empty.");
Preconditions.checkArgument(StringUtils.isNotBlank(bucketName),
"bucket can't be null or empty.");
Preconditions.checkArgument(StringUtils.isNotBlank(snapshotName),
"snapshot name can't be null or empty.");
+ if (StringUtils.isNotBlank(omNodeId) &&
+ omVersion.compareTo(OzoneManagerVersion.SNAPSHOT_READ_FROM_NON_LEADER)
< 0) {
+ throw new IOException("OzoneManager does not support snapshot read from
non-leader OM.");
Review Comment:
I wonder if UnsupportedOperationException is more appropriate.
##########
hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/snapshot/SnapshotDiffHandler.java:
##########
@@ -91,6 +92,11 @@ public class SnapshotDiffHandler extends Handler {
description = "Format output as JSON")
private boolean json;
+ @CommandLine.Option(
+ names = {"-n", "--om-node-id"},
Review Comment:
this is an optional field.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]