Skip to content

Commit db20c77

Browse files
committed
mariabackup: rename encryption_plugin -> xb_plugin
because plugin code is not only about encryption anymore (also loads provider plugins), and xb_ prefix prevents name clashes with the server code (that mariabackup links with).
1 parent 8c806c4 commit db20c77

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
lines changed

extra/mariabackup/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ MYSQL_ADD_EXECUTABLE(mariadb-backup
6868
xbstream_write.cc
6969
backup_mysql.cc
7070
backup_copy.cc
71-
encryption_plugin.cc
71+
xb_plugin.cc
7272
${PROJECT_BINARY_DIR}/sql/sql_builtin.cc
7373
${PROJECT_SOURCE_DIR}/sql/net_serv.cc
7474
${PROJECT_SOURCE_DIR}/libmysqld/libmysql.c

extra/mariabackup/backup_mysql.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
5454
#include "backup_copy.h"
5555
#include "backup_mysql.h"
5656
#include "mysqld.h"
57-
#include "encryption_plugin.h"
57+
#include "xb_plugin.h"
5858
#include <sstream>
5959
#include <sql_error.h>
6060
#include "page0zip.h"
@@ -1621,7 +1621,7 @@ bool write_backup_config_file()
16211621
"innodb_buffer_pool_filename=" : "",
16221622
innobase_buffer_pool_filename ?
16231623
innobase_buffer_pool_filename : "",
1624-
encryption_plugin_get_config());
1624+
xb_plugin_get_config());
16251625
return rc;
16261626
}
16271627

extra/mariabackup/encryption_plugin.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

extra/mariabackup/encryption_plugin.cc renamed to extra/mariabackup/xb_plugin.cc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <mysqld.h>
1818
#include <mysql.h>
1919
#include <xtrabackup.h>
20-
#include <encryption_plugin.h>
20+
#include <xb_plugin.h>
2121
#include <sql_plugin.h>
2222
#include <sstream>
2323
#include <vector>
@@ -28,7 +28,7 @@
2828

2929
extern struct st_maria_plugin *mysql_optional_plugins[];
3030
extern struct st_maria_plugin *mysql_mandatory_plugins[];
31-
static void encryption_plugin_init(int argc, char **argv);
31+
static void xb_plugin_init(int argc, char **argv);
3232

3333
extern char *xb_plugin_load;
3434
extern char *xb_plugin_dir;
@@ -42,7 +42,7 @@ const char *QUERY_PLUGIN =
4242
" OR (plugin_type = 'DAEMON' AND plugin_name LIKE 'provider\\_%')"
4343
" AND plugin_status='ACTIVE'";
4444

45-
std::string encryption_plugin_config;
45+
std::string xb_plugin_config;
4646

4747
static void add_to_plugin_load_list(const char *plugin_def)
4848
{
@@ -55,7 +55,7 @@ static char XTRABACKUP_EXE[] = "xtrabackup";
5555
Read "plugin-load" value from backup-my.cnf during prepare phase.
5656
The value is stored during backup phase.
5757
*/
58-
static std::string get_encryption_plugin_from_cnf(const char *dir)
58+
static std::string get_plugin_from_cnf(const char *dir)
5959
{
6060
std::string path = dir + std::string("/backup-my.cnf");
6161
FILE *f = fopen(path.c_str(), "r");
@@ -80,7 +80,7 @@ static std::string get_encryption_plugin_from_cnf(const char *dir)
8080
}
8181

8282

83-
void encryption_plugin_backup_init(MYSQL *mysql)
83+
void xb_plugin_backup_init(MYSQL *mysql)
8484
{
8585
MYSQL_RES *result;
8686
MYSQL_ROW row;
@@ -163,7 +163,7 @@ void encryption_plugin_backup_init(MYSQL *mysql)
163163
mysql_free_result(result);
164164
}
165165

166-
encryption_plugin_config = oss.str();
166+
xb_plugin_config = oss.str();
167167

168168
argc = 0;
169169
argv[argc++] = XTRABACKUP_EXE;
@@ -175,20 +175,20 @@ void encryption_plugin_backup_init(MYSQL *mysql)
175175
}
176176
argv[argc] = 0;
177177

178-
encryption_plugin_init(argc, argv);
178+
xb_plugin_init(argc, argv);
179179
}
180180

181-
const char *encryption_plugin_get_config()
181+
const char *xb_plugin_get_config()
182182
{
183-
return encryption_plugin_config.c_str();
183+
return xb_plugin_config.c_str();
184184
}
185185

186186
extern int finalize_encryption_plugin(st_plugin_int *plugin);
187187

188188

189-
void encryption_plugin_prepare_init(int argc, char **argv, const char *dir)
189+
void xb_plugin_prepare_init(int argc, char **argv, const char *dir)
190190
{
191-
std::string plugin_load= get_encryption_plugin_from_cnf(dir ? dir : ".");
191+
std::string plugin_load= get_plugin_from_cnf(dir ? dir : ".");
192192
if (plugin_load.size())
193193
{
194194
msg("Loading plugins from %s", plugin_load.c_str());
@@ -211,12 +211,12 @@ void encryption_plugin_prepare_init(int argc, char **argv, const char *dir)
211211
new_argv[0] = XTRABACKUP_EXE;
212212
memcpy(&new_argv[1], argv, argc*sizeof(char *));
213213

214-
encryption_plugin_init(argc+1, new_argv);
214+
xb_plugin_init(argc+1, new_argv);
215215

216216
delete[] new_argv;
217217
}
218218

219-
static void encryption_plugin_init(int argc, char **argv)
219+
static void xb_plugin_init(int argc, char **argv)
220220
{
221221
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
222222
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;

extra/mariabackup/xb_plugin.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <mysql.h>
2+
#include <string>
3+
extern void xb_plugin_backup_init(MYSQL *mysql);
4+
extern const char* xb_plugin_get_config();
5+
extern void xb_plugin_prepare_init(int argc, char **argv, const char *dir);

extra/mariabackup/xtrabackup.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
106106
#include "backup_mysql.h"
107107
#include "backup_copy.h"
108108
#include "backup_mysql.h"
109-
#include "encryption_plugin.h"
109+
#include "xb_plugin.h"
110110
#include <sql_plugin.h>
111111
#include <srv0srv.h>
112112
#include <log.h>
@@ -4391,7 +4391,7 @@ static bool xtrabackup_backup_func()
43914391
return(false);
43924392
}
43934393
msg("cd to %s", mysql_real_data_home);
4394-
encryption_plugin_backup_init(mysql_connection);
4394+
xb_plugin_backup_init(mysql_connection);
43954395
msg("open files limit requested %lu, set to %lu",
43964396
xb_open_files_limit,
43974397
xb_set_max_open_files(xb_open_files_limit));
@@ -5774,7 +5774,7 @@ static bool xtrabackup_prepare_func(char** argv)
57745774
}
57755775

57765776
int argc; for (argc = 0; argv[argc]; argc++) {}
5777-
encryption_plugin_prepare_init(argc, argv, xtrabackup_incremental_dir);
5777+
xb_plugin_prepare_init(argc, argv, xtrabackup_incremental_dir);
57785778

57795779
xtrabackup_target_dir= mysql_data_home_buff;
57805780
xtrabackup_target_dir[0]=FN_CURLIB; // all paths are relative from here

0 commit comments

Comments
 (0)