[improve](restore) Release useless info for the finished job to reduce mem usage (#34513)

This commit is contained in:
walter
2024-05-08 19:28:32 +08:00
committed by yiguolei
parent 19c20247f4
commit d038d3bf21
3 changed files with 24 additions and 0 deletions

View File

@ -788,6 +788,20 @@ public class BackupJobInfo implements Writable {
return getBrief();
}
public void releaseSnapshotInfo() {
tabletBeMap.clear();
tabletSnapshotPathMap.clear();
for (BackupOlapTableInfo tableInfo : backupOlapTableObjects.values()) {
for (BackupPartitionInfo partInfo : tableInfo.partitions.values()) {
for (BackupIndexInfo indexInfo : partInfo.indexes.values()) {
for (BackupTabletInfo tabletInfo : indexInfo.sortedTabletInfoList) {
tabletInfo.files.clear();
}
}
}
}
}
public static BackupJobInfo read(DataInput in) throws IOException {
return BackupJobInfo.readFields(in);
}

View File

@ -156,6 +156,11 @@ public class RestoreFileMapping implements Writable {
return mapping;
}
public void clear() {
mapping.clear();
overwriteMap.clear();
}
@Override
public void write(DataOutput out) throws IOException {
out.writeInt(mapping.size());

View File

@ -1801,6 +1801,8 @@ public class RestoreJob extends AbstractJob {
releaseSnapshots();
snapshotInfos.clear();
fileMapping.clear();
jobInfo.releaseSnapshotInfo();
finishedTime = System.currentTimeMillis();
state = RestoreJobState.FINISHED;
@ -1993,6 +1995,9 @@ public class RestoreJob extends AbstractJob {
releaseSnapshots();
snapshotInfos.clear();
fileMapping.clear();
jobInfo.releaseSnapshotInfo();
RestoreJobState curState = state;
finishedTime = System.currentTimeMillis();
state = RestoreJobState.CANCELLED;