This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new 64c700f7821 branch-4.1: [fix](backup) Fix
UnsupportedOperationException in RestoreCommand by copying properties before
modification #61890 (#62072)
64c700f7821 is described below
commit 64c700f78216c5395aac9a47e4fd6c57caead355
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Apr 3 23:09:29 2026 +0800
branch-4.1: [fix](backup) Fix UnsupportedOperationException in
RestoreCommand by copying properties before modification #61890 (#62072)
Cherry-picked from #61890
Co-authored-by: walter <[email protected]>
---
.../nereids/trees/plans/commands/RestoreCommand.java | 12 ++++++------
.../nereids/trees/plans/commands/RestoreCommandTest.java | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommand.java
index 79c47f94d74..446ee604a8e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommand.java
@@ -211,13 +211,15 @@ public class RestoreCommand extends Command implements
ForwardWithSync {
* analyzeProperties
*/
public 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) {
@@ -225,13 +227,11 @@ public class RestoreCommand 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);
-
// allow load
allowLoad = eatBooleanProperty(copiedProperties, PROP_ALLOW_LOAD,
allowLoad);
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommandTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommandTest.java
index ace72983ba7..054d88413bc 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommandTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/RestoreCommandTest.java
@@ -29,6 +29,7 @@ import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.nereids.trees.plans.commands.info.LabelNameInfo;
import org.apache.doris.qe.ConnectContext;
+import com.google.common.collect.ImmutableMap;
import mockit.Expectations;
import mockit.Mocked;
import org.apache.commons.collections4.map.HashedMap;
@@ -136,4 +137,19 @@ public class RestoreCommandTest {
RestoreCommand command5 = new RestoreCommand(labelNameInfo, repoName2,
tableRefInfos, properties2, isExclude);
Assertions.assertThrows(DdlException.class, () ->
command5.validate(connectContext));
}
+
+ @Test
+ public void testAnalyzePropertiesWithImmutableMap() {
+ LabelNameInfo labelNameInfo = new LabelNameInfo(dbName, "label0");
+ Map<String, String> properties = ImmutableMap.of(
+ "timeout", "86400",
+ "backup_timestamp", "2025-06-12-11-15-20");
+
+ RestoreCommand command = new RestoreCommand(labelNameInfo, "testRepo",
+ new ArrayList<>(), properties, false);
+
+ Assertions.assertDoesNotThrow(command::analyzeProperties);
+ Assertions.assertEquals(86400L * 1000, command.getTimeoutMs());
+ Assertions.assertEquals("2025-06-12-11-15-20",
command.getBackupTimestamp());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]