Skip to content

Commit

Permalink
[improve](backup) Only compress the running backup/restore job #43177 (
Browse files Browse the repository at this point in the history
…#43278)

cherry pick from #43177
  • Loading branch information
w41ter authored Nov 5, 2024
1 parent 53af206 commit ecdc006
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1011,11 +1011,15 @@ public static BackupJob read(DataInput in) throws IOException {

@Override
public void write(DataOutput out) throws IOException {
if (Config.backup_job_compressed_serialization) {
// For a completed job, there's no need to save it with compressed serialization as it has
// no snapshot or backup meta info, making it small in size. This helps maintain compatibility
// more easily.
boolean shouldCompress = !isDone() && Config.backup_job_compressed_serialization;
if (shouldCompress) {
type = JobType.BACKUP_COMPRESSED;
}
super.write(out);
if (Config.backup_job_compressed_serialization) {
if (shouldCompress) {
type = JobType.BACKUP;

int written = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2451,11 +2451,15 @@ public static RestoreJob read(DataInput in) throws IOException {

@Override
public void write(DataOutput out) throws IOException {
if (Config.restore_job_compressed_serialization) {
// For a completed job, there's no need to save it with compressed serialization as it has
// no snapshot or backup meta info, making it small in size. This helps maintain compatibility
// more easily.
boolean shouldCompress = !isDone() && Config.restore_job_compressed_serialization;
if (shouldCompress) {
type = JobType.RESTORE_COMPRESSED;
}
super.write(out);
if (Config.restore_job_compressed_serialization) {
if (shouldCompress) {
type = JobType.RESTORE;

int written = 0;
Expand Down

0 comments on commit ecdc006

Please sign in to comment.