mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-29609 create_not_windows test fails with different result
make_tmp_name() creates temporary name with prefix containing PID and TID. This prefix influences max length of the rest of the name (the whole name is limited by NAME_LEN). During the test run PID and TID can change. PID increases when the server restarts. TID is incremented with the new connections (generated by next_thread_id(), is not the posix thread ID). During the test run PID can increase max 2 decimal positions: from tens to thousands this requires ~900 restarts. TID depends on connection count, but for test we assume it will not trespass 100000 connections which is 5 decimal positions. So it should be enough to reserve 7 characters for PID and TID increment. The patch reserves more: it reserves 12 characters for 7-decimal PID and 5-decimal TID plus 4 chars of additional reserve (for future prefix changes) and assumes minimal legth of the prefix is 30 bytes: #sql-backup-PID-TID- #sql-create-PID-TID- 4-6-PID-TID- is 10 + 4 + PID + TID, so PID + TID is 16 chars (7 + 5 + 4).
This commit is contained in:
@ -57,11 +57,11 @@ tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎
|
|||||||
set @@debug_dbug="+d,ddl_log_create_after_save_backup", @debug_crash_counter=1;
|
set @@debug_dbug="+d,ddl_log_create_after_save_backup", @debug_crash_counter=1;
|
||||||
create or replace table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ (z int);
|
create or replace table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎ (z int);
|
||||||
ERROR HY000: Lost connection to server during query
|
ERROR HY000: Lost connection to server during query
|
||||||
#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYD
|
#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYD
|
||||||
#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYI
|
#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYI
|
||||||
#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.frm
|
#sql-backup-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.frm
|
||||||
#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYD
|
#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYD
|
||||||
#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYI
|
#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.MYI
|
||||||
#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.frm
|
#sql-create-PID-TID-tttttttttttttttttttttttt@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e@274e.frm
|
||||||
drop table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎;
|
drop table tttttttttttttttttttttttt❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎❎;
|
||||||
set @@debug_dbug="";
|
set @@debug_dbug="";
|
||||||
|
@ -1251,13 +1251,19 @@ bool make_tmp_name(THD *thd, const char *prefix, const Table_name *orig,
|
|||||||
char res_name[NAME_LEN + 1];
|
char res_name[NAME_LEN + 1];
|
||||||
char file_name[NAME_LEN + 1];
|
char file_name[NAME_LEN + 1];
|
||||||
LEX_CSTRING table_name;
|
LEX_CSTRING table_name;
|
||||||
|
/*
|
||||||
|
Filename trimming should not depend on prefix length with variable PID and
|
||||||
|
thread ID. This makes tests happier.
|
||||||
|
*/
|
||||||
|
constexpr int MIN_PREFIX= 30;
|
||||||
|
|
||||||
size_t len= my_snprintf(res_name, sizeof(res_name) - 1,
|
size_t len= my_snprintf(res_name, sizeof(res_name) - 1,
|
||||||
tmp_file_prefix "-%s-%lx-%llx-", prefix,
|
tmp_file_prefix "-%s-%lx-%llx-", prefix,
|
||||||
current_pid, thd->thread_id);
|
current_pid, thd->thread_id);
|
||||||
|
|
||||||
|
const size_t pfx_len= len < MIN_PREFIX ? MIN_PREFIX : len;
|
||||||
uint len2= tablename_to_filename(orig->table_name.str, file_name,
|
uint len2= tablename_to_filename(orig->table_name.str, file_name,
|
||||||
sizeof(res_name) - len - 1);
|
sizeof(res_name) - pfx_len - 1);
|
||||||
|
|
||||||
DBUG_ASSERT(len + len2 < sizeof(res_name) - 1);
|
DBUG_ASSERT(len + len2 < sizeof(res_name) - 1);
|
||||||
memcpy(res_name + len, file_name, len2 + 1);
|
memcpy(res_name + len, file_name, len2 + 1);
|
||||||
|
Reference in New Issue
Block a user