diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java index e328270ae1..ac66dc6dd3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java @@ -1033,8 +1033,10 @@ public class CatalogRecycleBin extends MasterDaemon implements Writable { return Stream.of(dbInfos, tableInfos, partitionInfos).flatMap(Collection::stream).collect(Collectors.toList()); } + // Need to add "synchronized", because when calling /dump api to dump image, + // this class is not protected by any lock, will throw ConcurrentModificationException. @Override - public void write(DataOutput out) throws IOException { + public synchronized void write(DataOutput out) throws IOException { int count = idToDatabase.size(); out.writeInt(count); for (Map.Entry entry : idToDatabase.entrySet()) {