Skip to content

Commit 03549d4

Browse files
committed
refactor(physical-restore): Manage a single instance of filewarmer
1 parent 86ed0b7 commit 03549d4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

agent/database_physical_restore.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def __init__(
5959

6060
@job("Physical Restore Database")
6161
def create_restore_job(self):
62+
from filewarmer import FWUP
63+
64+
self.fwup = FWUP()
6265
self.validate_backup_files()
6366
self.validate_connection_to_target_db()
6467
self.warmup_myisam_files()
@@ -324,8 +327,6 @@ def unlock_all_tables(self):
324327
self._get_target_db_for_myisam().execute_sql("UNLOCK TABLES;")
325328

326329
def _warmup_files(self, file_paths: list[str]):
327-
from filewarmer import FWUP
328-
329330
"""
330331
Once the snapshot is converted to disk and attached to the instance,
331332
All the files are not immediately available to the system.
@@ -338,8 +339,7 @@ def _warmup_files(self, file_paths: list[str]):
338339
Ref - https://docs.aws.amazon.com/ebs/latest/userguide/ebs-initialize.html
339340
"""
340341

341-
fwup = FWUP()
342-
fwup.warmup(file_paths, method="io_uring")
342+
self.fwup.warmup(file_paths, method="io_uring")
343343

344344
def _perform_file_operations(self, engine: str):
345345
for file in os.listdir(self.backup_db_directory):

0 commit comments

Comments
 (0)