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

hello-stephen 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 ddba8b280ce [fix](fe) Handle BACKUP timeout with immutable properties 
(#69424)
ddba8b280ce is described below

commit ddba8b280ce6b38a3d890c302896bffb2df07ac8
Author: deardeng <[email protected]>
AuthorDate: Thu Oct 22 23:26:55 2026 +0800

    [fix](fe) Handle BACKUP timeout with immutable properties (#69424)
    
    Problem Summary: BACKUP SNAPSHOT with a valid timeout property fails
    during Nereids analysis because BackupCommand removes timeout from the
    immutable properties map returned by the parser. Copy properties before
    analyzing timeout and consume all properties from that mutable copy. Add
    a unit test that parses BACKUP SQL and checks timeout conversion and
    content parsing.
---
 .../doris/nereids/trees/plans/commands/BackupCommand.java  | 11 ++++++-----
 .../nereids/trees/plans/commands/BackupCommandTest.java    | 14 ++++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/BackupCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/BackupCommand.java
index a46f645e6d0..745871546d8 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/BackupCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/BackupCommand.java
@@ -173,13 +173,15 @@ public class BackupCommand extends Command implements 
ForwardWithSync {
     }
 
     private void analyzeProperties() throws AnalysisException {
+        Map<String, String> copiedProperties = Maps.newHashMap(properties);
+
         // timeout
-        if (properties.containsKey("timeout")) {
+        if (copiedProperties.containsKey(PROP_TIMEOUT)) {
             try {
-                timeoutMs = Long.valueOf(properties.get(PROP_TIMEOUT));
+                timeoutMs = Long.valueOf(copiedProperties.get(PROP_TIMEOUT));
             } catch (NumberFormatException e) {
                 ErrorReport.reportAnalysisException(ErrorCode.ERR_COMMON_ERROR,
-                        "Invalid timeout format: " + 
properties.get(PROP_TIMEOUT));
+                        "Invalid timeout format: " + 
copiedProperties.get(PROP_TIMEOUT));
             }
 
             if (timeoutMs * 1000 < MIN_TIMEOUT_MS) {
@@ -187,12 +189,11 @@ public class BackupCommand extends Command implements 
ForwardWithSync {
             }
 
             timeoutMs = timeoutMs * 1000;
-            properties.remove(PROP_TIMEOUT);
+            copiedProperties.remove(PROP_TIMEOUT);
         } else {
             timeoutMs = Config.backup_job_default_timeout_ms;
         }
 
-        Map<String, String> copiedProperties = Maps.newHashMap(properties);
         // type
         String typeProp = copiedProperties.get(PROP_TYPE);
         if (typeProp != null) {
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/BackupCommandTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/BackupCommandTest.java
index 2446995c41e..db8936d1c64 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/BackupCommandTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/BackupCommandTest.java
@@ -26,6 +26,7 @@ import org.apache.doris.datasource.InternalCatalog;
 import org.apache.doris.info.TableRefInfo;
 import org.apache.doris.mysql.privilege.AccessControllerManager;
 import org.apache.doris.mysql.privilege.PrivPredicate;
+import org.apache.doris.nereids.parser.NereidsParser;
 import org.apache.doris.nereids.trees.plans.commands.info.LabelNameInfo;
 import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.utframe.TestWithFeService;
@@ -54,6 +55,19 @@ public class BackupCommandTest extends TestWithFeService {
         accessControllerManager = env.getAccessManager();
     }
 
+    @Test
+    public void testAnalyzePropertiesWithTimeout() {
+        BackupCommand command = (BackupCommand) new 
NereidsParser().parseSingle(
+                "BACKUP SNAPSHOT test_db.test_snapshot TO test_repo "
+                        + "PROPERTIES (\"timeout\" = \"3600\", \"type\" = 
\"full\", \"content\" = \"metadata_only\")");
+
+        Deencapsulation.invoke(command, "analyzeProperties");
+
+        Assertions.assertEquals(3600L * 1000, command.getTimeoutMs());
+        Assertions.assertEquals(BackupCommand.BackupType.FULL, 
command.getBackupType());
+        Assertions.assertEquals(BackupCommand.BackupContent.METADATA_ONLY, 
command.getContent());
+    }
+
     @Test
     public void testValidateNormal() throws Exception {
         runBefore();


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

Reply via email to