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 @@ -831,17 +831,17 @@ public void cleanSubtree(ReclaimContext reclaimContext, int snapshot,
*
* @param context to {@link ReclaimContext#getSnapshotIdToBeDeleted()}
*/
private boolean shouldDestroy(ReclaimContext context) {
private void shouldDestroy(ReclaimContext context) {
final int snapshotToBeDeleted = context.getSnapshotIdToBeDeleted();
if (dstSnapshotId < snapshotToBeDeleted) {
return true;
if (snapshotToBeDeleted == Snapshot.CURRENT_STATE_ID
|| snapshotToBeDeleted > dstSnapshotId) {
return;
}
LOG.warn("Try to destroy a DstReference with dstSnapshotId = {}"
+ " >= snapshotToBeDeleted = {}", dstSnapshotId, snapshotToBeDeleted);
LOG.warn(" dstRef: {}", toDetailString());
final INode r = getReferredINode().asReference().getReferredINode();
LOG.warn(" referred: {}", r.toDetailString());
return false;
}

/**
Expand All @@ -857,9 +857,7 @@ private boolean shouldDestroy(ReclaimContext context) {
*/
@Override
public void destroyAndCollectBlocks(ReclaimContext reclaimContext) {
if (!shouldDestroy(reclaimContext)) {
return;
}
shouldDestroy(reclaimContext);

// since we count everything of the subtree for the quota usage of a
// dst reference node, here we should just simply do a quota computation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public void testRenameFromSDir2NonSDir() throws Exception {

hdfs.delete(bar, false);
Assert.assertEquals(1, withCount.getReferenceCount());
restartClusterAndCheckImage(true);
}

private static boolean existsInDiffReport(List<DiffReportEntry> entries,
Expand Down Expand Up @@ -196,6 +197,7 @@ public void testRenameFileNotInSnapshot() throws Exception {
assertTrue(existsInDiffReport(entries, DiffType.MODIFY, "", null));
assertTrue(existsInDiffReport(entries, DiffType.CREATE, file2.getName(),
null));
restartClusterAndCheckImage(true);
}

/**
Expand All @@ -218,6 +220,7 @@ public void testRenameFileInSnapshot() throws Exception {
assertTrue(existsInDiffReport(entries, DiffType.MODIFY, "", null));
assertTrue(existsInDiffReport(entries, DiffType.RENAME, file1.getName(),
file2.getName()));
restartClusterAndCheckImage(true);
}

@Test (timeout=60000)
Expand Down