Skip to content

Commit 3f388a1

Browse files
committed
Merge branch '11.8' into 12.3
2 parents 6b79d98 + a343e60 commit 3f388a1

716 files changed

Lines changed: 20504 additions & 9665 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Docs/INFO_BIN
3131
Docs/INFO_SRC
3232
Makefile
3333
TAGS
34+
all_plugins/
3435
mariadb-plugin-columnstore.install.generated
3536
Testing/
3637
tmp/
@@ -60,8 +61,11 @@ extra/comp_err
6061
extra/innochecksum
6162
extra/jemalloc/build/
6263
extra/jemalloc/tmp/
64+
extra/generate_option_list
6365
extra/mariabackup/mariabackup
6466
extra/mariabackup/mbstream
67+
extra/mariadb-migrate-config-file
68+
extra/mariadbd_options.h
6569
extra/my_print_defaults
6670
extra/mysql_waitpid
6771
extra/mysqld_safe_helper

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,6 @@ ADD_SUBDIRECTORY(vio)
509509
ADD_SUBDIRECTORY(mysys)
510510
ADD_SUBDIRECTORY(mysys_ssl)
511511
ADD_SUBDIRECTORY(client)
512-
ADD_SUBDIRECTORY(extra)
513512
ADD_SUBDIRECTORY(libservices)
514513
ADD_SUBDIRECTORY(sql/share)
515514

@@ -535,6 +534,8 @@ IF(NOT WITHOUT_SERVER)
535534
ENDIF()
536535
ENDIF()
537536

537+
ADD_SUBDIRECTORY(extra)
538+
538539
IF(UNIX)
539540
ADD_SUBDIRECTORY(man)
540541
ENDIF()

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ MariaDB Server has a vibrant community contributing in a wide range of areas. Th
88
- [maria-developers mailing list](https://lists.mariadb.org/postorius/lists/developers.lists.mariadb.org/)
99
- [maria-discuss mailing list](https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/)
1010
- [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).
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
14-
----
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.
14+
---
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 develop MariaDB
19-
-----
19+
---
2020
- Fix bugs or develop new features
2121
- Review code contributions
2222
- Test bug fixes and features
@@ -34,10 +34,10 @@ You’re very welcome to support MariaDB Server as an individual, or talk your c
3434
---
3535
- Attend an event
3636
- [Events and Conferences page](https://mariadb.org/events/)
37-
- [mariadb.meetup.com](http://mariadb.meetup.com/)
37+
- [mariadb.meetup.com](https://mariadb.meetup.com/)
3838

3939
### Live Q&A for beginner contributors
40-
----
40+
---
4141
MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip.
4242
From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, anyone can ask any questions they’d like,
4343
and a live developer will be available to assist.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
MYSQL_VERSION_MAJOR=12
22
MYSQL_VERSION_MINOR=3
33
MYSQL_VERSION_PATCH=2
4-
SERVER_MATURITY=gamma
4+
SERVER_MATURITY=stable

client/mysql.cc

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,8 +1171,9 @@ static void print_tab_data(MYSQL_RES *result);
11711171
static void print_table_data_vertically(MYSQL_RES *result);
11721172
static void print_warnings(void);
11731173
static void print_last_query_cost(void);
1174-
static void end_timer(ulonglong start_time, char *buff);
1175-
static void nice_time(double sec,char *buff,bool part_second);
1174+
static void end_timer(ulonglong start_time, char *buff, size_t buff_size);
1175+
static void nice_time(double sec, char *buff, size_t buff_size,
1176+
bool part_second);
11761177
extern "C" sig_handler mysql_end(int sig) __attribute__ ((noreturn));
11771178
extern "C" sig_handler handle_sigint(int sig);
11781179
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
@@ -1442,18 +1443,20 @@ int main(int argc,char *argv[])
14421443
histfile=my_strdup(PSI_NOT_INSTRUMENTED, histfile, MYF(MY_WME));
14431444
else if ((home= getenv("HOME")))
14441445
{
1446+
size_t histfile_size=
1447+
strlen(home) + strlen("/.mysql_history") + 2;
14451448
histfile=(char*) my_malloc(PSI_NOT_INSTRUMENTED,
1446-
strlen(home) + strlen("/.mariadb_history")+2, MYF(MY_WME));
1449+
histfile_size, MYF(MY_WME));
14471450
if (histfile)
14481451
{
1449-
sprintf(histfile,"%s/.mariadb_history", home);
1452+
snprintf(histfile, histfile_size, "%s/.mariadb_history", home);
14501453
if (my_access(histfile, F_OK))
14511454
{
14521455
/* no .mariadb_history, look for historical name and use if present */
1453-
sprintf(histfile,"%s/.mysql_history", home);
1456+
snprintf(histfile, histfile_size, "%s/.mysql_history", home);
14541457
/* and go back to original if not found */
14551458
if (my_access(histfile, F_OK))
1456-
sprintf(histfile,"%s/.mariadb_history", home);
1459+
snprintf(histfile, histfile_size, "%s/.mariadb_history", home);
14571460
}
14581461
char link_name[FN_REFLEN];
14591462
if (my_readlink(link_name, histfile, 0) == 0 &&
@@ -1499,7 +1502,7 @@ int main(int argc,char *argv[])
14991502

15001503
#endif
15011504

1502-
sprintf(buff, "%s",
1505+
snprintf(buff, sizeof(buff), "%s",
15031506
"Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n");
15041507
put_info(buff,INFO_INFO);
15051508
status.exit_status= read_and_execute(!status.batch);
@@ -1670,7 +1673,7 @@ bool kill_query(const char *reason)
16701673
interrupted_query= 2;
16711674

16721675
/* kill_buffer is always big enough because max length of %lu is 15 */
1673-
sprintf(kill_buffer, "KILL %s%lu",
1676+
snprintf(kill_buffer, sizeof(kill_buffer), "KILL %s%lu",
16741677
(interrupted_query == 1) ? "QUERY " : "",
16751678
mysql_thread_id(&mysql));
16761679
if (verbose)
@@ -2734,7 +2737,7 @@ static bool add_line(String &buffer, char *line, size_t line_length,
27342737
}
27352738
else
27362739
{
2737-
sprintf(buff,"Unknown command '\\%c'.",inchar);
2740+
snprintf(buff, sizeof(buff), "Unknown command '\\%c'.", inchar);
27382741
if (put_info(buff,INFO_ERROR) > 0)
27392742
DBUG_RETURN(1);
27402743
*out++='\\';
@@ -3263,7 +3266,7 @@ You can turn off this feature to get a quicker startup with -A\n\n");
32633266
j=0;
32643267
while ((sql_field=mysql_fetch_field(fields)))
32653268
{
3266-
sprintf(buf,"%.64s.%.64s",table_row[0],sql_field->name);
3269+
snprintf(buf, sizeof(buf), "%.64s.%.64s",table_row[0], sql_field->name);
32673270
field_names[i][j] = strdup_root(&hash_mem_root,buf);
32683271
add_word(&ht,field_names[i][j]);
32693272
field_names[i][num_fields+j] = strdup_root(&hash_mem_root,
@@ -3707,7 +3710,7 @@ static int com_go(String *buffer, char *)
37073710

37083711
report_progress_end();
37093712
if (verbose >= 3 || !opt_silent)
3710-
end_timer(timer, time_buff);
3713+
end_timer(timer, time_buff, sizeof(time_buff));
37113714
else
37123715
time_buff[0]= '\0';
37133716

@@ -3743,9 +3746,9 @@ static int com_go(String *buffer, char *)
37433746
print_tab_data(result);
37443747
else
37453748
print_table_data(result);
3746-
sprintf(buff,"%ld %s in set",
3747-
(long) mysql_num_rows(result),
3748-
(long) mysql_num_rows(result) == 1 ? "row" : "rows");
3749+
snprintf(buff, sizeof(buff), "%llu %s in set",
3750+
(unsigned long long) mysql_num_rows(result),
3751+
mysql_num_rows(result) == 1 ? "row" : "rows");
37493752
end_pager();
37503753
if (mysql_errno(&mysql))
37513754
{
@@ -3758,9 +3761,9 @@ static int com_go(String *buffer, char *)
37583761
else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0)
37593762
strmov(buff,"Query OK");
37603763
else
3761-
sprintf(buff,"Query OK, %ld %s affected",
3762-
(long) mysql_affected_rows(&mysql),
3763-
(long) mysql_affected_rows(&mysql) == 1 ? "row" : "rows");
3764+
snprintf(buff, sizeof(buff), "Query OK, %llu %s affected",
3765+
(unsigned long long) mysql_affected_rows(&mysql),
3766+
mysql_affected_rows(&mysql) == 1 ? "row" : "rows");
37643767

37653768
pos=strend(buff);
37663769
if ((warnings= mysql_warning_count(&mysql)))
@@ -3938,7 +3941,7 @@ static char *fieldflags2str(uint f) {
39383941
ff2s_check_flag(ON_UPDATE_NOW);
39393942
#undef ff2s_check_flag
39403943
if (f)
3941-
sprintf(s, " unknows=0x%04x", f);
3944+
snprintf(s, sizeof(buf) - (size_t)(s - buf), " unknown=0x%04x", f);
39423945
return buf;
39433946
}
39443947

@@ -4689,8 +4692,10 @@ com_edit(String *buffer,char *)
46894692
strxmov(buff,editor," ",filename,NullS);
46904693
if ((error= system(buff)))
46914694
{
4692-
char errmsg[100];
4693-
sprintf(errmsg, "Command '%.40s' failed", buff);
4695+
#define EDITOR_FAIL_MSG "Command '%.40s' failed"
4696+
char errmsg[sizeof(EDITOR_FAIL_MSG) - 1 + 40];
4697+
snprintf(errmsg, sizeof(errmsg), EDITOR_FAIL_MSG, buff);
4698+
#undef EDITOR_FAIL_MSG
46944699
put_info(errmsg, INFO_ERROR, 0, NullS);
46954700
goto err;
46964701
}
@@ -4836,9 +4841,9 @@ static int com_connect(String *buffer, char *line)
48364841

48374842
if (connected)
48384843
{
4839-
sprintf(buff,"Connection id: %lu",mysql_thread_id(&mysql));
4844+
snprintf(buff, sizeof(buff), "Connection id: %lu",mysql_thread_id(&mysql));
48404845
put_info(buff,INFO_INFO);
4841-
sprintf(buff,"Current database: %.128s\n",
4846+
snprintf(buff, sizeof(buff), "Current database: %.128s\n",
48424847
current_db ? current_db : "*** NONE ***");
48434848
put_info(buff,INFO_INFO);
48444849
}
@@ -5190,7 +5195,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
51905195
if (safe_updates)
51915196
{
51925197
char init_command[100];
5193-
sprintf(init_command,
5198+
snprintf(init_command, sizeof(init_command),
51945199
"SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,MAX_JOIN_SIZE=%lu",
51955200
select_limit,max_join_size);
51965201
mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command);
@@ -5386,7 +5391,7 @@ static int com_status(String *, char *)
53865391
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
53875392
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
53885393
{
5389-
nice_time((double) sec,buff,0);
5394+
nice_time((double) sec,buff, sizeof(buff),0);
53905395
tee_puts(buff, stdout); /* print nice time */
53915396
while (*status_str == ' ')
53925397
status_str++; /* to next info */
@@ -5605,8 +5610,10 @@ void tee_putc(int c, FILE *file)
56055610
56065611
len("4294967296 days, 23 hours, 59 minutes, 60.000 seconds") -> 53
56075612
*/
5608-
static void nice_time(double sec, char *buff, bool part_second)
5613+
static void nice_time(double sec, char *buff, size_t buff_size,
5614+
bool part_second)
56095615
{
5616+
char *buff_end= buff + buff_size;
56105617
ulong tmp;
56115618
if (sec >= 3600.0*24)
56125619
{
@@ -5630,21 +5637,23 @@ static void nice_time(double sec, char *buff, bool part_second)
56305637
buff=strmov(buff," min ");
56315638
}
56325639
if (part_second)
5633-
sprintf(buff,"%.3f sec",sec);
5640+
snprintf(buff, buff_end - buff, "%.3f sec", sec);
56345641
else
5635-
sprintf(buff,"%d sec",(int) sec);
5642+
snprintf(buff, buff_end - buff, "%d sec", (int) sec);
56365643
}
56375644

56385645

5639-
static void end_timer(ulonglong start_time, char *buff)
5646+
static void end_timer(ulonglong start_time, char *buff, size_t buff_size)
56405647
{
56415648
double sec;
56425649

5650+
if (buff_size < 4)
5651+
return;
56435652
buff[0]=' ';
56445653
buff[1]='(';
56455654
sec= (microsecond_interval_timer() - start_time) / (double) (1000 * 1000);
5646-
nice_time(sec, buff + 2, 1);
5647-
strmov(strend(buff),")");
5655+
nice_time(sec, buff + 2, buff_size - 2, 1);
5656+
snprintf(strend(buff), buff_size - (strend(buff) - buff), ")");
56485657
}
56495658

56505659
static const char *construct_prompt()

client/mysql_upgrade.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
511511
static void find_tool(char *tool_executable_name, const char *tool_name,
512512
const char *self_name)
513513
{
514-
char *last_fn_libchar;
514+
const char *last_fn_libchar;
515515
DYNAMIC_STRING ds_tmp;
516516
DBUG_ENTER("find_tool");
517517
DBUG_PRINT("enter", ("progname: %s", my_progname));

client/mysqladmin.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ static int drop_db(MYSQL *mysql, const char *db)
13671367
return -1;
13681368
}
13691369
}
1370-
snprintf(name_buff,sizeof(name_buff), "drop database `%.*s`",FN_REFLEN,db);
1370+
snprintf(name_buff, sizeof(name_buff), "drop database `%.*s`",FN_REFLEN,db);
13711371
if (mysql_query(mysql,name_buff))
13721372
{
13731373
my_printf_error(0, "DROP DATABASE %s failed;\nerror: '%s'", error_flags,

client/mysqlbinlog.cc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,14 @@ class Load_log_processor
332332
@retval -1 Error (can't find new filename).
333333
@retval >=0 Found file.
334334
*/
335-
File create_unique_file(char *filename, char *file_name_end, size_t file_name_end_size)
335+
File create_unique_file(char *filename, char *file_name_end,
336+
size_t buf_remaining)
336337
{
337338
File res;
338339
/* If we have to try more than 1000 times, something is seriously wrong */
339340
for (uint version= 0; version<1000; version++)
340341
{
341-
snprintf(file_name_end, file_name_end_size,"-%x",version);
342+
snprintf(file_name_end, buf_remaining, "-%x", version);
342343
if ((res= my_create(filename,0,
343344
O_CREAT|O_EXCL|O_BINARY|O_WRONLY,MYF(0)))!=-1)
344345
return res;
@@ -460,9 +461,12 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
460461
ptr= fname + target_dir_name_len;
461462
memcpy(ptr,bname,blen);
462463
ptr+= blen;
463-
ptr+= snprintf(ptr, full_len - (ptr - fname), "-%x", file_id);
464+
//ptr points to fname (with the size = full_len) + target_dir_name_len
465+
//so the rest of fname has size full_len - target_dir_name_len
466+
ptr+= snprintf(ptr, full_len - target_dir_name_len, "-%x", file_id);
464467

465-
if ((file= create_unique_file(fname,ptr,full_len - (ptr - fname))) < 0)
468+
if ((file= create_unique_file(fname, ptr,
469+
full_len - (size_t) (ptr - fname))) < 0)
466470
{
467471
error("Could not construct local filename %s%s.",
468472
target_dir_name,bname);
@@ -1326,8 +1330,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
13261330
exit(1);
13271331
}
13281332

1329-
memset(tmp_sql, 0, sizeof(tmp_sql));
1330-
sprintf(tmp_sql, " "
1333+
snprintf(tmp_sql, sizeof(tmp_sql), " "
13311334
"SELECT Group_concat(cols) "
13321335
"FROM (SELECT 'op_type char(1)' cols "
13331336
" UNION ALL "
@@ -1373,13 +1376,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
13731376
}
13741377
else
13751378
{
1376-
memset(tmp_sql, 0, sizeof(tmp_sql));
1377-
sprintf(tmp_sql, "__%s", map->get_table_name());
1379+
snprintf(tmp_sql, sizeof(tmp_sql), "__%s", map->get_table_name());
13781380
ev->set_flashback_review_tablename(tmp_sql);
13791381
}
1380-
memset(tmp_sql, 0, sizeof(tmp_sql));
1381-
tmp_sql_offset= sprintf(tmp_sql, "CREATE TABLE IF NOT EXISTS");
1382-
tmp_sql_offset+= sprintf(tmp_sql + tmp_sql_offset, " `%s`.`%s` (%s) %s",
1382+
tmp_sql_offset= snprintf(tmp_sql, sizeof(tmp_sql), "CREATE TABLE IF NOT EXISTS");
1383+
tmp_sql_offset+= snprintf(tmp_sql + tmp_sql_offset, sizeof(tmp_sql) - (uint) tmp_sql_offset, " `%s`.`%s` (%s) %s",
13831384
ev->get_flashback_review_dbname(),
13841385
ev->get_flashback_review_tablename(),
13851386
row[0],
@@ -1403,7 +1404,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
14031404
else
14041405
{
14051406
memset(tmp_str, 0, sizeof(tmp_str));
1406-
sprintf(tmp_str, "__%s", map->get_table_name());
1407+
snprintf(tmp_str, sizeof(tmp_str), "__%s", map->get_table_name());
14071408
ev->set_flashback_review_tablename(tmp_str);
14081409
}
14091410
}
@@ -2659,8 +2660,8 @@ static Exit_status check_master_version()
26592660
rpl_gtid *start_gtid= &start_gtids[gtid_idx];
26602661

26612662
snprintf(buf, sizeof(buf), "%u-%u-%llu",
2662-
start_gtid->domain_id, start_gtid->server_id,
2663-
start_gtid->seq_no);
2663+
start_gtid->domain_id, start_gtid->server_id,
2664+
start_gtid->seq_no);
26642665
query_str.append(buf, strlen(buf));
26652666
if (gtid_idx < n_start_gtids - 1)
26662667
query_str.append(',');

client/mysqlcheck.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ static int handle_request_for_tables(char *tables, size_t length,
984984
DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size);
985985

986986
/* No backticks here as we added them before */
987-
query_length= sprintf(query, "%s%s%s %s", op,
987+
query_length= snprintf(query, query_size, "%s%s%s %s", op,
988988
tab_view, tables, options);
989989
table_name= tables;
990990
}
@@ -1013,7 +1013,7 @@ static int handle_request_for_tables(char *tables, size_t length,
10131013
print_result();
10141014
if (opt_flush_tables)
10151015
{
1016-
query_length= sprintf(query, "FLUSH TABLES %s", table_name);
1016+
query_length= snprintf(query, query_size, "FLUSH TABLES %s", table_name);
10171017
if (mysql_real_query(sock, query, (ulong)query_length))
10181018
{
10191019
DBerror(sock, query);

0 commit comments

Comments
 (0)