Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static SnapshotDiffReportOzone fromProtobuf(
report.getDiffListList().stream()
.map(SnapshotDiffReportOzone::fromProtobufDiffReportEntry)
.collect(Collectors.toList()),
report.getToken());
report.hasToken() ? report.getToken() : null);
}

public static DiffType fromProtobufDiffType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.hadoop.ozone.om.snapshot;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.apache.commons.lang3.StringUtils.leftPad;
import static org.apache.hadoop.hdds.HddsConfigKeys.HDDS_DB_PROFILE;
import static org.apache.hadoop.ozone.OzoneAcl.AclScope.DEFAULT;
Expand Down Expand Up @@ -2092,7 +2093,6 @@ public void testSnapshotDiffWhenOmRestartAndReportIsPartiallyFetched()
bucketName, snapshot1, snapshot2, null, pageSize);

List<DiffReportEntry> diffReportEntries = diffReport.getDiffList();
String nextToken = diffReport.getToken();

// Restart the OM and no need to wait because snapDiff job finished before
// the restart.
Expand All @@ -2101,11 +2101,10 @@ public void testSnapshotDiffWhenOmRestartAndReportIsPartiallyFetched()
await(POLL_MAX_WAIT_MILLIS, POLL_INTERVAL_MILLIS,
() -> cluster.getOzoneManager().isRunning());

while (nextToken == null || !nextToken.isEmpty()) {
while (isNotEmpty(diffReport.getToken())) {
diffReport = fetchReportPage(volumeName, bucketName, snapshot1,
snapshot2, nextToken, pageSize);
snapshot2, diffReport.getToken(), pageSize);
diffReportEntries.addAll(diffReport.getDiffList());
nextToken = diffReport.getToken();
}
assertEquals(100, diffReportEntries.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ public SnapshotDiffReport getSnapshotDiffReport(Path snapshotDir,
SnapshotDiffReportOzone report =
getSnapshotDiffReportOnceComplete(fromSnapshot, toSnapshot, "");
aggregated = report;
while (!report.getToken().isEmpty()) {
while (StringUtils.isNotEmpty(report.getToken())) {
LOG.info(
"Total Snapshot Diff length between snapshot {} and {} exceeds"
+ " max page size, Performing another " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ public SnapshotDiffReport getSnapshotDiffReport(Path snapshotDir,
getSnapshotDiffReportOnceComplete(fromSnapshot, toSnapshot, volume,
bucket, "");
aggregated = report;
while (!report.getToken().isEmpty()) {
while (StringUtils.isNotEmpty(report.getToken())) {
LOG.info(
"Total Snapshot Diff length between snapshot {} and {} exceeds"
+ " max page size, Performing another" +
Expand Down