Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6aeb40bd
Commit
6aeb40bd
authored
Dec 13, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
c95adec1
5ae05984
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
249 additions
and
17 deletions
+249
-17
Docs/manual.texi
Docs/manual.texi
+6
-0
innobase/btr/btr0cur.c
innobase/btr/btr0cur.c
+65
-2
innobase/dict/dict0dict.c
innobase/dict/dict0dict.c
+11
-3
innobase/include/ut0byte.h
innobase/include/ut0byte.h
+20
-0
innobase/sync/sync0arr.c
innobase/sync/sync0arr.c
+1
-1
innobase/ut/ut0byte.c
innobase/ut/ut0byte.c
+43
-0
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+8
-0
sql/mysql_priv.h
sql/mysql_priv.h
+2
-1
sql/mysqld.cc
sql/mysqld.cc
+58
-0
sql/sql_lex.h
sql/sql_lex.h
+2
-1
sql/sql_parse.cc
sql/sql_parse.cc
+16
-0
sql/table.cc
sql/table.cc
+2
-4
sql/unireg.cc
sql/unireg.cc
+15
-5
No files found.
Docs/manual.texi
View file @
6aeb40bd
...
...
@@ -18274,6 +18274,7 @@ The status variables listed above have the following meaning:
@item @code{Aborted_connects} @tab Number of tries to connect to the MySQL server that failed. @xref{Communication errors}.
@item @code{Bytes_received} @tab Number of bytes received from all clients.
@item @code{Bytes_sent} @tab Number of bytes sent to all clients.
@item @code{Com_xxxx} @tab Number of times the xxx commands has been executed.
@item @code{Connections} @tab Number of connection attempts to the MySQL server.
@item @code{Created_tmp_disk_tables} @tab Number of implicit temporary tables on disk created while executing statements.
@item @code{Created_tmp_tables} @tab Number of implicit temporary tables in memory created while executing statements.
...
...
@@ -47199,6 +47200,11 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.47
@itemize @bullet
@item
Added statistics variables for all MySQL commands. (@code{SHOW STATUS} is
now much longer).
@item
Fix default values for InnoDB tables.
@item
Fixed that @code{GROUP BY expr DESC} works.
@item
Fixed bug when using @code{t1 LEFT JOIN t2 ON t2.key=constant}.
innobase/btr/btr0cur.c
View file @
6aeb40bd
...
...
@@ -85,6 +85,15 @@ btr_rec_free_updated_extern_fields(
inherited fields */
mtr_t
*
mtr
);
/* in: mini-transaction handle which contains
an X-latch to record page and to the tree */
/***************************************************************
Gets the externally stored size of a record, in units of a database page. */
static
ulint
btr_rec_get_externally_stored_len
(
/*==============================*/
/* out: externally stored part, in units of a
database page */
rec_t
*
rec
);
/* in: record */
/*==================== B-TREE SEARCH =========================*/
...
...
@@ -2540,6 +2549,7 @@ btr_estimate_number_of_different_key_vals(
ulint
matched_bytes
;
ulint
*
n_diff
;
ulint
not_empty_flag
=
0
;
ulint
total_external_size
=
0
;
ulint
i
;
ulint
j
;
mtr_t
mtr
;
...
...
@@ -2586,10 +2596,15 @@ btr_estimate_number_of_different_key_vals(
for
(
j
=
matched_fields
+
1
;
j
<=
n_cols
;
j
++
)
{
n_diff
[
j
]
++
;
}
total_external_size
+=
btr_rec_get_externally_stored_len
(
rec
);
rec
=
page_rec_get_next
(
rec
);
}
total_external_size
+=
btr_rec_get_externally_stored_len
(
rec
);
mtr_commit
(
&
mtr
);
}
...
...
@@ -2597,12 +2612,18 @@ btr_estimate_number_of_different_key_vals(
BTR_KEY_VAL_ESTIMATE_N_PAGES leaf pages, we can estimate how many
there will be in index->stat_n_leaf_pages */
/* We must take into account that our sample actually represents
also the pages used for external storage of fields (those pages are
included in index->stat_n_leaf_pages) */
for
(
j
=
0
;
j
<=
n_cols
;
j
++
)
{
index
->
stat_n_diff_key_vals
[
j
]
=
(
n_diff
[
j
]
*
index
->
stat_n_leaf_pages
+
BTR_KEY_VAL_ESTIMATE_N_PAGES
-
1
+
total_external_size
+
not_empty_flag
)
/
BTR_KEY_VAL_ESTIMATE_N_PAGES
;
/
(
BTR_KEY_VAL_ESTIMATE_N_PAGES
+
total_external_size
);
}
mem_free
(
n_diff
);
...
...
@@ -2610,6 +2631,48 @@ btr_estimate_number_of_different_key_vals(
/*================== EXTERNAL STORAGE OF BIG FIELDS ===================*/
/***************************************************************
Gets the externally stored size of a record, in units of a database page. */
static
ulint
btr_rec_get_externally_stored_len
(
/*==============================*/
/* out: externally stored part, in units of a
database page */
rec_t
*
rec
)
/* in: record */
{
ulint
n_fields
;
byte
*
data
;
ulint
local_len
;
ulint
extern_len
;
ulint
total_extern_len
=
0
;
ulint
i
;
if
(
rec_get_data_size
(
rec
)
<=
REC_1BYTE_OFFS_LIMIT
)
{
return
(
0
);
}
n_fields
=
rec_get_n_fields
(
rec
);
for
(
i
=
0
;
i
<
n_fields
;
i
++
)
{
if
(
rec_get_nth_field_extern_bit
(
rec
,
i
))
{
data
=
rec_get_nth_field
(
rec
,
i
,
&
local_len
);
local_len
-=
BTR_EXTERN_FIELD_REF_SIZE
;
extern_len
=
mach_read_from_4
(
data
+
local_len
+
BTR_EXTERN_LEN
+
4
);
total_extern_len
+=
ut_calc_align
(
extern_len
,
UNIV_PAGE_SIZE
);
}
}
return
(
total_extern_len
/
UNIV_PAGE_SIZE
);
}
/***********************************************************************
Sets the ownership bit of an externally stored field in a record. */
static
...
...
innobase/dict/dict0dict.c
View file @
6aeb40bd
...
...
@@ -1765,9 +1765,8 @@ dict_scan_col(
col
=
dict_table_get_nth_col
(
table
,
i
);
if
(
ut_strlen
(
col
->
name
)
==
(
ulint
)(
ptr
-
old_ptr
)
&&
0
==
ut_
memcmp
(
col
->
name
,
old_ptr
,
&&
0
==
ut_
cmp_in_lower_case
(
col
->
name
,
old_ptr
,
(
ulint
)(
ptr
-
old_ptr
)))
{
/* Found */
*
success
=
TRUE
;
...
...
@@ -1831,11 +1830,20 @@ dict_scan_table_name(
break
;
}
}
#ifdef __WIN__
ut_cpy_in_lower_case
(
second_table_name
+
i
,
old_ptr
,
ptr
-
old_ptr
);
#else
ut_memcpy
(
second_table_name
+
i
,
old_ptr
,
ptr
-
old_ptr
);
#endif
second_table_name
[
i
+
(
ptr
-
old_ptr
)]
=
'\0'
;
}
else
{
#ifdef __WIN__
ut_cpy_in_lower_case
(
second_table_name
,
old_ptr
,
ptr
-
old_ptr
);
#else
ut_memcpy
(
second_table_name
,
old_ptr
,
ptr
-
old_ptr
);
#endif
second_table_name
[
dot_ptr
-
old_ptr
]
=
'/'
;
second_table_name
[
ptr
-
old_ptr
]
=
'\0'
;
}
...
...
innobase/include/ut0byte.h
View file @
6aeb40bd
...
...
@@ -220,6 +220,26 @@ ut_bit_set_nth(
ulint
a
,
/* in: ulint */
ulint
n
,
/* in: nth bit requested */
ibool
val
);
/* in: value for the bit to set */
/****************************************************************
Copies a string to a memory location, setting characters to lower case. */
void
ut_cpy_in_lower_case
(
/*=================*/
char
*
dest
,
/* in: destination */
char
*
source
,
/* in: source */
ulint
len
);
/* in: string length */
/****************************************************************
Compares two strings when converted to lower case. */
int
ut_cmp_in_lower_case
(
/*=================*/
/* out: -1, 0, 1 if str1 < str2, str1 == str2,
str1 > str2, respectively */
char
*
str1
,
/* in: string1 */
char
*
str2
,
/* in: string2 */
ulint
len
);
/* in: length of both strings */
#ifndef UNIV_NONINL
...
...
innobase/sync/sync0arr.c
View file @
6aeb40bd
...
...
@@ -905,7 +905,7 @@ sync_array_print_long_waits(void)
cell
=
sync_array_get_nth_cell
(
sync_primary_wait_array
,
i
);
if
(
cell
->
wait_object
!=
NULL
&&
difftime
(
time
(
NULL
),
cell
->
reservation_time
)
>
12
0
)
{
&&
difftime
(
time
(
NULL
),
cell
->
reservation_time
)
>
24
0
)
{
fprintf
(
stderr
,
"InnoDB: Warning: a long semaphore wait:
\n
"
);
...
...
innobase/ut/ut0byte.c
View file @
6aeb40bd
...
...
@@ -30,3 +30,46 @@ ut_dulint_sort(dulint* arr, dulint* aux_arr, ulint low, ulint high)
ut_dulint_cmp
);
}
/****************************************************************
Copies a string to a memory location, setting characters to lower case. */
void
ut_cpy_in_lower_case
(
/*=================*/
char
*
dest
,
/* in: destination */
char
*
source
,
/* in: source */
ulint
len
)
/* in: string length */
{
ulint
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
dest
[
i
]
=
tolower
(
source
[
i
]);
}
}
/****************************************************************
Compares two strings when converted to lower case. */
int
ut_cmp_in_lower_case
(
/*=================*/
/* out: -1, 0, 1 if str1 < str2, str1 == str2,
str1 > str2, respectively */
char
*
str1
,
/* in: string1 */
char
*
str2
,
/* in: string2 */
ulint
len
)
/* in: length of both strings */
{
ulint
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
tolower
(
str1
[
i
])
<
tolower
(
str2
[
i
]))
{
return
(
-
1
);
}
if
(
tolower
(
str1
[
i
])
>
tolower
(
str2
[
i
]))
{
return
(
1
);
}
}
return
(
0
);
}
mysql-test/t/innodb.test
View file @
6aeb40bd
...
...
@@ -563,3 +563,11 @@ explain select a,b from t1 order by b;
explain
select
a
,
b
from
t1
;
explain
select
a
,
b
,
c
from
t1
;
drop
table
t1
;
#
# Check describe
#
create
table
t1
(
testint
int
not
null
default
1
)
type
=
innodb
;
desc
t1
;
drop
table
t1
;
sql/mysql_priv.h
View file @
6aeb40bd
...
...
@@ -592,7 +592,8 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
what_to_log
,
flush_time
,
opt_sql_mode
,
max_tmp_tables
,
max_heap_table_size
,
query_buff_size
,
lower_case_table_names
,
thread_stack
,
thread_stack_min
,
binlog_cache_size
,
max_binlog_cache_size
,
record_rnd_cache_size
;
binlog_cache_size
,
max_binlog_cache_size
,
record_rnd_cache_size
;
extern
ulong
com_stat
[(
uint
)
SQLCOM_END
],
com_other
;
extern
ulong
specialflag
,
current_pid
;
extern
bool
low_priority_updates
,
using_update_log
;
extern
bool
opt_sql_bin_update
,
opt_safe_show_db
,
opt_warnings
,
...
...
sql/mysqld.cc
View file @
6aeb40bd
...
...
@@ -269,6 +269,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
net_interactive_timeout
,
slow_launch_time
=
2L
,
net_read_timeout
,
net_write_timeout
,
slave_open_temp_tables
=
0
,
open_files_limit
=
0
,
max_binlog_size
,
record_rnd_cache_size
;
ulong
com_stat
[(
uint
)
SQLCOM_END
],
com_other
;
ulong
slave_net_timeout
;
ulong
thread_cache_size
=
0
,
binlog_cache_size
=
0
,
max_binlog_cache_size
=
0
;
ulong
query_cache_size
=
0
,
query_cache_limit
=
0
,
query_cache_startup_type
=
1
;
...
...
@@ -3132,6 +3133,63 @@ struct show_var_st status_vars[]= {
{
"Aborted_connects"
,
(
char
*
)
&
aborted_connects
,
SHOW_LONG
},
{
"Bytes_received"
,
(
char
*
)
&
bytes_received
,
SHOW_LONG
},
{
"Bytes_sent"
,
(
char
*
)
&
bytes_sent
,
SHOW_LONG
},
{
"Com_admin_commands"
,
(
char
*
)
&
com_other
,
SHOW_LONG
},
{
"Com_alter_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_ALTER_TABLE
),
SHOW_LONG
},
{
"Com_analyze"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_ANALYZE
),
SHOW_LONG
},
{
"Com_backup_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_BACKUP_TABLE
),
SHOW_LONG
},
{
"Com_begin"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_BEGIN
),
SHOW_LONG
},
{
"Com_change_db"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_CHANGE_DB
),
SHOW_LONG
},
{
"Com_change_master"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_CHANGE_MASTER
),
SHOW_LONG
},
{
"Com_check"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_CHECK
),
SHOW_LONG
},
{
"Com_commit"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_COMMIT
),
SHOW_LONG
},
{
"Com_create_db"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_CREATE_DB
),
SHOW_LONG
},
{
"Com_create_function"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_CREATE_FUNCTION
),
SHOW_LONG
},
{
"Com_create_index"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_CREATE_INDEX
),
SHOW_LONG
},
{
"Com_create_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_CREATE_TABLE
),
SHOW_LONG
},
{
"Com_delete"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_DELETE
),
SHOW_LONG
},
{
"Com_drop_db"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_DROP_DB
),
SHOW_LONG
},
{
"Com_drop_function"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_DROP_FUNCTION
),
SHOW_LONG
},
{
"Com_drop_index"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_DROP_INDEX
),
SHOW_LONG
},
{
"Com_drop_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_DROP_TABLE
),
SHOW_LONG
},
{
"Com_flush"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_FLUSH
),
SHOW_LONG
},
{
"Com_grant"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_GRANT
),
SHOW_LONG
},
{
"Com_insert"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_INSERT
),
SHOW_LONG
},
{
"Com_insert_select"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_INSERT_SELECT
),
SHOW_LONG
},
{
"Com_kill"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_KILL
),
SHOW_LONG
},
{
"Com_load"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_LOAD
),
SHOW_LONG
},
{
"Com_load_master_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_LOAD_MASTER_TABLE
),
SHOW_LONG
},
{
"Com_lock_tables"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_LOCK_TABLES
),
SHOW_LONG
},
{
"Com_optimize"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_OPTIMIZE
),
SHOW_LONG
},
{
"Com_purge"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_PURGE
),
SHOW_LONG
},
{
"Com_rename_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_RENAME_TABLE
),
SHOW_LONG
},
{
"Com_repair"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_REPAIR
),
SHOW_LONG
},
{
"Com_replace"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_REPLACE
),
SHOW_LONG
},
{
"Com_replace_select"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_REPLACE_SELECT
),
SHOW_LONG
},
{
"Com_reset"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_RESET
),
SHOW_LONG
},
{
"Com_restore_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_RESTORE_TABLE
),
SHOW_LONG
},
{
"Com_revoke"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_REVOKE
),
SHOW_LONG
},
{
"Com_rollback"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_ROLLBACK
),
SHOW_LONG
},
{
"Com_select"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SELECT
),
SHOW_LONG
},
{
"Com_set_option"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SET_OPTION
),
SHOW_LONG
},
{
"Com_show_binlogs"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_BINLOGS
),
SHOW_LONG
},
{
"Com_show_create"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_CREATE
),
SHOW_LONG
},
{
"Com_show_databases"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_DATABASES
),
SHOW_LONG
},
{
"Com_show_fields"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_FIELDS
),
SHOW_LONG
},
{
"Com_show_grants"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_GRANTS
),
SHOW_LONG
},
{
"Com_show_keys"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_KEYS
),
SHOW_LONG
},
{
"Com_show_logs"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_LOGS
),
SHOW_LONG
},
{
"Com_show_master_STAT"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_MASTER_STAT
),
SHOW_LONG
},
{
"Com_show_open_tables"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_OPEN_TABLES
),
SHOW_LONG
},
{
"Com_show_processlist"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_PROCESSLIST
),
SHOW_LONG
},
{
"Com_show_slave_stat"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_SLAVE_STAT
),
SHOW_LONG
},
{
"Com_show_status"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_STATUS
),
SHOW_LONG
},
{
"Com_show_tables"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_TABLES
),
SHOW_LONG
},
{
"Com_show_variables"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SHOW_VARIABLES
),
SHOW_LONG
},
{
"Com_slave_start"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SLAVE_START
),
SHOW_LONG
},
{
"Com_slave_stop"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_SLAVE_STOP
),
SHOW_LONG
},
{
"Com_truncate"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_TRUNCATE
),
SHOW_LONG
},
{
"Com_unlock_tables"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_UNLOCK_TABLES
),
SHOW_LONG
},
{
"Com_update"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_UPDATE
),
SHOW_LONG
},
{
"Connections"
,
(
char
*
)
&
thread_id
,
SHOW_LONG_CONST
},
{
"Created_tmp_disk_tables"
,
(
char
*
)
&
created_tmp_disk_tables
,
SHOW_LONG
},
{
"Created_tmp_tables"
,
(
char
*
)
&
created_tmp_tables
,
SHOW_LONG
},
...
...
sql/sql_lex.h
View file @
6aeb40bd
...
...
@@ -56,7 +56,8 @@ enum enum_sql_command {
SQLCOM_SHOW_OPEN_TABLES
,
SQLCOM_LOAD_MASTER_DATA
,
SQLCOM_HA_OPEN
,
SQLCOM_HA_CLOSE
,
SQLCOM_HA_READ
,
SQLCOM_SHOW_SLAVE_HOSTS
,
SQLCOM_MULTI_DELETE
,
SQLCOM_SHOW_BINLOG_EVENTS
,
SQLCOM_SHOW_NEW_MASTER
SQLCOM_SHOW_BINLOG_EVENTS
,
SQLCOM_SHOW_NEW_MASTER
,
SQLCOM_END
};
enum
lex_states
{
STATE_START
,
STATE_CHAR
,
STATE_IDENT
,
...
...
sql/sql_parse.cc
View file @
6aeb40bd
...
...
@@ -768,6 +768,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd
->
lex
.
select_lex
.
options
=
0
;
// We store status here
switch
(
command
)
{
case
COM_INIT_DB
:
thread_safe_increment
(
com_stat
[
SQLCOM_CHANGE_DB
],
&
LOCK_thread_count
);
if
(
!
mysql_change_db
(
thd
,
packet
))
mysql_log
.
write
(
thd
,
command
,
"%s"
,
thd
->
db
);
break
;
...
...
@@ -781,6 +782,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case
COM_TABLE_DUMP
:
{
thread_safe_increment
(
com_other
,
&
LOCK_thread_count
);
slow_command
=
TRUE
;
uint
db_len
=
*
(
uchar
*
)
packet
;
uint
tbl_len
=
*
(
uchar
*
)(
packet
+
db_len
+
1
);
...
...
@@ -797,6 +799,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case
COM_CHANGE_USER
:
{
thread_safe_increment
(
com_other
,
&
LOCK_thread_count
);
char
*
user
=
(
char
*
)
packet
;
char
*
passwd
=
strend
(
user
)
+
1
;
char
*
db
=
strend
(
passwd
)
+
1
;
...
...
@@ -863,6 +866,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
char
*
fields
;
TABLE_LIST
table_list
;
thread_safe_increment
(
com_stat
[
SQLCOM_SHOW_FIELDS
],
&
LOCK_thread_count
);
bzero
((
char
*
)
&
table_list
,
sizeof
(
table_list
));
if
(
!
(
table_list
.
db
=
thd
->
db
))
{
...
...
@@ -887,6 +891,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
#endif
case
COM_QUIT
:
/* We don't calculate statistics for this command */
mysql_log
.
write
(
thd
,
command
,
NullS
);
net
->
error
=
0
;
// Don't give 'abort' message
error
=
TRUE
;
// End server
...
...
@@ -894,6 +899,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case
COM_CREATE_DB
:
// QQ: To be removed
{
thread_safe_increment
(
com_stat
[
SQLCOM_CREATE_DB
],
&
LOCK_thread_count
);
char
*
db
=
thd
->
strdup
(
packet
);
// null test to handle EOM
if
(
!
db
||
!
stripp_sp
(
db
)
||
check_db_name
(
db
))
...
...
@@ -909,6 +915,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case
COM_DROP_DB
:
// QQ: To be removed
{
thread_safe_increment
(
com_stat
[
SQLCOM_DROP_DB
],
&
LOCK_thread_count
);
char
*
db
=
thd
->
strdup
(
packet
);
// null test to handle EOM
if
(
!
db
||
!
stripp_sp
(
db
)
||
check_db_name
(
db
))
...
...
@@ -927,6 +934,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case
COM_BINLOG_DUMP
:
{
thread_safe_increment
(
com_other
,
&
LOCK_thread_count
);
slow_command
=
TRUE
;
if
(
check_access
(
thd
,
FILE_ACL
,
any_db
))
break
;
...
...
@@ -951,6 +959,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
case
COM_REFRESH
:
{
thread_safe_increment
(
com_stat
[
SQLCOM_FLUSH
],
&
LOCK_thread_count
);
ulong
options
=
(
ulong
)
(
uchar
)
packet
[
0
];
if
(
check_access
(
thd
,
RELOAD_ACL
,
any_db
))
break
;
...
...
@@ -962,6 +971,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
}
case
COM_SHUTDOWN
:
thread_safe_increment
(
com_other
,
&
LOCK_thread_count
);
if
(
check_access
(
thd
,
SHUTDOWN_ACL
,
any_db
))
break
;
/* purecov: inspected */
DBUG_PRINT
(
"quit"
,(
"Got shutdown command"
));
...
...
@@ -983,6 +993,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case
COM_STATISTICS
:
{
mysql_log
.
write
(
thd
,
command
,
NullS
);
thread_safe_increment
(
com_stat
[
SQLCOM_SHOW_STATUS
],
&
LOCK_thread_count
);
char
buff
[
200
];
ulong
uptime
=
(
ulong
)
(
thd
->
start_time
-
start_time
);
sprintf
((
char
*
)
buff
,
...
...
@@ -1001,9 +1012,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
}
case
COM_PING
:
thread_safe_increment
(
com_other
,
&
LOCK_thread_count
);
send_ok
(
net
);
// Tell client we are alive
break
;
case
COM_PROCESS_INFO
:
thread_safe_increment
(
com_stat
[
SQLCOM_SHOW_PROCESSLIST
],
&
LOCK_thread_count
);
if
(
!
thd
->
priv_user
[
0
]
&&
check_process_priv
(
thd
))
break
;
mysql_log
.
write
(
thd
,
command
,
NullS
);
...
...
@@ -1012,11 +1025,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break
;
case
COM_PROCESS_KILL
:
{
thread_safe_increment
(
com_stat
[
SQLCOM_KILL
],
&
LOCK_thread_count
);
ulong
id
=
(
ulong
)
uint4korr
(
packet
);
kill_one_thread
(
thd
,
id
);
break
;
}
case
COM_DEBUG
:
thread_safe_increment
(
com_other
,
&
LOCK_thread_count
);
if
(
check_process_priv
(
thd
))
break
;
/* purecov: inspected */
mysql_print_status
(
thd
);
...
...
@@ -1093,6 +1108,7 @@ mysql_execute_command(void)
!
tables_ok
(
thd
,
tables
)))
DBUG_VOID_RETURN
;
thread_safe_increment
(
com_stat
[
lex
->
sql_command
],
&
LOCK_thread_count
);
switch
(
lex
->
sql_command
)
{
case
SQLCOM_SELECT
:
{
...
...
sql/table.cc
View file @
6aeb40bd
...
...
@@ -120,10 +120,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam
->
db_record_offset
=
1
;
if
(
db_create_options
&
HA_OPTION_LONG_BLOB_PTR
)
outparam
->
blob_ptr_size
=
portable_sizeof_char_ptr
;
outparam
->
db_low_byte_first
=
test
(
outparam
->
db_type
==
DB_TYPE_MYISAM
||
outparam
->
db_type
==
DB_TYPE_BERKELEY_DB
||
outparam
->
db_type
==
DB_TYPE_HEAP
);
/* Set temporaryly a good value for db_low_byte_first */
outparam
->
db_low_byte_first
=
test
(
outparam
->
db_type
!=
DB_TYPE_ISAM
);
error
=
4
;
outparam
->
max_rows
=
uint4korr
(
head
+
18
);
outparam
->
min_rows
=
uint4korr
(
head
+
22
);
...
...
sql/unireg.cc
View file @
6aeb40bd
...
...
@@ -515,16 +515,23 @@ static bool make_empty_rec(File file,enum db_type table_type,
uchar
*
buff
,
*
null_pos
;
TABLE
table
;
create_field
*
field
;
handler
*
handler
;
DBUG_ENTER
(
"make_empty_rec"
);
/* We need a table to generate columns for default values */
bzero
((
char
*
)
&
table
,
sizeof
(
table
));
table
.
db_low_byte_first
=
test
(
table_type
==
DB_TYPE_MYISAM
||
table_type
==
DB_TYPE_HEAP
);
table
.
blob_ptr_size
=
portable_sizeof_char_ptr
;
handler
=
get_new_handler
((
TABLE
*
)
0
,
table_type
);
if
(
!
(
buff
=
(
uchar
*
)
my_malloc
((
uint
)
reclength
,
MYF
(
MY_WME
|
MY_ZEROFILL
))))
if
(
!
handler
||
!
(
buff
=
(
uchar
*
)
my_malloc
((
uint
)
reclength
,
MYF
(
MY_WME
|
MY_ZEROFILL
))))
{
delete
handler
;
DBUG_RETURN
(
1
);
}
table
.
db_low_byte_first
=
handler
->
low_byte_first
();
table
.
blob_ptr_size
=
portable_sizeof_char_ptr
;
firstpos
=
reclength
;
null_count
=
0
;
if
(
!
(
table_options
&
HA_OPTION_PACK_RECORD
))
...
...
@@ -574,8 +581,11 @@ static bool make_empty_rec(File file,enum db_type table_type,
regfield
->
reset
();
delete
regfield
;
}
bfill
((
byte
*
)
buff
+
null_length
,
firstpos
-
null_length
,
255
);
/* Fill not used startpos */
/* Fill not used startpos */
bfill
((
byte
*
)
buff
+
null_length
,
firstpos
-
null_length
,
255
);
error
=
(
int
)
my_write
(
file
,(
byte
*
)
buff
,(
uint
)
reclength
,
MYF_RW
);
my_free
((
gptr
)
buff
,
MYF
(
MY_FAE
));
delete
handler
;
DBUG_RETURN
(
error
);
}
/* make_empty_rec */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment