-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HDFS-16091. WebHDFS should support getSnapshotDiffReportListing. #3374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b0ccd22
HDFS-16091. WebHDFS should support getSnapshotDiffReportListing.
iwasakims c91b068
added snapshotDiffReportListing params to router WebHDFS method.
iwasakims cd78961
set low dfs.namenode.snapshotdiff.listing.limit in order to cover the…
iwasakims 3d601ac
addressed javac and checkstyle warnings.
iwasakims 8b46420
moved common method to util class.
iwasakims f28da90
moved common getSnapshotDiffReport logic to util class.
iwasakims File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,6 @@ | |
| import java.util.EnumSet; | ||
| import java.util.HashSet; | ||
| import java.util.List; | ||
| import java.util.Locale; | ||
| import java.util.Map; | ||
| import java.util.Optional; | ||
| import java.util.Set; | ||
|
|
@@ -63,7 +62,6 @@ | |
| import org.apache.hadoop.crypto.key.KeyProviderTokenIssuer; | ||
| import org.apache.hadoop.fs.BlockLocation; | ||
| import org.apache.hadoop.fs.CommonConfigurationKeys; | ||
| import org.apache.hadoop.fs.CommonPathCapabilities; | ||
| import org.apache.hadoop.fs.ContentSummary; | ||
| import org.apache.hadoop.fs.CreateFlag; | ||
| import org.apache.hadoop.fs.DelegationTokenRenewer; | ||
|
|
@@ -78,7 +76,6 @@ | |
| import org.apache.hadoop.fs.GlobalStorageStatistics.StorageStatisticsProvider; | ||
| import org.apache.hadoop.fs.MultipartUploaderBuilder; | ||
| import org.apache.hadoop.fs.QuotaUsage; | ||
| import org.apache.hadoop.fs.PathCapabilities; | ||
| import org.apache.hadoop.fs.StorageStatistics; | ||
| import org.apache.hadoop.fs.StorageType; | ||
| import org.apache.hadoop.fs.impl.FileSystemMultipartUploaderBuilder; | ||
|
|
@@ -105,6 +102,7 @@ | |
| import org.apache.hadoop.hdfs.protocol.HdfsConstants; | ||
| import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; | ||
| import org.apache.hadoop.hdfs.protocol.SnapshotDiffReport; | ||
| import org.apache.hadoop.hdfs.protocol.SnapshotDiffReportListing; | ||
| import org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus; | ||
| import org.apache.hadoop.hdfs.protocol.SnapshotStatus; | ||
| import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.FileEncryptionInfoProto; | ||
|
|
@@ -1445,19 +1443,45 @@ public void renameSnapshot(final Path path, final String snapshotOldName, | |
| new SnapshotNameParam(snapshotNewName)).run(); | ||
| } | ||
|
|
||
| private SnapshotDiffReport getSnapshotDiffReport( | ||
| final String snapshotDir, final String fromSnapshot, final String toSnapshot) | ||
| throws IOException { | ||
| return new FsPathResponseRunner<SnapshotDiffReport>( | ||
| GetOpParam.Op.GETSNAPSHOTDIFF, | ||
| new Path(snapshotDir), | ||
| new OldSnapshotNameParam(fromSnapshot), | ||
| new SnapshotNameParam(toSnapshot)) { | ||
| @Override | ||
| SnapshotDiffReport decodeResponse(Map<?, ?> json) { | ||
| return JsonUtilClient.toSnapshotDiffReport(json); | ||
| } | ||
| }.run(); | ||
| } | ||
|
|
||
| private SnapshotDiffReportListing getSnapshotDiffReportListing( | ||
| String snapshotDir, final String fromSnapshot, final String toSnapshot, | ||
| byte[] startPath, int index) throws IOException { | ||
| return new FsPathResponseRunner<SnapshotDiffReportListing>( | ||
| GetOpParam.Op.GETSNAPSHOTDIFFLISTING, | ||
| new Path(snapshotDir), | ||
| new OldSnapshotNameParam(fromSnapshot), | ||
| new SnapshotNameParam(toSnapshot), | ||
| new SnapshotDiffStartPathParam(DFSUtilClient.bytes2String(startPath)), | ||
| new SnapshotDiffIndexParam(index)) { | ||
| @Override | ||
| SnapshotDiffReportListing decodeResponse(Map<?, ?> json) { | ||
| return JsonUtilClient.toSnapshotDiffReportListing(json); | ||
| } | ||
| }.run(); | ||
| } | ||
|
|
||
| public SnapshotDiffReport getSnapshotDiffReport(final Path snapshotDir, | ||
|
||
| final String fromSnapshot, final String toSnapshot) throws IOException { | ||
| statistics.incrementReadOps(1); | ||
| storageStatistics.incrementOpCounter(OpType.GET_SNAPSHOT_DIFF); | ||
| final HttpOpParam.Op op = GetOpParam.Op.GETSNAPSHOTDIFF; | ||
| return new FsPathResponseRunner<SnapshotDiffReport>(op, snapshotDir, | ||
| new OldSnapshotNameParam(fromSnapshot), | ||
| new SnapshotNameParam(toSnapshot)) { | ||
| @Override | ||
| SnapshotDiffReport decodeResponse(Map<?, ?> json) { | ||
| return JsonUtilClient.toSnapshotDiffReport(json); | ||
| } | ||
| }.run(); | ||
| return DFSUtilClient.getSnapshotDiffReport( | ||
| snapshotDir.toUri().getPath(), fromSnapshot, toSnapshot, | ||
| this::getSnapshotDiffReport, this::getSnapshotDiffReportListing); | ||
| } | ||
|
|
||
| public SnapshottableDirectoryStatus[] getSnapshottableDirectoryList() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.