Skip to content

Commit 86ed0b7

Browse files
committed
feat: Use Filewarmer instead of dd
1 parent 9a922e2 commit 86ed0b7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

agent/database_physical_restore.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ def unlock_all_tables(self):
324324
self._get_target_db_for_myisam().execute_sql("UNLOCK TABLES;")
325325

326326
def _warmup_files(self, file_paths: list[str]):
327+
from filewarmer import FWUP
328+
327329
"""
328330
Once the snapshot is converted to disk and attached to the instance,
329331
All the files are not immediately available to the system.
@@ -335,8 +337,9 @@ def _warmup_files(self, file_paths: list[str]):
335337
336338
Ref - https://docs.aws.amazon.com/ebs/latest/userguide/ebs-initialize.html
337339
"""
338-
for file in file_paths:
339-
subprocess.run(["dd", "if=" + file, "of=/dev/null", "bs=1M"], check=True)
340+
341+
fwup = FWUP()
342+
fwup.warmup(file_paths, method="io_uring")
340343

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

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ boto3==1.18.0
22
certifi==2019.11.28
33
chardet==3.0.4
44
click==8.1.3
5+
filewarmer==0.0.13
56
Flask==1.1.1
67
grequests==0.6.0
78
gunicorn==20.0.4

0 commit comments

Comments
 (0)