Backup_context is copied several times during backup process
General
Escalation
General
Escalation
Description
Environment
None
Activity
Show:

Aaditya Dubey March 6, 2023 at 10:33 AM
Hi @1245384330,
Thank you for the report.
Sending the concern to engineering for further review and updates.
Details
Details
Assignee
Unassigned
UnassignedReporter

Labels
Needs Review
Yes
Needs QA
Yes
Affects versions
Priority
Smart Checklist
Open Smart Checklist
Smart Checklist

Open Smart Checklist
Created March 2, 2023 at 12:57 AM
Updated June 7, 2024 at 2:25 PM
The Backup_context object should been one copy during backup process, and the all function pass it by reference. However, in function backup_files bind the argument by value, that will cause needless copy, destructor. And, if the Backup_context contain some global status, it may cause unexpected error.
Improvement method:
bool backup_files(const char *from, bool prep_mode, Backup_context &context) {
run_data_threads(from,
std::bind(backup_thread_func, std::placeholders::_1,
prep_mode, rsync_tmpfile, context),
+ prep_mode, rsync_tmpfile, std::ref(context)),
xtrabackup_parallel, "backup");