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
4ab7a33e
Commit
4ab7a33e
authored
Mar 05, 2012
by
Michael Widenius
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge
parents
8a5940c4
c4375068
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
151 additions
and
16 deletions
+151
-16
include/my_base.h
include/my_base.h
+1
-0
mysql-test/r/myisam-big.result
mysql-test/r/myisam-big.result
+40
-0
mysql-test/t/myisam-big.test
mysql-test/t/myisam-big.test
+64
-0
sql/sql_base.cc
sql/sql_base.cc
+13
-4
storage/maria/ma_bitmap.c
storage/maria/ma_bitmap.c
+1
-1
storage/maria/ma_dbug.c
storage/maria/ma_dbug.c
+1
-1
storage/maria/ma_open.c
storage/maria/ma_open.c
+8
-2
storage/maria/ma_recovery.c
storage/maria/ma_recovery.c
+8
-0
storage/myisam/mi_create.c
storage/myisam/mi_create.c
+1
-1
storage/myisam/mi_dbug.c
storage/myisam/mi_dbug.c
+1
-1
storage/myisam/mi_open.c
storage/myisam/mi_open.c
+12
-5
storage/myisam/myisamdef.h
storage/myisam/myisamdef.h
+1
-1
No files found.
include/my_base.h
View file @
4ab7a33e
...
...
@@ -54,6 +54,7 @@
/* Internal temp table, used for temporary results */
#define HA_OPEN_INTERNAL_TABLE 512
#define HA_OPEN_MERGE_TABLE 1024
#define HA_OPEN_FOR_STATUS 2048
/* The following is parameter to ha_rkey() how to use key */
...
...
mysql-test/r/myisam-big.result
0 → 100644
View file @
4ab7a33e
drop table if exists t1,t2;
create table t1 (id int, sometext varchar(100)) engine=myisam;
insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4");
create table t2 like t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
insert into t2 select * from t1;
insert into t1 select * from t1;
select count(*) from t1;
count(*)
131072
alter table t1 add index (id), add index(sometext), add index(sometext,id);
alter table t1 disable keys;
alter table t1 enable keys;
drop table t1,t2;
mysql-test/t/myisam-big.test
0 → 100644
View file @
4ab7a33e
#
# Test bugs in the MyISAM code that require more space/time
--
source
include
/
big_test
.
inc
# Initialise
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
#
# BUG#925377:
# Querying myisam table metadata while 'alter table..enable keys' is
# running may corrupt the table
#
create
table
t1
(
id
int
,
sometext
varchar
(
100
))
engine
=
myisam
;
insert
into
t1
values
(
1
,
"hello"
),(
2
,
"hello2"
),(
4
,
"hello3"
),(
4
,
"hello4"
);
create
table
t2
like
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
insert
into
t2
select
*
from
t1
;
insert
into
t1
select
*
from
t1
;
select
count
(
*
)
from
t1
;
connect
(
con2
,
localhost
,
root
,,);
connection
con2
;
alter
table
t1
add
index
(
id
),
add
index
(
sometext
),
add
index
(
sometext
,
id
);
alter
table
t1
disable
keys
;
send
alter
table
t1
enable
keys
;
connection
default
;
--
sleep
1
--
disable_query_log
--
disable_result_log
show
table
status
like
't1'
;
--
enable_query_log
--
enable_result_log
connection
con2
;
reap
;
disconnect
con2
;
connection
default
;
drop
table
t1
,
t2
;
sql/sql_base.cc
View file @
4ab7a33e
...
...
@@ -2985,7 +2985,9 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
}
error
=
open_unireg_entry
(
thd
,
table
,
table_list
,
alias
,
key
,
key_length
,
mem_root
,
(
flags
&
OPEN_VIEW_NO_PARSE
));
mem_root
,
(
flags
&
(
OPEN_VIEW_NO_PARSE
|
MYSQL_LOCK_IGNORE_FLUSH
)));
if
(
error
>
0
)
{
my_free
((
uchar
*
)
table
,
MYF
(
0
));
...
...
@@ -4074,8 +4076,11 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
HA_GET_INDEX
|
HA_TRY_READ_ONLY
),
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
|
(
flags
&
OPEN_VIEW_NO_PARSE
),
thd
->
open_options
,
entry
,
table_list
,
mem_root
);
thd
->
open_options
|
(
thd
->
version
==
0
&&
(
flags
&
MYSQL_LOCK_IGNORE_FLUSH
)
?
HA_OPEN_FOR_STATUS
:
0
),
entry
,
table_list
,
mem_root
);
if
(
error
)
goto
err
;
/* TODO: Don't free this */
...
...
@@ -4113,7 +4118,11 @@ static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
HA_TRY_READ_ONLY
),
(
READ_KEYINFO
|
COMPUTE_TYPES
|
EXTRA_RECORD
),
thd
->
open_options
,
entry
,
FALSE
)))
thd
->
open_options
|
(
thd
->
version
==
0
&&
(
flags
&
MYSQL_LOCK_IGNORE_FLUSH
)
?
HA_OPEN_FOR_STATUS
:
0
),
entry
,
FALSE
)))
{
if
(
error
==
7
)
// Table def changed
{
...
...
storage/maria/ma_bitmap.c
View file @
4ab7a33e
...
...
@@ -368,7 +368,7 @@ static inline void _ma_bitmap_mark_file_changed(MARIA_SHARE *share,
if
(
flush_translog
&&
share
->
now_transactional
)
(
void
)
translog_flush
(
share
->
state
.
logrec_file_id
);
_ma_mark_file_changed
(
share
);
_ma_mark_file_changed
_now
(
share
);
pthread_mutex_lock
(
&
share
->
bitmap
.
bitmap_lock
);
/* purecov: end */
}
...
...
storage/maria/ma_dbug.c
View file @
4ab7a33e
...
...
@@ -186,7 +186,7 @@ my_bool _ma_check_table_is_closed(const char *name, const char *where)
MARIA_SHARE
*
share
=
info
->
s
;
if
(
!
strcmp
(
share
->
unique_file_name
.
str
,
filename
))
{
if
(
share
->
last_version
)
if
(
share
->
last_version
>
1
)
{
fprintf
(
stderr
,
"Warning: Table: %s is open on %s
\n
"
,
name
,
where
);
DBUG_PRINT
(
"warning"
,(
"Table: %s is open on %s"
,
name
,
where
));
...
...
storage/maria/ma_open.c
View file @
4ab7a33e
...
...
@@ -62,7 +62,8 @@ MARIA_HA *_ma_test_if_reopen(const char *filename)
{
MARIA_HA
*
info
=
(
MARIA_HA
*
)
pos
->
data
;
MARIA_SHARE
*
share
=
info
->
s
;
if
(
!
strcmp
(
share
->
unique_file_name
.
str
,
filename
)
&&
share
->
last_version
)
if
(
!
strcmp
(
share
->
unique_file_name
.
str
,
filename
)
&&
share
->
last_version
>
1
)
return
info
;
}
return
0
;
...
...
@@ -840,7 +841,12 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share
->
base
.
key_parts
=
key_parts
;
share
->
base
.
all_key_parts
=
key_parts
+
unique_key_parts
;
if
(
!
(
share
->
last_version
=
share
->
state
.
version
))
share
->
last_version
=
1
;
/* Safety */
share
->
last_version
=
2
;
/* Safety */
if
(
open_flags
&
HA_OPEN_FOR_STATUS
)
{
share
->
last_version
=
1
;
/* Not reusable version */
share
->
options
|=
HA_OPTION_READ_ONLY_DATA
;
}
share
->
rec_reflength
=
share
->
base
.
rec_reflength
;
/* May be changed */
share
->
base
.
margin_key_file_length
=
(
share
->
base
.
max_key_file_length
-
(
keys
?
MARIA_INDEX_BLOCK_MARGIN
*
...
...
storage/maria/ma_recovery.c
View file @
4ab7a33e
...
...
@@ -665,11 +665,13 @@ prototype_redo_exec_hook_dummy(INCOMPLETE_GROUP)
prototype_redo_exec_hook
(
INCOMPLETE_LOG
)
{
MARIA_HA
*
info
;
if
(
skip_DDLs
)
{
tprint
(
tracef
,
"we skip DDLs
\n
"
);
return
0
;
}
if
((
info
=
get_MARIA_HA_from_REDO_record
(
rec
))
==
NULL
)
{
/* no such table, don't need to warn */
...
...
@@ -1479,7 +1481,13 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
if
(
error
)
{
if
(
info
!=
NULL
)
{
/* let maria_close() mark the table properly closed */
info
->
s
->
state
.
open_count
=
1
;
info
->
s
->
global_changed
=
1
;
info
->
s
->
changed
=
1
;
maria_close
(
info
);
}
if
(
error
==
-
1
)
error
=
0
;
}
...
...
storage/myisam/mi_create.c
View file @
4ab7a33e
...
...
@@ -643,7 +643,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
NOTE: The filename is compared against unique_file_name of every
open table. Hence we need a real path here.
*/
if
(
test_if_reopen
(
filename
))
if
(
test_if_reopen
(
filename
,
1
))
{
my_printf_error
(
0
,
"MyISAM table '%s' is in use "
"(most likely by a MERGE table). Try FLUSH TABLES."
,
...
...
storage/myisam/mi_dbug.c
View file @
4ab7a33e
...
...
@@ -183,7 +183,7 @@ my_bool check_table_is_closed(const char *name, const char *where)
MYISAM_SHARE
*
share
=
info
->
s
;
if
(
!
strcmp
(
share
->
unique_file_name
,
filename
))
{
if
(
share
->
last_version
)
if
(
share
->
last_version
>
1
)
{
fprintf
(
stderr
,
"Warning: Table: %s is open on %s
\n
"
,
name
,
where
);
DBUG_PRINT
(
"warning"
,(
"Table: %s is open on %s"
,
name
,
where
));
...
...
storage/myisam/mi_open.c
View file @
4ab7a33e
...
...
@@ -52,7 +52,8 @@ if (pos > end_pos) \
** In MySQL the server will handle version issues.
******************************************************************************/
MI_INFO
*
test_if_reopen
(
char
*
filename
)
MI_INFO
*
test_if_reopen
(
char
*
filename
,
my_bool
ignore_last_version
__attribute__
((
unused
)))
{
LIST
*
pos
;
...
...
@@ -61,8 +62,8 @@ MI_INFO *test_if_reopen(char *filename)
MI_INFO
*
info
=
(
MI_INFO
*
)
pos
->
data
;
MYISAM_SHARE
*
share
=
info
->
s
;
DBUG_ASSERT
(
strcmp
(
share
->
unique_file_name
,
filename
)
||
share
->
last_version
);
if
(
!
strcmp
(
share
->
unique_file_name
,
filename
)
&&
share
->
last_version
)
share
->
last_version
>
1
||
ignore_last_version
);
if
(
!
strcmp
(
share
->
unique_file_name
,
filename
)
&&
share
->
last_version
>
1
)
return
info
;
}
return
0
;
...
...
@@ -109,7 +110,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
pthread_mutex_lock
(
&
THR_LOCK_myisam
);
if
(
!
(
old_info
=
test_if_reopen
(
name_buff
)))
if
(
!
(
old_info
=
test_if_reopen
(
name_buff
,
test
(
open_flags
&
HA_OPEN_FOR_STATUS
))))
{
share
=
&
share_buff
;
bzero
((
uchar
*
)
&
share_buff
,
sizeof
(
share_buff
));
...
...
@@ -511,7 +513,12 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share
->
base
.
key_parts
=
key_parts
;
share
->
base
.
all_key_parts
=
key_parts
+
unique_key_parts
;
if
(
!
(
share
->
last_version
=
share
->
state
.
version
))
share
->
last_version
=
1
;
/* Safety */
share
->
last_version
=
2
;
/* Safety */
if
(
open_flags
&
HA_OPEN_FOR_STATUS
)
{
share
->
last_version
=
1
;
/* Not reusable version */
share
->
options
|=
HA_OPTION_READ_ONLY_DATA
;
}
share
->
rec_reflength
=
share
->
base
.
rec_reflength
;
/* May be changed */
share
->
base
.
margin_key_file_length
=
(
share
->
base
.
max_key_file_length
-
(
keys
?
MI_INDEX_BLOCK_MARGIN
*
...
...
storage/myisam/myisamdef.h
View file @
4ab7a33e
...
...
@@ -726,7 +726,7 @@ my_bool mi_check_status(void *param);
void
mi_fix_status
(
MI_INFO
*
org_table
,
MI_INFO
*
new_table
);
void
mi_disable_non_unique_index
(
MI_INFO
*
info
,
ha_rows
rows
);
extern
MI_INFO
*
test_if_reopen
(
char
*
filename
);
extern
MI_INFO
*
test_if_reopen
(
char
*
filename
,
my_bool
ignore_last_version
);
my_bool
check_table_is_closed
(
const
char
*
name
,
const
char
*
where
);
int
mi_open_datafile
(
MI_INFO
*
info
,
MYISAM_SHARE
*
share
,
const
char
*
orn_name
,
File
file_to_dup
);
...
...
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