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
bb6be1e1
Commit
bb6be1e1
authored
Jun 22, 2006
by
acurtis@bk-internal.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/data0/bk/tmp-5.1
into bk-internal.mysql.com:/data0/bk/mysql-5.1-engines
parents
6d40321b
4c52d3dd
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
243 additions
and
111 deletions
+243
-111
mysql-test/r/fulltext2.result
mysql-test/r/fulltext2.result
+8
-0
mysql-test/r/lock_multi.result
mysql-test/r/lock_multi.result
+8
-0
mysql-test/t/fulltext2.test
mysql-test/t/fulltext2.test
+10
-0
mysql-test/t/lock_multi.test
mysql-test/t/lock_multi.test
+33
-0
sql/handler.cc
sql/handler.cc
+60
-26
sql/handler.h
sql/handler.h
+2
-5
sql/mysqld.cc
sql/mysqld.cc
+3
-2
sql/sql_db.cc
sql/sql_db.cc
+46
-14
sql/sql_plugin.cc
sql/sql_plugin.cc
+11
-11
sql/sql_plugin.h
sql/sql_plugin.h
+5
-5
sql/sql_show.cc
sql/sql_show.cc
+4
-1
sql/sql_tablespace.cc
sql/sql_tablespace.cc
+1
-1
storage/myisam/ft_parser.c
storage/myisam/ft_parser.c
+22
-10
storage/myisam/ft_update.c
storage/myisam/ft_update.c
+0
-5
storage/myisam/ftdefs.h
storage/myisam/ftdefs.h
+3
-2
storage/myisam/mi_check.c
storage/myisam/mi_check.c
+16
-18
storage/myisam/mi_key.c
storage/myisam/mi_key.c
+6
-8
storage/myisam/mi_update.c
storage/myisam/mi_update.c
+2
-1
storage/myisam/mi_write.c
storage/myisam/mi_write.c
+2
-1
storage/myisam/myisamdef.h
storage/myisam/myisamdef.h
+1
-1
No files found.
mysql-test/r/fulltext2.result
View file @
bb6be1e1
...
...
@@ -241,3 +241,11 @@ select * from t1 where match a against('ab c' in boolean mode);
a
drop table t1;
set names latin1;
SET NAMES utf8;
CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES('„MySQL“');
SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
a
„MySQL“
DROP TABLE t1;
SET NAMES latin1;
mysql-test/r/lock_multi.result
View file @
bb6be1e1
...
...
@@ -66,3 +66,11 @@ Select_priv
N
use test;
use test;
CREATE DATABASE mysqltest_1;
FLUSH TABLES WITH READ LOCK;
DROP DATABASE mysqltest_1;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
mysql-test/t/fulltext2.test
View file @
bb6be1e1
...
...
@@ -221,3 +221,13 @@ drop table t1;
set
names
latin1
;
# End of 4.1 tests
#
# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns
#
SET
NAMES
utf8
;
CREATE
TABLE
t1
(
a
VARCHAR
(
255
),
FULLTEXT
(
a
))
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
INSERT
INTO
t1
VALUES
(
'„MySQL“'
);
SELECT
a
FROM
t1
WHERE
MATCH
a
AGAINST
(
'“MySQL„'
IN
BOOLEAN
MODE
);
DROP
TABLE
t1
;
SET
NAMES
latin1
;
mysql-test/t/lock_multi.test
View file @
bb6be1e1
...
...
@@ -158,3 +158,36 @@ use test;
connection
default
;
# End of 5.0 tests
# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
#
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
#
connection
con1
;
CREATE
DATABASE
mysqltest_1
;
FLUSH
TABLES
WITH
READ
LOCK
;
#
# With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock().
connection
con2
;
send
DROP
DATABASE
mysqltest_1
;
--
sleep
1
#
# With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock.
connection
con1
;
--
error
ER_CANT_UPDATE_WITH_READLOCK
DROP
DATABASE
mysqltest_1
;
UNLOCK
TABLES
;
#
connection
con2
;
reap
;
#
connection
default
;
disconnect
con1
;
disconnect
con2
;
# This must have been dropped by connection 2 already,
# which waited until the global read lock was released.
--
error
ER_DB_DROP_EXISTS
DROP
DATABASE
mysqltest_1
;
sql/handler.cc
View file @
bb6be1e1
...
...
@@ -68,14 +68,14 @@ ulong total_ha_2pc= 0;
/* size of savepoint storage area (see ha_init) */
ulong
savepoint_alloc_size
=
0
;
st
ruct
show_table_alias_st
sys_table_aliases
[]
=
{
{
"INNOBASE"
,
DB_TYPE_INNODB
},
{
"NDB"
,
DB_TYPE_NDBCLUSTER
},
{
"BDB"
,
DB_TYPE_BERKELEY_DB
},
{
"HEAP"
,
DB_TYPE_HEAP
},
{
"MERGE"
,
DB_TYPE_MRG_MYISAM
},
{
NullS
,
DB_TYPE_UNKNOWN
}
st
atic
const
LEX_STRING
sys_table_aliases
[]
=
{
{
(
char
*
)
STRING_WITH_LEN
(
"INNOBASE"
)},
{(
char
*
)
STRING_WITH_LEN
(
"INNODB"
)
},
{
(
char
*
)
STRING_WITH_LEN
(
"NDB"
)},
{(
char
*
)
STRING_WITH_LEN
(
"NDBCLUSTER"
)
},
{
(
char
*
)
STRING_WITH_LEN
(
"BDB"
)},
{(
char
*
)
STRING_WITH_LEN
(
"BERKELEYDB"
)
},
{
(
char
*
)
STRING_WITH_LEN
(
"HEAP"
)},
{(
char
*
)
STRING_WITH_LEN
(
"MEMORY"
)
},
{
(
char
*
)
STRING_WITH_LEN
(
"MERGE"
)},
{(
char
*
)
STRING_WITH_LEN
(
"MRG_MYISAM"
)
},
{
NullS
,
0
}
};
const
char
*
ha_row_type
[]
=
{
...
...
@@ -91,15 +91,50 @@ TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
static
TYPELIB
known_extensions
=
{
0
,
"known_exts"
,
NULL
,
NULL
};
uint
known_extensions_id
=
0
;
handlerton
*
ha_resolve_by_name
(
THD
*
thd
,
LEX_STRING
*
name
)
/*
Return the default storage engine handlerton for thread
SYNOPSIS
ha_default_handlerton(thd)
thd current thread
RETURN
pointer to handlerton
*/
handlerton
*
ha_default_handlerton
(
THD
*
thd
)
{
return
(
thd
->
variables
.
table_type
!=
NULL
)
?
thd
->
variables
.
table_type
:
(
global_system_variables
.
table_type
!=
NULL
?
global_system_variables
.
table_type
:
&
myisam_hton
);
}
/*
Return the storage engine handlerton for the supplied name
SYNOPSIS
ha_resolve_by_name(thd, name)
thd current thread
name name of storage engine
RETURN
pointer to handlerton
*/
handlerton
*
ha_resolve_by_name
(
THD
*
thd
,
const
LEX_STRING
*
name
)
{
show_table_alias_st
*
table_alias
;
const
LEX_STRING
*
table_alias
;
st_plugin_int
*
plugin
;
if
(
thd
&&
!
my_strnncoll
(
&
my_charset_latin1
,
redo:
/* my_strnncoll is a macro and gcc doesn't do early expansion of macro */
if
(
thd
&&
!
my_charset_latin1
.
coll
->
strnncoll
(
&
my_charset_latin1
,
(
const
uchar
*
)
name
->
str
,
name
->
length
,
(
const
uchar
*
)
"DEFAULT"
,
7
))
return
ha_
resolve_by_legacy_type
(
thd
,
DB_TYPE_DEFAULT
);
(
const
uchar
*
)
STRING_WITH_LEN
(
"DEFAULT"
),
0
))
return
ha_
default_handlerton
(
thd
);
if
((
plugin
=
plugin_lock
(
name
,
MYSQL_STORAGE_ENGINE_PLUGIN
)))
{
...
...
@@ -112,13 +147,15 @@ handlerton *ha_resolve_by_name(THD *thd, LEX_STRING *name)
/*
We check for the historical aliases.
*/
for
(
table_alias
=
sys_table_aliases
;
table_alias
->
type
;
table_alias
++
)
for
(
table_alias
=
sys_table_aliases
;
table_alias
->
str
;
table_alias
+=
2
)
{
if
(
!
my_strnncoll
(
&
my_charset_latin1
,
(
const
uchar
*
)
name
->
str
,
name
->
length
,
(
const
uchar
*
)
table_alias
->
alias
,
strlen
(
table_alias
->
alias
)))
return
ha_resolve_by_legacy_type
(
thd
,
table_alias
->
type
);
(
const
uchar
*
)
table_alias
->
str
,
table_alias
->
length
))
{
name
=
table_alias
+
1
;
goto
redo
;
}
}
return
NULL
;
...
...
@@ -130,20 +167,20 @@ const char *ha_get_storage_engine(enum legacy_db_type db_type)
switch
(
db_type
)
{
case
DB_TYPE_DEFAULT
:
return
"DEFAULT"
;
case
DB_TYPE_UNKNOWN
:
return
"UNKNOWN"
;
default:
if
(
db_type
>
DB_TYPE_UNKNOWN
&&
db_type
<
DB_TYPE_DEFAULT
&&
installed_htons
[
db_type
])
return
hton2plugin
[
installed_htons
[
db_type
]
->
slot
]
->
name
.
str
;
return
"*NONE*"
;
/* fall through */
case
DB_TYPE_UNKNOWN
:
return
"UNKNOWN"
;
}
}
static
handler
*
create_default
(
TABLE_SHARE
*
table
,
MEM_ROOT
*
mem_root
)
{
handlerton
*
hton
=
ha_resolve_by_legacy_type
(
current_thd
,
DB_TYPE_DEFAULT
);
handlerton
*
hton
=
ha_default_handlerton
(
current_thd
);
return
(
hton
&&
hton
->
create
)
?
hton
->
create
(
table
,
mem_root
)
:
NULL
;
}
...
...
@@ -152,10 +189,7 @@ handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type)
{
switch
(
db_type
)
{
case
DB_TYPE_DEFAULT
:
return
(
thd
->
variables
.
table_type
!=
NULL
)
?
thd
->
variables
.
table_type
:
(
global_system_variables
.
table_type
!=
NULL
?
global_system_variables
.
table_type
:
&
myisam_hton
);
return
ha_default_handlerton
(
thd
);
case
DB_TYPE_UNKNOWN
:
return
NULL
;
default:
...
...
@@ -196,7 +230,7 @@ handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type,
break
;
}
return
ha_
resolve_by_legacy_type
(
thd
,
DB_TYPE_DEFAULT
);
return
ha_
default_handlerton
(
thd
);
}
/* ha_checktype */
...
...
sql/handler.h
View file @
bb6be1e1
...
...
@@ -667,10 +667,6 @@ struct handlerton
struct
handler_iterator
*
fill_this_in
);
};
struct
show_table_alias_st
{
const
char
*
alias
;
enum
legacy_db_type
type
;
};
/* Possible flags of a handlerton */
#define HTON_NO_FLAGS 0
...
...
@@ -1545,7 +1541,8 @@ extern ulong total_ha, total_ha_2pc;
#define ha_rollback(thd) (ha_rollback_trans((thd), TRUE))
/* lookups */
handlerton
*
ha_resolve_by_name
(
THD
*
thd
,
LEX_STRING
*
name
);
handlerton
*
ha_default_handlerton
(
THD
*
thd
);
handlerton
*
ha_resolve_by_name
(
THD
*
thd
,
const
LEX_STRING
*
name
);
handlerton
*
ha_resolve_by_legacy_type
(
THD
*
thd
,
enum
legacy_db_type
db_type
);
const
char
*
ha_get_storage_engine
(
enum
legacy_db_type
db_type
);
handler
*
get_new_handler
(
TABLE_SHARE
*
share
,
MEM_ROOT
*
alloc
,
...
...
sql/mysqld.cc
View file @
bb6be1e1
...
...
@@ -4983,11 +4983,12 @@ Disable with --skip-bdb (will save memory).",
(
gptr
*
)
&
default_collation_name
,
(
gptr
*
)
&
default_collation_name
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"default-storage-engine"
,
OPT_STORAGE_ENGINE
,
"Set the default storage engine (table type) for tables."
,
0
,
0
,
"Set the default storage engine (table type) for tables."
,
(
gptr
*
)
&
default_storage_engine_str
,
(
gptr
*
)
&
default_storage_engine_str
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"default-table-type"
,
OPT_STORAGE_ENGINE
,
"(deprecated) Use --default-storage-engine."
,
(
gptr
*
)
default_storage_engine_str
,
(
gptr
*
)
default_storage_engine_str
,
(
gptr
*
)
&
default_storage_engine_str
,
(
gptr
*
)
&
default_storage_engine_str
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"default-time-zone"
,
OPT_DEFAULT_TIME_ZONE
,
"Set the default time zone."
,
(
gptr
*
)
&
default_tz_name
,
(
gptr
*
)
&
default_tz_name
,
...
...
sql/sql_db.cc
View file @
bb6be1e1
...
...
@@ -539,15 +539,26 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
DBUG_RETURN
(
-
1
);
}
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
/* do not create database if another thread is holding read lock */
/*
Do not create database if another thread is holding read lock.
Wait for global read lock before acquiring LOCK_mysql_create_db.
After wait_if_global_read_lock() we have protection against another
global read lock. If we would acquire LOCK_mysql_create_db first,
another thread could step in and get the global read lock before we
reach wait_if_global_read_lock(). If this thread tries the same as we
(admin a db), it would then go and wait on LOCK_mysql_create_db...
Furthermore wait_if_global_read_lock() checks if the current thread
has the global read lock and refuses the operation with
ER_CANT_UPDATE_WITH_READLOCK if applicable.
*/
if
(
wait_if_global_read_lock
(
thd
,
0
,
1
))
{
error
=
-
1
;
goto
exit2
;
}
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
/* Check directory */
path_len
=
build_table_filename
(
path
,
sizeof
(
path
),
db
,
""
,
""
);
path
[
path_len
-
1
]
=
0
;
// Remove last '/' from path
...
...
@@ -655,9 +666,9 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
}
exit:
VOID
(
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
));
start_waiting_global_read_lock
(
thd
);
exit2:
VOID
(
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
));
DBUG_RETURN
(
error
);
}
...
...
@@ -671,12 +682,23 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
int
error
=
0
;
DBUG_ENTER
(
"mysql_alter_db"
);
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
/* do not alter database if another thread is holding read lock */
/*
Do not alter database if another thread is holding read lock.
Wait for global read lock before acquiring LOCK_mysql_create_db.
After wait_if_global_read_lock() we have protection against another
global read lock. If we would acquire LOCK_mysql_create_db first,
another thread could step in and get the global read lock before we
reach wait_if_global_read_lock(). If this thread tries the same as we
(admin a db), it would then go and wait on LOCK_mysql_create_db...
Furthermore wait_if_global_read_lock() checks if the current thread
has the global read lock and refuses the operation with
ER_CANT_UPDATE_WITH_READLOCK if applicable.
*/
if
((
error
=
wait_if_global_read_lock
(
thd
,
0
,
1
)))
goto
exit2
;
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
/*
Recreate db options file: /dbpath/.db.opt
We pass MY_DB_OPT_FILE as "extension" to avoid
...
...
@@ -721,9 +743,9 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
send_ok
(
thd
,
result
);
exit:
VOID
(
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
));
start_waiting_global_read_lock
(
thd
);
exit2:
VOID
(
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
));
DBUG_RETURN
(
error
);
}
...
...
@@ -755,15 +777,26 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
TABLE_LIST
*
dropped_tables
=
0
;
DBUG_ENTER
(
"mysql_rm_db"
);
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
/* do not drop database if another thread is holding read lock */
/*
Do not drop database if another thread is holding read lock.
Wait for global read lock before acquiring LOCK_mysql_create_db.
After wait_if_global_read_lock() we have protection against another
global read lock. If we would acquire LOCK_mysql_create_db first,
another thread could step in and get the global read lock before we
reach wait_if_global_read_lock(). If this thread tries the same as we
(admin a db), it would then go and wait on LOCK_mysql_create_db...
Furthermore wait_if_global_read_lock() checks if the current thread
has the global read lock and refuses the operation with
ER_CANT_UPDATE_WITH_READLOCK if applicable.
*/
if
(
wait_if_global_read_lock
(
thd
,
0
,
1
))
{
error
=
-
1
;
goto
exit2
;
}
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
length
=
build_table_filename
(
path
,
sizeof
(
path
),
db
,
""
,
""
);
strmov
(
path
+
length
,
MY_DB_OPT_FILE
);
// Append db option file name
del_dbopt
(
path
);
// Remove dboption hash entry
...
...
@@ -872,7 +905,6 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
exit:
(
void
)
sp_drop_db_routines
(
thd
,
db
);
/* QQ Ignore errors for now */
error
=
Events
::
drop_schema_events
(
thd
,
db
);
start_waiting_global_read_lock
(
thd
);
/*
If this database was the client's selected database, we silently change the
client's selected database to nothing (to have an empty SELECT DATABASE()
...
...
@@ -901,9 +933,9 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
thd
->
db
=
0
;
thd
->
db_length
=
0
;
}
exit2:
VOID
(
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
));
start_waiting_global_read_lock
(
thd
);
exit2:
DBUG_RETURN
(
error
);
}
...
...
sql/sql_plugin.cc
View file @
bb6be1e1
...
...
@@ -23,7 +23,7 @@ extern struct st_mysql_plugin *mysqld_builtins[];
char
*
opt_plugin_dir_ptr
;
char
opt_plugin_dir
[
FN_REFLEN
];
LEX_STRING
plugin_type_names
[
MYSQL_MAX_PLUGIN_TYPE_NUM
]
=
const
LEX_STRING
plugin_type_names
[
MYSQL_MAX_PLUGIN_TYPE_NUM
]
=
{
{
(
char
*
)
STRING_WITH_LEN
(
"UDF"
)
},
{
(
char
*
)
STRING_WITH_LEN
(
"STORAGE ENGINE"
)
},
...
...
@@ -63,7 +63,7 @@ static HASH plugin_hash[MYSQL_MAX_PLUGIN_TYPE_NUM];
static
rw_lock_t
THR_LOCK_plugin
;
static
bool
initialized
=
0
;
static
struct
st_plugin_dl
*
plugin_dl_find
(
LEX_STRING
*
dl
)
static
struct
st_plugin_dl
*
plugin_dl_find
(
const
LEX_STRING
*
dl
)
{
uint
i
;
DBUG_ENTER
(
"plugin_dl_find"
);
...
...
@@ -112,7 +112,7 @@ static inline void free_plugin_mem(struct st_plugin_dl *p)
my_free
((
gptr
)
p
->
plugins
,
MYF
(
MY_ALLOW_ZERO_PTR
));
}
static
st_plugin_dl
*
plugin_dl_add
(
LEX_STRING
*
dl
,
int
report
)
static
st_plugin_dl
*
plugin_dl_add
(
const
LEX_STRING
*
dl
,
int
report
)
{
#ifdef HAVE_DLOPEN
char
dlpath
[
FN_REFLEN
];
...
...
@@ -294,7 +294,7 @@ static st_plugin_dl *plugin_dl_add(LEX_STRING *dl, int report)
}
static
void
plugin_dl_del
(
LEX_STRING
*
dl
)
static
void
plugin_dl_del
(
const
LEX_STRING
*
dl
)
{
#ifdef HAVE_DLOPEN
uint
i
;
...
...
@@ -322,7 +322,7 @@ static void plugin_dl_del(LEX_STRING *dl)
}
static
struct
st_plugin_int
*
plugin_find_internal
(
LEX_STRING
*
name
,
int
type
)
static
struct
st_plugin_int
*
plugin_find_internal
(
const
LEX_STRING
*
name
,
int
type
)
{
uint
i
;
DBUG_ENTER
(
"plugin_find_internal"
);
...
...
@@ -345,7 +345,7 @@ static struct st_plugin_int *plugin_find_internal(LEX_STRING *name, int type)
}
my_bool
plugin_is_ready
(
LEX_STRING
*
name
,
int
type
)
my_bool
plugin_is_ready
(
const
LEX_STRING
*
name
,
int
type
)
{
my_bool
rc
=
FALSE
;
struct
st_plugin_int
*
plugin
;
...
...
@@ -359,7 +359,7 @@ my_bool plugin_is_ready(LEX_STRING *name, int type)
}
struct
st_plugin_int
*
plugin_lock
(
LEX_STRING
*
name
,
int
type
)
struct
st_plugin_int
*
plugin_lock
(
const
LEX_STRING
*
name
,
int
type
)
{
struct
st_plugin_int
*
rc
;
DBUG_ENTER
(
"plugin_lock"
);
...
...
@@ -396,7 +396,7 @@ static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin)
struct
st_plugin_int
*
));
}
static
my_bool
plugin_add
(
LEX_STRING
*
name
,
LEX_STRING
*
dl
,
int
report
)
static
my_bool
plugin_add
(
const
LEX_STRING
*
name
,
const
LEX_STRING
*
dl
,
int
report
)
{
struct
st_plugin_int
tmp
;
struct
st_mysql_plugin
*
plugin
;
...
...
@@ -479,7 +479,7 @@ static my_bool plugin_add(LEX_STRING *name, LEX_STRING *dl, int report)
}
static
void
plugin_del
(
LEX_STRING
*
name
)
static
void
plugin_del
(
const
LEX_STRING
*
name
)
{
uint
i
;
struct
st_plugin_int
*
plugin
;
...
...
@@ -811,7 +811,7 @@ void plugin_free(void)
}
my_bool
mysql_install_plugin
(
THD
*
thd
,
LEX_STRING
*
name
,
LEX_STRING
*
dl
)
my_bool
mysql_install_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
,
const
LEX_STRING
*
dl
)
{
TABLE_LIST
tables
;
TABLE
*
table
;
...
...
@@ -866,7 +866,7 @@ my_bool mysql_install_plugin(THD *thd, LEX_STRING *name, LEX_STRING *dl)
}
my_bool
mysql_uninstall_plugin
(
THD
*
thd
,
LEX_STRING
*
name
)
my_bool
mysql_uninstall_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
)
{
TABLE
*
table
;
TABLE_LIST
tables
;
...
...
sql/sql_plugin.h
View file @
bb6be1e1
...
...
@@ -66,15 +66,15 @@ typedef int (*plugin_type_init)(struct st_plugin_int *);
extern
char
*
opt_plugin_dir_ptr
;
extern
char
opt_plugin_dir
[
FN_REFLEN
];
extern
LEX_STRING
plugin_type_names
[];
extern
const
LEX_STRING
plugin_type_names
[];
extern
int
plugin_init
(
void
);
extern
void
plugin_load
(
void
);
extern
void
plugin_free
(
void
);
extern
my_bool
plugin_is_ready
(
LEX_STRING
*
name
,
int
type
);
extern
st_plugin_int
*
plugin_lock
(
LEX_STRING
*
name
,
int
type
);
extern
my_bool
plugin_is_ready
(
const
LEX_STRING
*
name
,
int
type
);
extern
st_plugin_int
*
plugin_lock
(
const
LEX_STRING
*
name
,
int
type
);
extern
void
plugin_unlock
(
struct
st_plugin_int
*
plugin
);
extern
my_bool
mysql_install_plugin
(
THD
*
thd
,
LEX_STRING
*
name
,
LEX_STRING
*
dl
);
extern
my_bool
mysql_uninstall_plugin
(
THD
*
thd
,
LEX_STRING
*
name
);
extern
my_bool
mysql_install_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
,
const
LEX_STRING
*
dl
);
extern
my_bool
mysql_uninstall_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
);
extern
my_bool
plugin_register_builtin
(
struct
st_mysql_plugin
*
plugin
);
...
...
sql/sql_show.cc
View file @
bb6be1e1
...
...
@@ -438,6 +438,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
uint
col_access
=
thd
->
col_access
;
#endif
TABLE_LIST
table_list
;
char
tbbuff
[
FN_REFLEN
];
DBUG_ENTER
(
"mysql_find_files"
);
if
(
wild
&&
!
wild
[
0
])
...
...
@@ -454,6 +455,8 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
DBUG_RETURN
(
-
1
);
}
VOID
(
tablename_to_filename
(
tmp_file_prefix
,
tbbuff
,
sizeof
(
tbbuff
)));
for
(
i
=
0
;
i
<
(
uint
)
dirp
->
number_off_files
;
i
++
)
{
char
uname
[
NAME_LEN
*
3
+
1
];
/* Unencoded name */
...
...
@@ -491,7 +494,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
{
// Return only .frm files which aren't temp files.
if
(
my_strcasecmp
(
system_charset_info
,
ext
=
fn_rext
(
file
->
name
),
reg_ext
)
||
is_prefix
(
file
->
name
,
t
mp_file_prefix
))
is_prefix
(
file
->
name
,
t
bbuff
))
continue
;
*
ext
=
0
;
VOID
(
filename_to_tablename
(
file
->
name
,
uname
,
sizeof
(
uname
)));
...
...
sql/sql_tablespace.cc
View file @
bb6be1e1
...
...
@@ -30,7 +30,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
*/
if
(
hton
==
NULL
||
hton
->
state
!=
SHOW_OPTION_YES
)
{
hton
=
ha_
resolve_by_legacy_type
(
thd
,
DB_TYPE_DEFAULT
);
hton
=
ha_
default_handlerton
(
thd
);
if
(
ts_info
->
storage_engine
!=
0
)
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
ER_WARN_USING_OTHER_HANDLER
,
...
...
storage/myisam/ft_parser.c
View file @
bb6be1e1
...
...
@@ -111,6 +111,7 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
FT_WORD
*
word
,
MYSQL_FTPARSER_BOOLEAN_INFO
*
param
)
{
byte
*
doc
=*
start
;
int
ctype
;
uint
mwc
,
length
,
mbl
;
param
->
yesno
=
(
FTB_YES
==
' '
)
?
1
:
(
param
->
quot
!=
0
);
...
...
@@ -119,9 +120,11 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
while
(
doc
<
end
)
{
for
(;
doc
<
end
;
doc
++
)
for
(;
doc
<
end
;
doc
+=
(
mbl
>
0
?
mbl
:
1
)
)
{
if
(
true_word_char
(
cs
,
*
doc
))
break
;
mbl
=
cs
->
cset
->
ctype
(
cs
,
&
ctype
,
(
uchar
*
)
doc
,
(
uchar
*
)
end
);
if
(
true_word_char
(
ctype
,
*
doc
))
break
;
if
(
*
doc
==
FTB_RQUOT
&&
param
->
quot
)
{
param
->
quot
=
doc
;
...
...
@@ -155,14 +158,16 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
}
mwc
=
length
=
0
;
for
(
word
->
pos
=
doc
;
doc
<
end
;
length
++
,
mbl
=
my_mbcharlen
(
cs
,
*
(
uchar
*
)
doc
),
doc
+=
(
mbl
?
mbl
:
1
))
if
(
true_word_char
(
cs
,
*
doc
))
for
(
word
->
pos
=
doc
;
doc
<
end
;
length
++
,
doc
+=
(
mbl
>
0
?
mbl
:
1
))
{
mbl
=
cs
->
cset
->
ctype
(
cs
,
&
ctype
,
(
uchar
*
)
doc
,
(
uchar
*
)
end
);
if
(
true_word_char
(
ctype
,
*
doc
))
mwc
=
0
;
else
if
(
!
misc_word_char
(
*
doc
)
||
mwc
)
break
;
else
mwc
++
;
}
param
->
prev
=
'A'
;
/* be sure *prev is true_word_char */
word
->
len
=
(
uint
)(
doc
-
word
->
pos
)
-
mwc
;
if
((
param
->
trunc
=
(
doc
<
end
&&
*
doc
==
FTB_TRUNC
)))
...
...
@@ -197,24 +202,31 @@ byte ft_simple_get_word(CHARSET_INFO *cs, byte **start, const byte *end,
{
byte
*
doc
=
*
start
;
uint
mwc
,
length
,
mbl
;
int
ctype
;
DBUG_ENTER
(
"ft_simple_get_word"
);
do
{
for
(;;
doc
+
+
)
for
(;;
doc
+
=
(
mbl
>
0
?
mbl
:
1
)
)
{
if
(
doc
>=
end
)
DBUG_RETURN
(
0
);
if
(
true_word_char
(
cs
,
*
doc
))
break
;
if
(
doc
>=
end
)
DBUG_RETURN
(
0
);
mbl
=
cs
->
cset
->
ctype
(
cs
,
&
ctype
,
(
uchar
*
)
doc
,
(
uchar
*
)
end
);
if
(
true_word_char
(
ctype
,
*
doc
))
break
;
}
mwc
=
length
=
0
;
for
(
word
->
pos
=
doc
;
doc
<
end
;
length
++
,
mbl
=
my_mbcharlen
(
cs
,
*
(
uchar
*
)
doc
),
doc
+=
(
mbl
?
mbl
:
1
))
if
(
true_word_char
(
cs
,
*
doc
))
for
(
word
->
pos
=
doc
;
doc
<
end
;
length
++
,
doc
+=
(
mbl
>
0
?
mbl
:
1
))
{
mbl
=
cs
->
cset
->
ctype
(
cs
,
&
ctype
,
(
uchar
*
)
doc
,
(
uchar
*
)
end
);
if
(
true_word_char
(
ctype
,
*
doc
))
mwc
=
0
;
else
if
(
!
misc_word_char
(
*
doc
)
||
mwc
)
break
;
else
mwc
++
;
}
word
->
len
=
(
uint
)(
doc
-
word
->
pos
)
-
mwc
;
...
...
storage/myisam/ft_update.c
View file @
bb6be1e1
...
...
@@ -174,11 +174,6 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
FT_SEG_ITERATOR
ftsi1
,
ftsi2
;
CHARSET_INFO
*
cs
=
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
;
DBUG_ENTER
(
"_mi_ft_cmp"
);
#ifndef MYSQL_HAS_TRUE_CTYPE_IMPLEMENTATION
if
(
cs
->
mbmaxlen
>
1
)
DBUG_RETURN
(
THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT
);
#endif
_mi_ft_segiterator_init
(
info
,
keynr
,
rec1
,
&
ftsi1
);
_mi_ft_segiterator_init
(
info
,
keynr
,
rec2
,
&
ftsi2
);
...
...
storage/myisam/ftdefs.h
View file @
bb6be1e1
...
...
@@ -24,9 +24,10 @@
#include <queues.h>
#include <mysql/plugin.h>
#define true_word_char(s,X) (my_isalnum(s,X) || (X)=='_')
#define true_word_char(ctype, character) \
((ctype) & (_MY_U | _MY_L | _MY_NMR) || \
(character) == '_')
#define misc_word_char(X) 0
#define word_char(s,X) (true_word_char(s,X) || misc_word_char(X))
#define FT_MAX_WORD_LEN_FOR_SORT 31
...
...
storage/myisam/mi_check.c
View file @
bb6be1e1
...
...
@@ -453,25 +453,24 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
if
((
uint
)
share
->
base
.
auto_key
-
1
==
key
)
{
/* Check that auto_increment key is bigger than max key value */
ulonglong
save_auto_value
=
info
->
s
->
state
.
auto_increment
;
info
->
s
->
state
.
auto_increment
=
0
;
ulonglong
auto_increment
;
info
->
lastinx
=
key
;
_mi_read_key_record
(
info
,
0L
,
info
->
rec_buff
);
updat
e_auto_increment
(
info
,
info
->
rec_buff
);
if
(
info
->
s
->
state
.
auto_increment
>
save_auto_value
)
auto_increment
=
retriev
e_auto_increment
(
info
,
info
->
rec_buff
);
if
(
auto_increment
>
info
->
s
->
state
.
auto_increment
)
{
mi_check_print_warning
(
param
,
"Auto-increment value: %s is smaller
than max used value: %s"
,
llstr
(
save_auto_value
,
buff2
),
llstr
(
info
->
s
->
state
.
auto_increment
,
buff
));
mi_check_print_warning
(
param
,
"Auto-increment value: %s is smaller "
"
than max used value: %s"
,
llstr
(
info
->
s
->
state
.
auto_increment
,
buff2
),
llstr
(
auto_increment
,
buff
));
}
if
(
param
->
testflag
&
T_AUTO_INC
)
{
set_if_bigger
(
info
->
s
->
state
.
auto_increment
,
auto_increment
);
set_if_bigger
(
info
->
s
->
state
.
auto_increment
,
param
->
auto_increment_value
);
}
else
info
->
s
->
state
.
auto_increment
=
save_auto_value
;
/* Check that there isn't a row with auto_increment = 0 in the table */
mi_extra
(
info
,
HA_EXTRA_KEYREAD
,
0
);
...
...
@@ -481,8 +480,8 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
{
/* Don't count this as a real warning, as myisamchk can't correct it */
uint
save
=
param
->
warning_printed
;
mi_check_print_warning
(
param
,
"Found row where the auto_increment
column has the value 0"
);
mi_check_print_warning
(
param
,
"Found row where the auto_increment "
"
column has the value 0"
);
param
->
warning_printed
=
save
;
}
mi_extra
(
info
,
HA_EXTRA_NO_KEYREAD
,
0
);
...
...
@@ -4124,11 +4123,10 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
}
else
{
ulonglong
auto_increment
=
(
repair_only
?
info
->
s
->
state
.
auto_increment
:
param
->
auto_increment_value
);
info
->
s
->
state
.
auto_increment
=
0
;
update_auto_increment
(
info
,
record
);
ulonglong
auto_increment
=
retrieve_auto_increment
(
info
,
record
);
set_if_bigger
(
info
->
s
->
state
.
auto_increment
,
auto_increment
);
if
(
!
repair_only
)
set_if_bigger
(
info
->
s
->
state
.
auto_increment
,
param
->
auto_increment_value
);
}
mi_extra
(
info
,
HA_EXTRA_NO_KEYREAD
,
0
);
my_free
((
char
*
)
record
,
MYF
(
0
));
...
...
storage/myisam/mi_key.c
View file @
bb6be1e1
...
...
@@ -509,20 +509,19 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, byte *buf)
/*
Updat
e auto_increment info
Retriev
e auto_increment info
SYNOPSIS
updat
e_auto_increment()
retriev
e_auto_increment()
info MyISAM handler
record Row to update
IMPLEMENTATION
Only replace the auto_increment value if it is higher than the previous
one. For signed columns we don't update the auto increment value if it's
For signed columns we don't retrieve the auto increment value if it's
less than zero.
*/
void
updat
e_auto_increment
(
MI_INFO
*
info
,
const
byte
*
record
)
ulonglong
retriev
e_auto_increment
(
MI_INFO
*
info
,
const
byte
*
record
)
{
ulonglong
value
=
0
;
/* Store unsigned values here */
longlong
s_value
=
0
;
/* Store signed values here */
...
...
@@ -587,6 +586,5 @@ void update_auto_increment(MI_INFO *info,const byte *record)
and if s_value == 0 then value will contain either s_value or the
correct value.
*/
set_if_bigger
(
info
->
s
->
state
.
auto_increment
,
(
s_value
>
0
)
?
(
ulonglong
)
s_value
:
value
);
return
(
s_value
>
0
)
?
(
ulonglong
)
s_value
:
value
;
}
storage/myisam/mi_update.c
View file @
bb6be1e1
...
...
@@ -164,7 +164,8 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
key_changed
|=
HA_STATE_CHANGED
;
/* Must update index file */
}
if
(
auto_key_changed
)
update_auto_increment
(
info
,
newrec
);
set_if_bigger
(
info
->
s
->
state
.
auto_increment
,
retrieve_auto_increment
(
info
,
newrec
));
if
(
share
->
calc_checksum
)
info
->
state
->
checksum
+=
(
info
->
checksum
-
old_checksum
);
...
...
storage/myisam/mi_write.c
View file @
bb6be1e1
...
...
@@ -149,7 +149,8 @@ int mi_write(MI_INFO *info, byte *record)
info
->
state
->
checksum
+=
info
->
checksum
;
}
if
(
share
->
base
.
auto_key
)
update_auto_increment
(
info
,
record
);
set_if_bigger
(
info
->
s
->
state
.
auto_increment
,
retrieve_auto_increment
(
info
,
record
));
info
->
update
=
(
HA_STATE_CHANGED
|
HA_STATE_AKTIV
|
HA_STATE_WRITTEN
|
HA_STATE_ROW_CHANGED
);
info
->
state
->
records
++
;
...
...
storage/myisam/myisamdef.h
View file @
bb6be1e1
...
...
@@ -593,7 +593,7 @@ extern uint _mi_pack_key(MI_INFO *info,uint keynr,uchar *key,uchar *old,
extern
int
_mi_read_key_record
(
MI_INFO
*
info
,
my_off_t
filepos
,
byte
*
buf
);
extern
int
_mi_read_cache
(
IO_CACHE
*
info
,
byte
*
buff
,
my_off_t
pos
,
uint
length
,
int
re_read_if_possibly
);
extern
void
updat
e_auto_increment
(
MI_INFO
*
info
,
const
byte
*
record
);
extern
ulonglong
retriev
e_auto_increment
(
MI_INFO
*
info
,
const
byte
*
record
);
extern
byte
*
mi_alloc_rec_buff
(
MI_INFO
*
,
ulong
,
byte
**
);
#define mi_get_rec_buff_ptr(info,buf) \
...
...
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