Skip to content

Commit

Permalink
[improve](restore) Release useless info for the finished job to reduc…
Browse files Browse the repository at this point in the history
…e mem usage (#34513)
  • Loading branch information
w41ter authored May 8, 2024
1 parent ba460b1 commit 6f4738c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,20 @@ public String getInfo() {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public static RestoreFileMapping read(DataInput in) throws IOException {
return mapping;
}

public void clear() {
mapping.clear();
overwriteMap.clear();
}

@Override
public void write(DataOutput out) throws IOException {
out.writeInt(mapping.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1804,6 +1804,8 @@ private Status allTabletCommitted(boolean isReplay) {
releaseSnapshots();

snapshotInfos.clear();
fileMapping.clear();
jobInfo.releaseSnapshotInfo();

finishedTime = System.currentTimeMillis();
state = RestoreJobState.FINISHED;
Expand Down Expand Up @@ -1996,6 +1998,9 @@ public void cancelInternal(boolean isReplay) {
releaseSnapshots();

snapshotInfos.clear();
fileMapping.clear();
jobInfo.releaseSnapshotInfo();

RestoreJobState curState = state;
finishedTime = System.currentTimeMillis();
state = RestoreJobState.CANCELLED;
Expand Down

0 comments on commit 6f4738c

Please sign in to comment.