ThinkerLei opened a new pull request, #6653: URL: https://github.com/apache/hadoop/pull/6653
In this pr , we do not consider the cases where the source directory is a symlink or involves snapshot in rename. There are currently two methods of rename, and their logic for calculating quota is as follows: rename(String src, String dst) In the method verifyQuotaForRename, we calculate the quota of the source INode using the storage policy of the target directory, without using the cached quota usage information, lastSnapshotId=Snapshot.CURRENT_STATE_ID. If the target directory exists, it will use its own storage policy to calculate its quota (in the case of an overwrite operation). In the removeSrc4OldRename method, we calculate the quota of the source INode using the storage policy of the source directory for subsequent updates to the source directory's quota, with lastSnapshotId=Snapshot.CURRENT_STATE_ID being used at this time. Of course, if the source is a symlink, using lastSnapshotId will be different. Here we do not consider the case where the source is a Symlink and the snapshot ID is not Snapshot.CURRENT_STATE_ID. In the addSourceToDestination method, we graft the source INode into the target directory, and the method of quota calculation is consistent with the verifyQuotaForRename method. In the updateQuotasInSourceTree method, if the source is a snapshot, a quota calculation is performed. This optimization does not target snapshots, so it is not considered for the time being. In the restoreSource method, if the rename fails, the source directory is restored back to its original location. At this time, the source directory's storage policy is used for the calculation. rename2(String src, String dst, Options.Rename... options) same logic like rename(String src, String dst). Its calculation logic is basically the same as rename(String src, String dst). Based on the above, without considering snapshots and Symlinks, we can reduce the source INode quota calculation at least once. When the storage policy is the same, we can save two quota calculations -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org