HDFS-10875. Optimize du -x to cache intermediate result. Contributed by Xiao Chen.
(cherry picked from commit e52d6e7a46
)
This commit is contained in:
parent
900dc70a01
commit
e7daeea711
|
@ -630,14 +630,15 @@ public class INodeDirectory extends INodeWithAdditionalFields
|
||||||
ContentSummaryComputationContext summary) {
|
ContentSummaryComputationContext summary) {
|
||||||
final DirectoryWithSnapshotFeature sf = getDirectoryWithSnapshotFeature();
|
final DirectoryWithSnapshotFeature sf = getDirectoryWithSnapshotFeature();
|
||||||
if (sf != null && snapshotId == Snapshot.CURRENT_STATE_ID) {
|
if (sf != null && snapshotId == Snapshot.CURRENT_STATE_ID) {
|
||||||
|
final ContentCounts counts = new ContentCounts.Builder().build();
|
||||||
// if the getContentSummary call is against a non-snapshot path, the
|
// if the getContentSummary call is against a non-snapshot path, the
|
||||||
// computation should include all the deleted files/directories
|
// computation should include all the deleted files/directories
|
||||||
sf.computeContentSummary4Snapshot(summary.getBlockStoragePolicySuite(),
|
sf.computeContentSummary4Snapshot(summary.getBlockStoragePolicySuite(),
|
||||||
summary.getCounts());
|
counts);
|
||||||
// Also compute ContentSummary for snapshotCounts (So we can extract it
|
summary.getCounts().addContents(counts);
|
||||||
|
// Also add ContentSummary to snapshotCounts (So we can extract it
|
||||||
// later from the ContentSummary of all).
|
// later from the ContentSummary of all).
|
||||||
sf.computeContentSummary4Snapshot(summary.getBlockStoragePolicySuite(),
|
summary.getSnapshotCounts().addContents(counts);
|
||||||
summary.getSnapshotCounts());
|
|
||||||
}
|
}
|
||||||
final DirectoryWithQuotaFeature q = getDirectoryWithQuotaFeature();
|
final DirectoryWithQuotaFeature q = getDirectoryWithQuotaFeature();
|
||||||
if (q != null && snapshotId == Snapshot.CURRENT_STATE_ID) {
|
if (q != null && snapshotId == Snapshot.CURRENT_STATE_ID) {
|
||||||
|
|
Loading…
Reference in New Issue