if (!no_lock && !backup_lock(con, full_tname.c_str())) {
msg(thread_num, "Error on executing BACKUP LOCK for table %s",
full_tname.c_str()); gotoexit;
} else
locked = !no_lock;
if ((frm_file = mysql_file_open(key_file_frm, (m_fs_name + ".frm").c_str(),
O_RDONLY | O_SHARE, MYF(0))) < 0 && !m_fnames.empty() &&
!ends_with(m_fnames[0].c_str(), ".ARZ") &&
!ends_with(m_fnames[0].c_str(), ".ARM")) { // Don't treat it as error, as the table can be dropped after it // was added to queue for copying
result = true; gotoexit;
}
for (constauto &fname : m_fnames) {
File file = mysql_file_open(0, fname.c_str(),O_RDONLY | O_SHARE, MYF(0)); if (file < 0) { char buf[MYSYS_STRERROR_SIZE];
msg(thread_num, "Error %i on file %s open during %s table copy: %s",
errno, fname.c_str(), full_tname.c_str(),
my_strerror(buf, sizeof(buf), errno)); gotoexit;
}
files.push_back(file);
}
if (locked && !backup_unlock(con)) {
msg(thread_num, "Error on BACKUP UNLOCK for table %s", full_tname.c_str());
locked = false; gotoexit;
}
locked = false;
buf.reset(new uchar[buf_size]);
for (size_t i = 0; i < m_fnames.size(); ++i) {
ds_file_t *dst_file = nullptr;
size_t bytes_read;
size_t copied_size = 0;
MY_STAT stat_info;
if (my_fstat(files[i], &stat_info, MYF(0))) {
msg(thread_num, "error: failed to get stat info for file %s of " "table %s", m_fnames[i].c_str(), full_tname.c_str()); gotoexit;
}
bool LogTable::close() { while (!m_src.empty()) { auto f = m_src.back();
m_src.pop_back();
mysql_file_close(f, MYF(MY_WME));
} while (!m_dst.empty()) { auto f = m_dst.back();
m_dst.pop_back();
ds_close(f);
} returntrue;
}
if (!collect_log_and_stats && is_aria) returntrue;
if (!is_aria && !filename_matches(file_path, ext_list)) returntrue;
if (check_if_skip_table(file_path)) {
msg("Skipping %s.", file_path); returntrue;
}
auto db_table_fs = convert_filepath_to_tablename(file_path); auto tk =
table_key(std::get<0>(db_table_fs), std::get<1>(db_table_fs));
// log and stats tables are only collected in this function, // so there is no need to filter out them with exclude_tables. if (collect_log_and_stats) { if (is_log_table(std::get<0>(db_table_fs).c_str(),
std::get<1>(db_table_fs).c_str())) { auto table_it = m_log_tables.find(tk); if (table_it == m_log_tables.end()) {
msg("Log table found: %s", tk.c_str());
table_it = m_log_tables.emplace(tk,
std::unique_ptr<LogTable>(new LogTable(std::get<0>(db_table_fs),
std::get<1>(db_table_fs), std::get<2>(db_table_fs)))).first;
}
msg("Collect log table file: %s", file_path);
table_it->second->add_file_name(file_path); returntrue;
} // Aria can handle statistics tables elseif (is_stats_table(std::get<0>(db_table_fs).c_str(),
std::get<1>(db_table_fs).c_str()) && !is_aria) { auto table_it = m_stats_tables.find(tk); if (table_it == m_stats_tables.end()) {
msg("Stats table found: %s", tk.c_str());
table_it = m_stats_tables.emplace(tk,
std::unique_ptr<Table>(new Table(std::get<0>(db_table_fs),
std::get<1>(db_table_fs), std::get<2>(db_table_fs)))).first;
}
msg("Collect stats table file: %s", file_path);
table_it->second->add_file_name(file_path); returntrue;
}
} elseif (is_log_table(std::get<0>(db_table_fs).c_str(),
std::get<1>(db_table_fs).c_str()) ||
is_stats_table(std::get<0>(db_table_fs).c_str(),
std::get<1>(db_table_fs).c_str())) returntrue;
if (is_aria) returntrue;
if (exclude_tables.count(tk)) {
msg("Skip table %s at it is in exclude list", tk.c_str()); returntrue;
}
auto table_it = found_tables.find(tk); if (table_it == found_tables.end()) {
table_it = found_tables.emplace(tk,
std::unique_ptr<Table>(new Table(std::get<0>(db_table_fs),
std::get<1>(db_table_fs), std::get<2>(db_table_fs)))).first;
}
table_it->second->add_file_name(file_path);
returntrue;
});
for (auto &table_it : found_tables) {
m_process_table_jobs.push_task(
std::bind(&BackupImpl::process_table_job, this, table_it.second.release(),
no_lock, true, false, std::placeholders::_1)); if (out_processed_tables)
out_processed_tables->insert(table_it.first);
}
msg("Stop scanning common engine tables"); returntrue;
}
bool BackupImpl::copy_log_tables(bool finalize) { for (auto &table_it : m_log_tables) { // Do not execute BACKUP LOCK for log tables as it's supposed // that they must be copied on BLOCK_DDL and BLOCK_COMMIT locks.
m_process_table_jobs.push_task(
std::bind(&BackupImpl::process_table_job, this, table_it.second.get(), true, false, finalize, std::placeholders::_1));
} returntrue;
}
bool BackupImpl::copy_stats_tables() { for (auto &table_it : m_stats_tables) { // Do not execute BACKUP LOCK for stats tables as it's supposed // that they must be copied on BLOCK_DDL and BLOCK_COMMIT locks. // Delete stats table object after copy (see process_table_job())
m_process_table_jobs.push_task(
std::bind(&BackupImpl::process_table_job, this, table_it.second.release(), true, true, false, std::placeholders::_1));
}
m_stats_tables.clear(); returntrue;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.10Bemerkung:
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.