-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pghoard restore_command optimization #618
Conversation
os.unlink(prefetch_target_path) | ||
return e | ||
with self.server.lock: | ||
os.rename(src, dst) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
os.unlink(prefetch_target_path) | ||
return e | ||
with self.server.lock: | ||
os.rename(src, dst) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
@@ -443,6 +450,8 @@ | |||
xlog_file = Path(target_path).resolve() | |||
if data_dir not in xlog_file.parents: | |||
raise HttpResponse(f"Invalid xlog file path {target_path}, it should be in data directory", status=400) | |||
if not xlog_file.parent.is_dir(): |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #618 +/- ##
==========================================
- Coverage 91.01% 90.79% -0.22%
==========================================
Files 31 31
Lines 4917 4954 +37
==========================================
+ Hits 4475 4498 +23
- Misses 442 456 +14
|
a36a724
to
ebe7234
Compare
23db920
to
92b17da
Compare
92b17da
to
d03e403
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the new thread shutdown needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: why don't we change the python version of restore_command as well? I.e., pghoard/restore.py
a05baab
to
6a53f07
Compare
Added a new DownloadResultsProcessor thread, which validates downloaded files and saves them to the target: '<pg_wal>/<wal_name>.tmp' -> '<pg_wal>/<wal_name>.prefetch'. Files with "prefetch" suffix can be copied to the destination without extra checks now. Also changed items type for "pending_download_ops" dict from "dict" to "dataclass" (PendingDownloadOp) Fixed typing issues for webserver.py renaming prefetched WAL in python CLI "pghoard_postgres_command" renaming prefetched WAL in "pghoard_postgres_command_go"
30eb4e5
to
7c466c3
Compare
63d2b2f
to
2f6cfc2
Compare
2f6cfc2
to
c367c2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I don't have more comment.
Changes:
pg_wal/<wal_name>.tmp -> pg_wal/<wal_name>.pghoard.prefetch
.Files with "prefetch" suffix can be copied to the destination without extra checks now.
pghoard_postgres_command_go
[BF-2247]
We observed that the startup process was only using 60 to 80% of a CPU. This means that we’re not supplying WAL files fast enough or that the restore_command takes too long to complete.
The idea would be to bypass the HTTP-call needed to check if we have a WAL file present from the
restore_command
to the pghoard main process.