ChunkedBackupDriver: Freeing memory on restore
When restoring many backups, the backup service uses a lot of memory and when we do many concurrent restores the backup service ends up getting killed becase the system runs out of memory. This patch reduces the ref count to the data as soon as possible to let Python garbage collect it instead of hogging it for the whole chunk restore. Related-Bug: #1865011 Change-Id: I942d9d8b3976232ae1cf82b698fb27285fbef13a (cherry picked from commit69462315bc
) (cherry picked from commit94db15dd3b
) (cherry picked from commitf4aa81424f
)
This commit is contained in:
parent
bcea359d54
commit
20b6b7477d
|
@ -711,9 +711,12 @@ class ChunkedBackupDriver(driver.BackupDriver):
|
|||
LOG.debug('decompressing data using %s algorithm',
|
||||
compression_algorithm)
|
||||
decompressed = decompressor.decompress(body)
|
||||
body = None # Allow Python to free it
|
||||
volume_file.write(decompressed)
|
||||
decompressed = None # Allow Python to free it
|
||||
else:
|
||||
volume_file.write(body)
|
||||
body = None # Allow Python to free it
|
||||
|
||||
# force flush every write to avoid long blocking write on close
|
||||
volume_file.flush()
|
||||
|
|
Loading…
Reference in New Issue