Skip to content

Conversation

@sadanand48
Copy link
Contributor

@sadanand48 sadanand48 commented Jul 10, 2023

What changes were proposed in this pull request?

Distcp using snapshots fails due to incorrect toSnapshot name. The string used to represent current FS state should be an empty string instead of "."

Check https://github.com/apache/hadoop/blob/4e699f0383590d6c72cb3ee2294da29a4945922f/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpSync.java#L373 for reference.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-8968

How was this patch tested?

Tested manually

@sadanand48 sadanand48 changed the title [Snapshot] HDDS-8968. Distcp using snapshots fails due to incorrect toSnapshot name. HDDS-8968. [Snapshot] Distcp using snapshots fails due to incorrect toSnapshot name. Jul 10, 2023
@sadanand48 sadanand48 requested a review from prashantpogde July 11, 2023 09:44
Copy link
Member

@ayushtkn ayushtkn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt around the existing code itself, why this check and takeTemporarySnapshot stuff is there only for toSnapshot, but not for fromSnapshot?
In HDFS

getSnapshotDiffReport(dir, "", "s1");

is a valid case AFAIK, Distcp also has rdiff which would create issue in similar situation if fromSnapshot stuff isn't handled.

distcp has specific checks as well for fromSnapshot to be current dir
https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpSync.java#L132-L139

@sadanand48
Copy link
Contributor Author

I doubt around the existing code itself, why this check and takeTemporarySnapshot stuff is there only for toSnapshot, but not for fromSnapshot?

Thanks @ayushtkn for the review , updated the patch.

Copy link
Member

@ayushtkn ayushtkn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor stuff, rest looks good

Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sadanand48 Given few minor comments, please check

// & the toSnapshot
takeTemporaryFromSnapshot = true;
fromSnapshot = createSnapshot(snapshotDir.toString(),
"temp" + "-from-" + SnapshotInfo.generateName(Time.now()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if multiple snapshot diff running, can this still be unique?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated code using uuid now.

Copy link
Member

@ayushtkn ayushtkn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have anything further. So, once the build & others are happy, it is good from my side.
Changes LGTM

Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sadanand48 LGTM +1

@sumitagrawl sumitagrawl merged commit c4d9456 into apache:master Jul 13, 2023
OzoneFSUtils.generateUniqueTempSnapshotName());
}
if (fromSnapshot.isEmpty()) {
// empty fromSnapshot implies diff b/w the current state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sadanand48 we don't support snapshot diff b/w snapshots where fromSnapshot is more recent than toSnapshot? Is there a use case for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants