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
5d6aab80
Commit
5d6aab80
authored
Mar 11, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: minor issues in MyISAM
parent
961fc6a6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
55 deletions
+44
-55
include/myisamchk.h
include/myisamchk.h
+0
-8
storage/myisam/mi_check.c
storage/myisam/mi_check.c
+10
-14
storage/myisam/mi_delete.c
storage/myisam/mi_delete.c
+1
-1
storage/myisam/mi_open.c
storage/myisam/mi_open.c
+23
-24
storage/myisam/myisamchk.c
storage/myisam/myisamchk.c
+10
-8
No files found.
include/myisamchk.h
View file @
5d6aab80
...
...
@@ -16,14 +16,6 @@
/* Definitions needed for myisamchk/mariachk.c */
/*
Entries marked as "QQ to be removed" are NOT used to
pass check/repair options to xxx_check.c. They are used
internally by xxxchk.c or/and ha_xxxx.cc and should NOT
be stored together with other flags. They should be removed
from the following list to make addition of new flags possible.
*/
#ifndef _myisamchk_h
#define _myisamchk_h
...
...
storage/myisam/mi_check.c
View file @
5d6aab80
...
...
@@ -3268,12 +3268,9 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
sort_param
->
max_pos
=
(
sort_param
->
pos
+=
share
->
base
.
pack_reclength
);
if
(
*
sort_param
->
record
)
{
if
(
sort_param
->
calc_checksum
)
param
->
glob_crc
+=
(
info
->
checksum
=
(
*
info
->
s
->
calc_check_checksum
)(
info
,
sort_param
->
record
));
DBUG_RETURN
(
0
);
if
(
sort_param
->
calc_checksum
)
info
->
checksum
=
(
*
info
->
s
->
calc_check_checksum
)(
info
,
sort_param
->
record
);
goto
finish
;
}
if
(
!
sort_param
->
fix_datafile
&&
sort_param
->
master
)
{
...
...
@@ -3568,9 +3565,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
goto
try_next
;
}
}
if
(
sort_param
->
calc_checksum
)
param
->
glob_crc
+=
info
->
checksum
;
DBUG_RETURN
(
0
);
goto
finish
;
}
if
(
!
searching
)
mi_check_print_info
(
param
,
"Key %d - Found wrong stored record at %s"
,
...
...
@@ -3639,11 +3634,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
block_info
.
rec_len
);
info
->
packed_length
=
block_info
.
rec_len
;
if
(
sort_param
->
calc_checksum
)
param
->
glob_crc
+=
(
info
->
checksum
=
(
*
info
->
s
->
calc_check_checksum
)(
info
,
sort_param
->
record
));
DBUG_RETURN
(
0
);
info
->
checksum
=
(
*
info
->
s
->
calc_check_checksum
)(
info
,
sort_param
->
record
);
goto
finish
;
}
default:
DBUG_ASSERT
(
0
);
/* Impossible */
...
...
@@ -3651,6 +3643,10 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
}
DBUG_ASSERT
(
0
);
/* Impossible */
DBUG_RETURN
(
1
);
/* Impossible */
finish:
if
(
sort_param
->
calc_checksum
)
param
->
glob_crc
+=
info
->
checksum
;
DBUG_RETURN
(
0
);
}
...
...
storage/myisam/mi_delete.c
View file @
5d6aab80
...
...
@@ -326,7 +326,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{
DBUG_PRINT
(
"error"
,(
"Didn't find key"
));
mi_print_error
(
info
->
s
,
HA_ERR_CRASHED
);
my_errno
=
HA_ERR_CRASHED
;
/* This should ne
w
er happend */
my_errno
=
HA_ERR_CRASHED
;
/* This should ne
v
er happend */
goto
err
;
}
save_flag
=
0
;
...
...
storage/myisam/mi_open.c
View file @
5d6aab80
...
...
@@ -334,15 +334,15 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
uint32
ftkey_nr
=
1
;
for
(
i
=
0
;
i
<
keys
;
i
++
)
{
share
->
keyinfo
[
i
].
share
=
share
;
disk_pos
=
mi_keydef_read
(
disk_pos
,
&
share
->
keyinfo
[
i
])
;
disk_pos
_assert
(
disk_pos
+
share
->
keyinfo
[
i
].
keysegs
*
HA_KEYSEG_SIZE
,
end_pos
);
if
(
share
->
keyinfo
[
i
].
key_alg
==
HA_KEY_ALG_RTREE
)
MI_KEYDEF
*
keyinfo
=
share
->
keyinfo
+
i
;
keyinfo
->
share
=
share
;
disk_pos
=
mi_keydef_read
(
disk_pos
,
keyinfo
);
disk_pos_assert
(
disk_pos
+
keyinfo
->
keysegs
*
HA_KEYSEG_SIZE
,
end_pos
);
if
(
keyinfo
->
key_alg
==
HA_KEY_ALG_RTREE
)
have_rtree
=
1
;
set_if_smaller
(
share
->
blocksize
,
share
->
keyinfo
[
i
].
block_length
);
share
->
keyinfo
[
i
].
seg
=
pos
;
for
(
j
=
0
;
j
<
share
->
keyinfo
[
i
].
keysegs
;
j
++
,
pos
++
)
set_if_smaller
(
share
->
blocksize
,
keyinfo
->
block_length
);
keyinfo
->
seg
=
pos
;
for
(
j
=
0
;
j
<
keyinfo
->
keysegs
;
j
++
,
pos
++
)
{
disk_pos
=
mi_keyseg_read
(
disk_pos
,
pos
);
if
(
pos
->
flag
&
HA_BLOB_PART
&&
...
...
@@ -366,36 +366,36 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
else
if
(
pos
->
type
==
HA_KEYTYPE_BINARY
)
pos
->
charset
=
&
my_charset_bin
;
if
(
!
(
share
->
keyinfo
[
i
].
flag
&
HA_SPATIAL
)
&&
if
(
!
(
keyinfo
->
flag
&
HA_SPATIAL
)
&&
pos
->
start
>
share
->
base
.
reclength
)
{
my_errno
=
HA_ERR_CRASHED
;
goto
err
;
}
}
if
(
share
->
keyinfo
[
i
].
flag
&
HA_SPATIAL
)
if
(
keyinfo
->
flag
&
HA_SPATIAL
)
{
#ifdef HAVE_SPATIAL
uint
sp_segs
=
SPDIMS
*
2
;
share
->
keyinfo
[
i
].
seg
=
pos
-
sp_segs
;
DBUG_ASSERT
(
share
->
keyinfo
[
i
].
keysegs
==
sp_segs
+
1
);
share
->
keyinfo
[
i
].
keysegs
=
sp_segs
;
uint
sp_segs
=
SPDIMS
*
2
;
keyinfo
->
seg
=
pos
-
sp_segs
;
DBUG_ASSERT
(
keyinfo
->
keysegs
==
sp_segs
+
1
);
keyinfo
->
keysegs
=
sp_segs
;
#else
my_errno
=
HA_ERR_UNSUPPORTED
;
goto
err
;
#endif
}
else
if
(
share
->
keyinfo
[
i
].
flag
&
HA_FULLTEXT
)
else
if
(
keyinfo
->
flag
&
HA_FULLTEXT
)
{
if
(
!
fulltext_keys
)
{
/* 4.0 compatibility code, to be removed in 5.0 */
share
->
keyinfo
[
i
].
seg
=
pos
-
FT_SEGS
;
share
->
keyinfo
[
i
].
keysegs
-=
FT_SEGS
;
keyinfo
->
seg
=
pos
-
FT_SEGS
;
keyinfo
->
keysegs
-=
FT_SEGS
;
}
else
{
uint
k
;
share
->
keyinfo
[
i
].
seg
=
pos
;
keyinfo
->
seg
=
pos
;
for
(
k
=
0
;
k
<
FT_SEGS
;
k
++
)
{
*
pos
=
ft_keysegs
[
k
];
...
...
@@ -410,7 +410,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
if
(
!
share
->
ft2_keyinfo
.
seg
)
{
memcpy
(
&
share
->
ft2_keyinfo
,
&
share
->
keyinfo
[
i
]
,
sizeof
(
MI_KEYDEF
));
memcpy
(
&
share
->
ft2_keyinfo
,
keyinfo
,
sizeof
(
MI_KEYDEF
));
share
->
ft2_keyinfo
.
keysegs
=
1
;
share
->
ft2_keyinfo
.
flag
=
0
;
share
->
ft2_keyinfo
.
keylength
=
...
...
@@ -420,10 +420,10 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share
->
ft2_keyinfo
.
end
=
pos
;
setup_key_functions
(
&
share
->
ft2_keyinfo
);
}
share
->
keyinfo
[
i
].
ftkey_nr
=
ftkey_nr
++
;
keyinfo
->
ftkey_nr
=
ftkey_nr
++
;
}
setup_key_functions
(
share
->
keyinfo
+
i
);
share
->
keyinfo
[
i
].
end
=
pos
;
setup_key_functions
(
keyinfo
);
keyinfo
->
end
=
pos
;
pos
->
type
=
HA_KEYTYPE_END
;
/* End */
pos
->
length
=
share
->
base
.
rec_reflength
;
pos
->
null_bit
=
0
;
...
...
@@ -747,7 +747,7 @@ uchar *mi_alloc_rec_buff(MI_INFO *info, ulong length, uchar **buf)
newptr
-=
MI_REC_BUFF_OFFSET
;
if
(
!
(
newptr
=
(
uchar
*
)
my_realloc
((
uchar
*
)
newptr
,
length
+
extra
+
8
,
MYF
(
MY_ALLOW_ZERO_PTR
))))
return
newptr
;
return
NULL
;
*
((
uint32
*
)
newptr
)
=
(
uint32
)
length
;
*
buf
=
newptr
+
(
extra
?
MI_REC_BUFF_OFFSET
:
0
);
}
...
...
@@ -1390,4 +1390,3 @@ int mi_indexes_are_disabled(MI_INFO *info)
*/
return
2
;
}
storage/myisam/myisamchk.c
View file @
5d6aab80
...
...
@@ -819,20 +819,22 @@ static int myisamchk(HA_CHECK *param, char * filename)
char
llbuff
[
22
],
llbuff2
[
22
];
my_bool
state_updated
=
0
;
MYISAM_SHARE
*
share
;
int
open_mode
;
uint
open_flags
=
HA_OPEN_FOR_REPAIR
;
DBUG_ENTER
(
"myisamchk"
);
param
->
out_flag
=
error
=
param
->
warning_printed
=
param
->
error_printed
=
recreate
=
0
;
datafile
=
0
;
param
->
isam_file_name
=
filename
;
/* For error messages */
if
(
!
(
info
=
mi_open
(
filename
,
(
param
->
testflag
&
(
T_DESCRIPT
|
T_READONLY
))
?
O_RDONLY
:
O_RDWR
,
HA_OPEN_FOR_REPAIR
|
((
param
->
testflag
&
T_WAIT_FOREVER
)
?
HA_OPEN_WAIT_IF_LOCKED
:
(
param
->
testflag
&
T_DESCRIPT
)
?
HA_OPEN_IGNORE_IF_LOCKED
:
HA_OPEN_ABORT_IF_LOCKED
)
)))
open_mode
=
param
->
testflag
&
(
T_DESCRIPT
|
T_READONLY
)
?
O_RDONLY
:
O_RDWR
;
if
(
param
->
testflag
&
T_WAIT_FOREVER
)
open_flags
|=
HA_OPEN_WAIT_IF_LOCKED
;
else
if
(
param
->
testflag
&
T_DESCRIPT
)
open_flags
|=
HA_OPEN_IGNORE_IF_LOCKED
;
else
open_flags
|=
HA_OPEN_ABORT_IF_LOCKED
;
if
(
!
(
info
=
mi_open
(
filename
,
open_mode
,
open_flags
)))
{
/* Avoid twice printing of isam file name */
param
->
error_printed
=
1
;
...
...
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