This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new c6f8b1b2eea [fix](repository) the exist repo_file must contails same 
name with new repo (#27668)
c6f8b1b2eea is described below

commit c6f8b1b2eea5613b318ca00d5487eac18f5b2442
Author: xueweizhang <[email protected]>
AuthorDate: Sat Dec 9 01:46:54 2023 +0800

    [fix](repository) the exist repo_file must contails same name with new repo 
(#27668)
    
    The user manually adjusted the 'name' field in the __repo_info file under 
the repo file on S3, but did not modify the folder name. This led to an issue 
when the user created a repo with the same name as the folder in a certain 
cluster. The system parsed the 'name' field in the existing __repo_info and 
used an incorrect name, causing the subsequent repo to be unusable. A judgment 
has been added here: the 'name' field in the __repo_info must be the same as 
the new repo's name, otherwise [...]
---
 fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java 
b/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java
index a236ba3c308..58dff0d7324 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java
@@ -262,6 +262,11 @@ public class Repository implements Writable {
                 byte[] bytes = Files.readAllBytes(Paths.get(localFilePath));
                 String json = new String(bytes, StandardCharsets.UTF_8);
                 JSONObject root = (JSONObject) JSONValue.parse(json);
+                if (name.compareTo((String) root.get("name")) != 0) {
+                    return new Status(ErrCode.COMMON_ERROR,
+                            "Invalid repository __repo_info, expected repo '" 
+ name + "', but get name '"
+                                + (String) root.get("name") + "' from " + 
repoInfoFilePath);
+                }
                 name = (String) root.get("name");
                 createTime = TimeUtils.timeStringToLong((String) 
root.get("create_time"));
                 if (createTime == -1) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to