Skip to content

Commit 271fb80

Browse files
committed
Merge branch 'github/12.2' into 12.3
2 parents 42b22dd + d26a6f4 commit 271fb80

File tree

484 files changed

+16463
-3832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

484 files changed

+16463
-3832
lines changed

BUILD/compile-pentium64-asan-max

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ path=`dirname $0`
2323
#
2424

2525
extra_flags="$pentium64_cflags $debug_cflags -lasan -O -g -fsanitize=address -USAFEMALLOC -UFORCE_INIT_OF_VARS -Wno-uninitialized -Wno-maybe-uninitialized -DMYSQL_SERVER_SUFFIX=-asan-max"
26-
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs $disable_asan_plugins"
26+
extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs $disable_asan_plugins --with-asan=ON"
2727
export LDFLAGS="-ldl"
2828

2929
. "$path/FINISH.sh"

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ MariaDB Server has a vibrant community contributing in a wide range of areas. Th
55
### Engage online with other community members
66
---
77
- [MariaDB on Zulip](https://mariadb.zulipchat.com/)
8-
- [maria-developers mailing list](http://launchpad.net/~maria-developers)
9-
- [maria-discuss mailing list](http://launchpad.net/~maria-discuss)
10-
- [maria-docs mailing list](http://launchpad.net/~maria-docs)
11-
- The MariaDB Foundation and MariaDB Corporation have a presence on Reddit, Twitter and Facebook. See the [social media page](https://mariadb.com/kb/en/mariadb/social-media/).
8+
- [maria-developers mailing list](https://lists.mariadb.org/postorius/lists/developers.lists.mariadb.org/)
9+
- [maria-discuss mailing list](https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/)
10+
- [maria-docs mailing list](https://lists.mariadb.org/postorius/lists/docs.lists.mariadb.org/)
11+
- The MariaDB Foundation and MariaDB Corporation have a presence on Reddit, Twitter and Facebook. See the [social media page](https://mariadb.com/docs/general-resources/community/joining-the-community).
1212

1313
### Help document MariaDB
1414
----
15-
- Contribute towards [documenting MariaDB Server](https://mariadb.com/kb/en/meta/writing-editing-library-articles/) and its ecosystem by adding new content or improving existing content.
16-
- [Translate](https://mariadb.com/kb/en/meta/translating-library-articles/) existing documentation.
15+
- Contribute towards [documenting MariaDB Server](https://mariadb.com/docs/general-resources/about/readme/contributing-documentation) and its ecosystem by adding new content or improving existing content.
16+
- [Translate](https://mariadb.com/docs/general-resources/about/readme/contributing-documentation) existing documentation.
1717

1818
### Help debug and develop MariaDB
1919
-----
@@ -44,4 +44,4 @@ New contributors can ask questions any time, but we will provide immediate feedb
4444
### Additional resources
4545
----
4646
- [MariaDB Foundation ](https://mariadb.org/)
47-
- [Knowledge Base](https://mariadb.com/kb/en/)
47+
- [MariaDB Documentation](https://mariadb.com/docs/)

CREDITS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ following services to the MariaDB community:
6666
- Bug fixing in MariaDB (for bugs that affects a large part of the community)
6767
- Building the official MariaDB binaries
6868
- Maintaining https://mariadb.org
69-
- Documenting MariaDB in the MariaDB Knowledge Base https://mariadb.com/kb
69+
- Documenting MariaDB in the MariaDB Documentation https://mariadb.com/kb
7070

7171
To be able to do the above we need help from corporations and individuals!
7272

Docs/mysql.info

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

client/mysqldump.cc

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
142142
#define OPT_SYSTEM_STATS 32
143143
#define OPT_SYSTEM_TIMEZONES 64
144144
static const char *opt_system_type_values[]=
145-
{"all", "users", "plugins", "udfs", "servers", "stats", "timezones"};
145+
{"all", "users", "plugins", "udfs", "servers", "stats", "timezones", NullS};
146146
static TYPELIB opt_system_types=CREATE_TYPELIB_FOR(opt_system_type_values);
147147
static ulonglong opt_system= 0ULL;
148148
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0,
@@ -498,7 +498,7 @@ static struct my_option my_long_options[] =
498498
{"max_allowed_packet", 0,
499499
"The maximum packet length to send to or receive from server.",
500500
&opt_max_allowed_packet, &opt_max_allowed_packet, 0,
501-
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
501+
GET_ULONG, REQUIRED_ARG, 1024LL*1024*1024, 4096,
502502
(longlong) 2L*1024L*1024L*1024L, 0, 1024, 0},
503503
{"max-statement-time", 0,
504504
"Max statement execution time. If unset, overrides server default with 0.",
@@ -1950,21 +1950,35 @@ static char *cover_definer_clause(const char *stmt_str,
19501950
}
19511951

19521952

1953+
static char *format_fs_safe_filename(const char *from, char *to, size_t to_size)
1954+
{
1955+
if (check_if_legal_tablename(from))
1956+
strxnmov(to, to_size - 1, from , "@@@", NULL);
1957+
else
1958+
{
1959+
uint errors, len;
1960+
len= my_convert(to, (uint32)(to_size - 1), &my_charset_filename,
1961+
from, (uint32) strlen(from), charset_info, &errors);
1962+
to[len]= 0;
1963+
}
1964+
return to;
1965+
}
1966+
1967+
static void format_fs_safe_output_dir(const char *db, char *out_dir, size_t out_size)
1968+
{
1969+
DBUG_ASSERT(opt_dir);
1970+
char fs_safe_db[FN_REFLEN];
1971+
format_fs_safe_filename(db, fs_safe_db, sizeof(fs_safe_db));
1972+
my_snprintf(out_dir, out_size, "%s/%s", opt_dir, fs_safe_db);
1973+
}
1974+
19531975
static const char* build_path_for_table(char *to, const char *dir,
19541976
const char *table, const char *ext)
19551977
{
19561978
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
19571979
convert_dirname(tmp_path, dir, NULL);
19581980
my_load_path(tmp_path, tmp_path, NULL);
1959-
if (check_if_legal_tablename(table))
1960-
strxnmov(filename, sizeof(filename) - 1, table, "@@@", NULL);
1961-
else
1962-
{
1963-
uint errors, len;
1964-
len= my_convert(filename, sizeof(filename) - 1, &my_charset_filename,
1965-
table, (uint32)strlen(table), charset_info, &errors);
1966-
filename[len]= 0;
1967-
}
1981+
format_fs_safe_filename(table, filename, sizeof(filename));
19681982
return fn_format(to, filename, tmp_path, ext, MYF(MY_UNPACK_FILENAME));
19691983
}
19701984

@@ -1991,7 +2005,7 @@ static FILE* open_sql_file_for_table(const char *db, const char* table, int flag
19912005
if (opt_dir)
19922006
{
19932007
out_dir= out_dir_buf;
1994-
my_snprintf(out_dir_buf, sizeof(out_dir_buf), "%s/%s", opt_dir, db);
2008+
format_fs_safe_output_dir(db, out_dir_buf, sizeof(out_dir_buf));
19952009
}
19962010

19972011
res= my_fopen(build_path_for_table(filename, out_dir, table, ".sql"),
@@ -4319,7 +4333,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
43194333
char *out_dir= path;
43204334
if (!out_dir)
43214335
{
4322-
my_snprintf(out_dir_buf, sizeof(out_dir_buf), "%s/%s", opt_dir, db);
4336+
format_fs_safe_output_dir(db, out_dir_buf, sizeof(out_dir_buf));
43234337
out_dir= out_dir_buf;
43244338
}
43254339

@@ -4480,6 +4494,11 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
44804494
fprintf(md_result_file,"/*M!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;\n");
44814495
check_io(md_result_file);
44824496
}
4497+
if (no_autocommit)
4498+
{
4499+
fprintf(md_result_file, "SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0;\n");
4500+
check_io(md_result_file);
4501+
}
44834502
if (opt_lock)
44844503
{
44854504
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
@@ -4500,11 +4519,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
45004519
if (opt_xml)
45014520
print_xml_tag(md_result_file, "\t", "\n", "table_data", "name=", table,
45024521
NullS);
4503-
if (no_autocommit)
4504-
{
4505-
fprintf(md_result_file, "set autocommit=0;\n");
4506-
check_io(md_result_file);
4507-
}
45084522

45094523
while ((row= mysql_fetch_row(res)))
45104524
{
@@ -4776,7 +4790,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
47764790
}
47774791
if (no_autocommit)
47784792
{
4779-
fprintf(md_result_file, "commit;\n");
4793+
fprintf(md_result_file, "COMMIT;\nSET AUTOCOMMIT=@OLD_AUTOCOMMIT;\n");
47804794
check_io(md_result_file);
47814795
}
47824796
if (versioned && !opt_xml && opt_dump_history)
@@ -7399,7 +7413,7 @@ static void ensure_out_dir_exists(const char *db)
73997413
{
74007414
DBUG_ASSERT(opt_dir);
74017415
char outdir[FN_REFLEN];
7402-
my_snprintf(outdir, sizeof(outdir), "%s/%s", opt_dir, db);
7416+
format_fs_safe_output_dir(db, outdir, sizeof(outdir));
74037417
struct stat st;
74047418
if (stat(outdir, &st) == 0)
74057419
{

client/mysqlimport.cc

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static std::vector<MYSQL *> all_tp_connections;
5050
std::atomic<bool> aborting{false};
5151
static void kill_tp_connections(MYSQL *mysql);
5252

53-
static void db_error_with_table(MYSQL *mysql, char *table);
53+
static void db_error_with_table(MYSQL *mysql, const char *table);
5454
static void db_error(MYSQL *mysql);
5555
static char *field_escape(char *to,const char *from,uint length);
5656
static char *add_load_option(char *ptr,const char *object,
@@ -82,12 +82,36 @@ static char **argv_to_free;
8282
static void safe_exit(int error, MYSQL *mysql);
8383
static void set_exitcode(int code);
8484

85+
/*
86+
Try to convert from filesystem-safe name escaping to string
87+
in default character set.
88+
89+
@param name Name to unescape
90+
@param buf Buffer to store result
91+
@param sz Size of buffer
92+
@return length of result string, or 0 on error or decodin
93+
not needed
94+
*/
95+
static uint decode_fs_safe_name(const char *name, char *buf, size_t sz)
96+
{
97+
if (!strchr(name, '@'))
98+
return 0;
99+
uint errors, len;
100+
len= my_convert(buf, (uint32)(sz - 1), default_charset_info, name, (uint32) strlen(name),
101+
&my_charset_filename, &errors);
102+
if (errors || !len)
103+
return 0;
104+
buf[len]= 0;
105+
return len;
106+
}
107+
85108
struct table_load_params
86109
{
87110
std::string data_file; /* name of the file to load with LOAD DATA INFILE */
88111
std::string sql_file; /* name of the file that contains CREATE TABLE or
89112
CREATE VIEW */
90113
std::string dbname; /* name of the database */
114+
std::string tablename; /* name of the table */
91115
bool tz_utc= false; /* true if the script sets the timezone to UTC */
92116
bool is_view= false; /* true if the script is for a VIEW */
93117
std::vector<std::string> triggers; /* CREATE TRIGGER statements */
@@ -98,12 +122,21 @@ struct table_load_params
98122
table_load_params(const char* dfile, const char* sqlfile,
99123
const char* db, ulonglong data_size)
100124
: data_file(dfile), sql_file(sqlfile),
101-
dbname(db), triggers(),
125+
triggers(),
102126
size(data_size),
103127
sql_text(parse_sql_script(sqlfile, &tz_utc, &triggers)),
104128
ddl_info(sql_text)
105129
{
106130
is_view= ddl_info.table_name.empty();
131+
/* Convert dbname from FS safe encoding if needed. */
132+
char decoded_name[FN_REFLEN];
133+
uint len= decode_fs_safe_name(db, decoded_name, sizeof(decoded_name));
134+
dbname= len ? std::string(decoded_name, len) : std::string(db);
135+
136+
char raw_tblname[FN_REFLEN];
137+
fn_format(raw_tblname, dfile, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
138+
len= decode_fs_safe_name(raw_tblname, decoded_name, sizeof(decoded_name));
139+
tablename= len ? std::string(decoded_name, len) : std::string(raw_tblname);
107140
}
108141
int create_table_or_view(MYSQL *);
109142
int load_data(MYSQL *);
@@ -646,7 +679,7 @@ int table_load_params::create_table_or_view(MYSQL* mysql)
646679

647680
int table_load_params::load_data(MYSQL *mysql)
648681
{
649-
char tablename[FN_REFLEN], hard_path[FN_REFLEN],
682+
char hard_path[FN_REFLEN],
650683
escaped_name[FN_REFLEN * 2 + 1],
651684
sql_statement[FN_REFLEN*16+256], *end;
652685
DBUG_ENTER("table_load_params::load");
@@ -666,23 +699,10 @@ int table_load_params::load_data(MYSQL *mysql)
666699
}
667700

668701
const char *filename= data_file.c_str();
669-
670-
fn_format(tablename, filename, "", "", MYF(MY_REPLACE_DIR | MY_REPLACE_EXT));
671-
if (strchr(tablename, '@'))
672-
{
673-
uint errors, len;
674-
CHARSET_INFO *cs=
675-
get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(0));
676-
len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename,
677-
(uint32)strlen(tablename), &my_charset_filename, &errors);
678-
if (!errors)
679-
strmake(tablename, escaped_name, len);
680-
}
681-
682702
const char *db= current_db ? current_db : dbname.c_str();
683703
std::string full_tablename= quote_identifier(db);
684704
full_tablename+= ".";
685-
full_tablename+= quote_identifier(tablename);
705+
full_tablename+= quote_identifier(tablename.c_str());
686706

687707
if (tz_utc && exec_sql(mysql, "SET TIME_ZONE='+00:00';"))
688708
DBUG_RETURN(1);
@@ -698,7 +718,7 @@ int table_load_params::load_data(MYSQL *mysql)
698718
if (opt_delete)
699719
{
700720
if (verbose)
701-
fprintf(stdout, "Deleting the old data from table %s\n", tablename);
721+
fprintf(stdout, "Deleting the old data from table %s\n", tablename.c_str());
702722
snprintf(sql_statement, FN_REFLEN * 16 + 256, "DELETE FROM %s",
703723
full_tablename.c_str());
704724
if (exec_sql(mysql, sql_statement))
@@ -723,7 +743,7 @@ int table_load_params::load_data(MYSQL *mysql)
723743
if (verbose)
724744
{
725745
fprintf(stdout, "Loading data from %s file: %s into %s\n",
726-
(opt_local_file) ? "LOCAL" : "SERVER", hard_path, tablename);
746+
(opt_local_file) ? "LOCAL" : "SERVER", hard_path, tablename.c_str());
727747
}
728748
mysql_real_escape_string(mysql, escaped_name, hard_path,
729749
(unsigned long) strlen(hard_path));
@@ -758,14 +778,14 @@ int table_load_params::load_data(MYSQL *mysql)
758778

759779
if (mysql_query(mysql, sql_statement))
760780
{
761-
db_error_with_table(mysql, tablename);
781+
db_error_with_table(mysql, tablename.c_str());
762782
DBUG_RETURN(1);
763783
}
764784
if (!silent)
765785
{
766786
const char *info= mysql_info(mysql);
767787
if (info) /* If NULL-pointer, print nothing */
768-
fprintf(stdout, "%s.%s: %s\n", db, tablename, info);
788+
fprintf(stdout, "%s.%s: %s\n", db, tablename.c_str(), info);
769789
}
770790

771791

@@ -880,9 +900,6 @@ static MYSQL *db_connect(char *host, char *database,
880900

881901
if (opt_default_auth && *opt_default_auth)
882902
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
883-
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
884-
default_charset= (char *)my_default_csname();
885-
my_set_console_cp(default_charset);
886903
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
887904
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
888905
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
@@ -972,7 +989,7 @@ static void safe_exit(int error, MYSQL *mysql)
972989

973990

974991

975-
static void db_error_with_table(MYSQL *mysql, char *table)
992+
static void db_error_with_table(MYSQL *mysql, const char *table)
976993
{
977994
if (aborting)
978995
return;
@@ -1274,6 +1291,12 @@ int main(int argc, char **argv)
12741291
free_defaults(argv_to_free);
12751292
return(1);
12761293
}
1294+
1295+
if (!strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME))
1296+
default_charset= (char *) my_default_csname();
1297+
my_set_console_cp(default_charset);
1298+
default_charset_info= get_charset_by_csname(default_charset, MY_CS_PRIMARY, 0);
1299+
12771300
if (opt_use_threads > MAX_THREADS)
12781301
{
12791302
fatal_error("Too many connections, max value for --parallel is %d\n",

0 commit comments

Comments
 (0)