mirror of
https://github.com/MariaDB/server.git
synced 2025-09-26 02:49:13 +02:00

This was generally good to get done but also needed to be able to run mariabackup test under asan. Things freed: - Allocated variables (mysql_tmpdir_list, opt_passwd etc) - InnoDB variables - Results from SQL queries (A lot of sql queries did not free their result) - Allocated sys_vars - Server variables (mysql_server_end()) - Memory allocated by plugins (encryption) - Free variables allocated by my_default. (Old code had a bug that caused these to not be freed) Other things: - Moved freeing of mysql_tmpdir_list to main, as the old code did not free the last mysqltmp_dir allocation. Now we also initialize the variable only once. - Fixed a serious, potentially 'crashing at end' bug where we called free_defaults() with wrong pointers. - Fixed a bug related to update_malloc_size() where we did not take into account the it was not changed. - Fixed a bug in Sys_var_charptr_base where we did not allocate default values. This could lead to trying to free not allocated values in xtrabackup. - Added sf_have_memory_leak() to be able to easily check if there was a memory leak when using safemalloc() - sf_report_leaked_memory() now returns 1 if a memory leak was found.
100 lines
2 KiB
C++
100 lines
2 KiB
C++
#ifndef XTRABACKUP_BACKUP_MYSQL_H
|
|
#define XTRABACKUP_BACKUP_MYSQL_H
|
|
|
|
#include <mysql.h>
|
|
#include <string>
|
|
#include <unordered_set>
|
|
#include "datasink.h"
|
|
|
|
/* MariaDB version */
|
|
extern ulong mysql_server_version;
|
|
|
|
/* server capabilities */
|
|
extern bool have_changed_page_bitmaps;
|
|
extern bool have_lock_wait_timeout;
|
|
extern bool have_galera_enabled;
|
|
extern bool have_multi_threaded_slave;
|
|
extern bool have_gtid_slave;
|
|
|
|
|
|
/* History on server */
|
|
extern time_t history_start_time;
|
|
extern time_t history_end_time;
|
|
extern time_t history_lock_time;
|
|
|
|
|
|
extern bool sql_thread_started;
|
|
extern char *mysql_slave_position;
|
|
extern char *mysql_binlog_position;
|
|
extern char *buffer_pool_filename;
|
|
|
|
/** connection to mysql server */
|
|
extern MYSQL *mysql_connection;
|
|
|
|
void
|
|
capture_tool_command(int argc, char **argv);
|
|
|
|
bool
|
|
select_history();
|
|
|
|
void
|
|
backup_cleanup();
|
|
|
|
bool
|
|
get_mysql_vars(MYSQL *connection);
|
|
|
|
MYSQL *
|
|
xb_mysql_connect();
|
|
|
|
MYSQL_RES *
|
|
xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
|
|
bool die_on_error = true);
|
|
|
|
void
|
|
unlock_all(MYSQL *connection);
|
|
|
|
bool
|
|
write_current_binlog_file(ds_ctxt *datasink, MYSQL *connection);
|
|
|
|
bool
|
|
write_binlog_info(ds_ctxt *datasink, MYSQL *connection);
|
|
|
|
bool
|
|
write_xtrabackup_info(ds_ctxt *datasink,
|
|
MYSQL *connection, const char * filename, bool history,
|
|
bool stream);
|
|
|
|
bool
|
|
write_backup_config_file(ds_ctxt *datasink);
|
|
|
|
bool
|
|
lock_binlog_maybe(MYSQL *connection);
|
|
|
|
bool
|
|
lock_for_backup_stage_start(MYSQL *connection);
|
|
|
|
bool
|
|
lock_for_backup_stage_flush(MYSQL *connection);
|
|
|
|
bool
|
|
lock_for_backup_stage_block_ddl(MYSQL *connection);
|
|
|
|
bool
|
|
lock_for_backup_stage_commit(MYSQL *connection);
|
|
|
|
bool backup_lock(MYSQL *con, const char *table_name);
|
|
bool backup_unlock(MYSQL *con);
|
|
|
|
std::unordered_set<std::string> get_tables_in_use(MYSQL *con);
|
|
|
|
bool
|
|
wait_for_safe_slave(MYSQL *connection);
|
|
|
|
bool
|
|
write_galera_info(ds_ctxt *datasink, MYSQL *connection);
|
|
|
|
bool
|
|
write_slave_info(ds_ctxt *datasink, MYSQL *connection);
|
|
|
|
ulonglong get_current_lsn(MYSQL *connection);
|
|
#endif
|