[BugFix] Fix local file rename in broker (#52544)

Signed-off-by: wyb <wybb86@gmail.com>
This commit is contained in:
wyb 2024-11-02 04:25:46 +08:00 committed by GitHub
parent c15d401a72
commit 6e5e5947b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -983,8 +983,12 @@ public class FileSystemManager {
public void renamePath(String srcPath, String destPath, Map<String, String> properties) {
WildcardURI srcPathUri = new WildcardURI(srcPath);
String srcAuthority = srcPathUri.getAuthority();
WildcardURI destPathUri = new WildcardURI(destPath);
if (!srcPathUri.getAuthority().trim().equals(destPathUri.getAuthority().trim())) {
String destAuthority = destPathUri.getAuthority();
// the authority of local file path is null, like file:///xxx.
// skip check when the authority is null.
if (srcAuthority != null && destAuthority != null && !srcAuthority.trim().equals(destAuthority.trim())) {
throw new BrokerException(TBrokerOperationStatusCode.TARGET_STORAGE_SERVICE_ERROR,
"only allow rename in same file system");
}