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
ade20c5b
Commit
ade20c5b
authored
Jun 28, 2002
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Indentation cleanup & new comments
parent
ddc8c540
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
216 additions
and
261 deletions
+216
-261
libmysql/Makefile.shared
libmysql/Makefile.shared
+2
-2
myisam/mi_cache.c
myisam/mi_cache.c
+2
-2
myisam/mi_check.c
myisam/mi_check.c
+88
-58
myisam/sort.c
myisam/sort.c
+105
-58
myisammrg/myrg_delete.c
myisammrg/myrg_delete.c
+2
-4
myisammrg/myrg_rsame.c
myisammrg/myrg_rsame.c
+2
-2
myisammrg/myrg_update.c
myisammrg/myrg_update.c
+1
-1
myisammrg/myrg_write.c
myisammrg/myrg_write.c
+1
-1
mysys/Makefile.am
mysys/Makefile.am
+1
-1
mysys/getvar.c
mysys/getvar.c
+0
-111
sql/field.cc
sql/field.cc
+12
-21
No files found.
libmysql/Makefile.shared
View file @
ade20c5b
...
@@ -62,7 +62,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
...
@@ -62,7 +62,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
my_getopt.lo my_gethostbyname.lo
my_getopt.lo my_gethostbyname.lo
# Not needed in the minimum library
# Not needed in the minimum library
mysysobjects2
=
getvar.lo
my_lib.lo
mysysobjects2
=
my_lib.lo
mysysobjects
=
$(mysysobjects1)
$(mysysobjects2)
mysysobjects
=
$(mysysobjects1)
$(mysysobjects2)
target_libadd
=
$(mysysobjects)
$(mystringsobjects)
$(dbugobjects)
\
target_libadd
=
$(mysysobjects)
$(mystringsobjects)
$(dbugobjects)
\
$(vio_objects)
$(vio_objects)
...
...
myisam/mi_cache.c
View file @
ade20c5b
...
@@ -72,8 +72,8 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
...
@@ -72,8 +72,8 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length,
in_buff_length
=
0
;
in_buff_length
=
0
;
if
(
flag
&
READING_NEXT
||
info
->
share
)
if
(
flag
&
READING_NEXT
||
info
->
share
)
{
{
if
(
pos
!=
if
(
pos
!=
(
info
->
pos_in_file
+
(
uint
)
(
info
->
read_end
-
(
info
->
pos_in_file
+
(
uint
)
(
info
->
read_end
-
info
->
request_pos
)))
info
->
request_pos
)))
{
{
info
->
pos_in_file
=
pos
;
/* Force start here */
info
->
pos_in_file
=
pos
;
/* Force start here */
info
->
read_pos
=
info
->
read_end
=
info
->
request_pos
;
/* Everything used */
info
->
read_pos
=
info
->
read_end
=
info
->
request_pos
;
/* Everything used */
...
...
myisam/mi_check.c
View file @
ade20c5b
...
@@ -1203,7 +1203,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
...
@@ -1203,7 +1203,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
for
(
i
=
0
;
i
<
share
->
state
.
header
.
max_block_size
;
i
++
)
for
(
i
=
0
;
i
<
share
->
state
.
header
.
max_block_size
;
i
++
)
share
->
state
.
key_del
[
i
]
=
HA_OFFSET_ERROR
;
share
->
state
.
key_del
[
i
]
=
HA_OFFSET_ERROR
;
/* I think mi_repair and mi_repair_by_sort should do the same
/*
I think mi_repair and mi_repair_by_sort should do the same
(according, e.g. to ha_myisam::repair), but as mi_repair doesn't
(according, e.g. to ha_myisam::repair), but as mi_repair doesn't
touch key_map it cannot be used to T_CREATE_MISSING_KEYS.
touch key_map it cannot be used to T_CREATE_MISSING_KEYS.
That is what the next line is for... (serg)
That is what the next line is for... (serg)
...
@@ -1737,8 +1738,22 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
...
@@ -1737,8 +1738,22 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
type
,
my_errno
);
type
,
my_errno
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
/* Fix table or given index using sorting */
/* saves new table in temp_filename */
/*
Repair table or given index using sorting
SYNOPSIS
mi_repair_by_sort()
param Repair parameters
info MyISAM handler to repair
name Name of table (for warnings)
rep_quick set to <> 0 if we should not change data file
RESULT
0 ok
<>0 Error
*/
int
mi_repair_by_sort
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
int
mi_repair_by_sort
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
const
char
*
name
,
int
rep_quick
)
const
char
*
name
,
int
rep_quick
)
...
@@ -1956,8 +1971,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
...
@@ -1956,8 +1971,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
goto
err
;
goto
err
;
}
}
}
}
share
->
state
.
state
.
data_file_length
=
info
->
state
->
data_file_length
share
->
state
.
state
.
data_file_length
=
info
->
state
->
data_file_length
=
=
sort_param
.
filepos
;
sort_param
.
filepos
;
/* Only whole records */
/* Only whole records */
share
->
state
.
version
=
(
ulong
)
time
((
time_t
*
)
0
);
share
->
state
.
version
=
(
ulong
)
time
((
time_t
*
)
0
);
my_close
(
info
->
dfile
,
MYF
(
0
));
my_close
(
info
->
dfile
,
MYF
(
0
));
...
@@ -2079,19 +2094,35 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
...
@@ -2079,19 +2094,35 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
DBUG_RETURN
(
got_error
);
DBUG_RETURN
(
got_error
);
}
}
/* same as mi_repair_by_sort */
/*
/* but do it multithreaded */
Threaded repair of table using sorting
SYNOPSIS
mi_repair_by_sort_r()
param Repair parameters
info MyISAM handler to repair
name Name of table (for warnings)
rep_quick set to <> 0 if we should not change data file
DESCRIPTION
Same as mi_repair_by_sort but do it multithreaded
Each key is handled by a separate thread.
RESULT
0 ok
<>0 Error
*/
int
mi_repair_by_sort_r
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
int
mi_repair_by_sort_r
(
MI_CHECK
*
param
,
register
MI_INFO
*
info
,
const
char
*
name
,
int
rep_quick
)
const
char
*
name
,
int
rep_quick
)
{
{
int
got_error
;
int
got_error
;
uint
i
,
key
;
uint
i
,
key
,
total_key_length
;
ulong
length
;
ulong
rec_
length
;
ha_rows
start_records
;
ha_rows
start_records
;
my_off_t
new_header_length
,
del
;
my_off_t
new_header_length
,
del
;
File
new_file
;
File
new_file
;
MI_SORT_PARAM
*
sort_param
=
0
,
*
sinfo
;
MI_SORT_PARAM
*
sort_param
=
0
;
MYISAM_SHARE
*
share
=
info
->
s
;
MYISAM_SHARE
*
share
=
info
->
s
;
ulong
*
rec_per_key_part
;
ulong
*
rec_per_key_part
;
MI_KEYSEG
*
keyseg
;
MI_KEYSEG
*
keyseg
;
...
@@ -2193,14 +2224,14 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2193,14 +2224,14 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
my_seek
(
param
->
read_cache
.
file
,
0L
,
MY_SEEK_END
,
MYF
(
0
));
my_seek
(
param
->
read_cache
.
file
,
0L
,
MY_SEEK_END
,
MYF
(
0
));
if
(
share
->
data_file_type
==
DYNAMIC_RECORD
)
if
(
share
->
data_file_type
==
DYNAMIC_RECORD
)
length
=
max
(
share
->
base
.
min_pack_length
+
1
,
share
->
base
.
min_block_length
);
rec_
length
=
max
(
share
->
base
.
min_pack_length
+
1
,
share
->
base
.
min_block_length
);
else
if
(
share
->
data_file_type
==
COMPRESSED_RECORD
)
else
if
(
share
->
data_file_type
==
COMPRESSED_RECORD
)
length
=
share
->
base
.
min_block_length
;
rec_
length
=
share
->
base
.
min_block_length
;
else
else
length
=
share
->
base
.
pack_reclength
;
rec_
length
=
share
->
base
.
pack_reclength
;
sort_info
.
max_records
=
sort_info
.
max_records
=
((
param
->
testflag
&
T_CREATE_MISSING_KEYS
)
?
info
->
state
->
records
:
((
param
->
testflag
&
T_CREATE_MISSING_KEYS
)
?
info
->
state
->
records
:
(
ha_rows
)
(
sort_info
.
filelength
/
length
+
1
));
(
ha_rows
)
(
sort_info
.
filelength
/
rec_
length
+
1
));
del
=
info
->
state
->
del
;
del
=
info
->
state
->
del
;
param
->
glob_crc
=
0
;
param
->
glob_crc
=
0
;
...
@@ -2215,7 +2246,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2215,7 +2246,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
mi_check_print_error
(
param
,
"Not enough memory!"
);
mi_check_print_error
(
param
,
"Not enough memory!"
);
goto
err
;
goto
err
;
}
}
length
=
0
;
total_key_
length
=
0
;
rec_per_key_part
=
param
->
rec_per_key_part
;
rec_per_key_part
=
param
->
rec_per_key_part
;
info
->
state
->
records
=
info
->
state
->
del
=
share
->
state
.
split
=
0
;
info
->
state
->
records
=
info
->
state
->
del
=
share
->
state
.
split
=
0
;
info
->
state
->
empty
=
0
;
info
->
state
->
empty
=
0
;
...
@@ -2235,10 +2266,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2235,10 +2266,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
i
--
;
i
--
;
continue
;
continue
;
}
}
if
((
!
(
param
->
testflag
&
T_SILENT
)))
sort_param
[
i
].
key_read
=
((
sort_param
[
i
].
keyinfo
->
flag
&
HA_FULLTEXT
)
?
printf
(
"- Fixing index %d
\n
"
,
key
+
1
);
sort_ft_key_read
:
sort_key_read
);
sort_param
[
i
].
key_read
=
(
sort_param
[
i
].
keyinfo
->
flag
&
HA_FULLTEXT
)
?
sort_ft_key_read
:
sort_key_read
;
sort_param
[
i
].
key_cmp
=
sort_key_cmp
;
sort_param
[
i
].
key_cmp
=
sort_key_cmp
;
sort_param
[
i
].
key_write
=
sort_key_write
;
sort_param
[
i
].
key_write
=
sort_key_write
;
sort_param
[
i
].
lock_in_memory
=
lock_memory
;
sort_param
[
i
].
lock_in_memory
=
lock_memory
;
...
@@ -2249,8 +2278,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2249,8 +2278,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
sort_param
[
i
].
filepos
=
new_header_length
;
sort_param
[
i
].
filepos
=
new_header_length
;
sort_param
[
i
].
max_pos
=
sort_param
[
i
].
pos
=
share
->
pack
.
header_length
;
sort_param
[
i
].
max_pos
=
sort_param
[
i
].
pos
=
share
->
pack
.
header_length
;
sort_param
[
i
].
record
=
((
char
*
)(
sort_param
+
share
->
base
.
keys
))
+
sort_param
[
i
].
record
=
(
((
char
*
)(
sort_param
+
share
->
base
.
keys
))
+
(
share
->
base
.
pack_reclength
*
i
);
(
share
->
base
.
pack_reclength
*
i
)
);
sort_param
[
i
].
key_length
=
share
->
rec_reflength
;
sort_param
[
i
].
key_length
=
share
->
rec_reflength
;
for
(
keyseg
=
sort_param
[
i
].
keyinfo
->
seg
;
keyseg
->
type
!=
HA_KEYTYPE_END
;
for
(
keyseg
=
sort_param
[
i
].
keyinfo
->
seg
;
keyseg
->
type
!=
HA_KEYTYPE_END
;
...
@@ -2264,8 +2293,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2264,8 +2293,7 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
if
(
keyseg
->
flag
&
HA_NULL_PART
)
if
(
keyseg
->
flag
&
HA_NULL_PART
)
sort_param
[
i
].
key_length
++
;
sort_param
[
i
].
key_length
++
;
}
}
total_key_length
+=
sort_param
[
i
].
key_length
;
length
+=
sort_param
[
i
].
key_length
;
if
(
sort_param
[
i
].
keyinfo
->
flag
&
HA_FULLTEXT
)
if
(
sort_param
[
i
].
keyinfo
->
flag
&
HA_FULLTEXT
)
sort_param
[
i
].
key_length
+=
ft_max_word_len_for_sort
-
ft_max_word_len
;
sort_param
[
i
].
key_length
+=
ft_max_word_len_for_sort
-
ft_max_word_len
;
...
@@ -2274,12 +2302,12 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2274,12 +2302,12 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
sort_param
[
0
].
fix_datafile
=
!
rep_quick
;
sort_param
[
0
].
fix_datafile
=
!
rep_quick
;
sort_info
.
got_error
=
0
;
sort_info
.
got_error
=
0
;
pthread_mutex_init
(
&
sort_info
.
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
sort_info
.
mutex
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
sort_info
.
cond
,
0
);
pthread_cond_init
(
&
sort_info
.
cond
,
0
);
pthread_mutex_lock
(
&
sort_info
.
mutex
);
pthread_mutex_lock
(
&
sort_info
.
mutex
);
init_io_cache_share
(
&
param
->
read_cache
,
&
io_share
,
i
);
init_io_cache_share
(
&
param
->
read_cache
,
&
io_share
,
i
);
for
(
i
=
0
;
i
<
sort_info
.
total_keys
;
i
++
)
for
(
i
=
0
;
i
<
sort_info
.
total_keys
;
i
++
)
{
{
sort_param
[
i
].
read_cache
=
param
->
read_cache
;
sort_param
[
i
].
read_cache
=
param
->
read_cache
;
sort_param
[
i
].
sortbuff_size
=
sort_param
[
i
].
sortbuff_size
=
...
@@ -2292,13 +2320,13 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2292,13 +2320,13 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
#if 1
#if 1
param
->
sort_buffer_length
/
sort_info
.
total_keys
;
param
->
sort_buffer_length
/
sort_info
.
total_keys
;
#else
#else
param
->
sort_buffer_length
*
sort_param
[
i
].
key_length
/
length
;
param
->
sort_buffer_length
*
sort_param
[
i
].
key_length
/
total_key_
length
;
#endif
#endif
if
(
pthread_create
(
&
sort_param
[
i
].
thr
,
0
,
if
(
pthread_create
(
&
sort_param
[
i
].
thr
,
0
,
(
void
*
(
*
)(
void
*
))
_thr_find_all_keys
,
sort_param
+
i
))
(
void
*
(
*
)(
void
*
))
_thr_find_all_keys
,
sort_param
+
i
))
{
{
mi_check_print_error
(
param
,
"Cannot start a repair thread"
);
mi_check_print_error
(
param
,
"Cannot start a repair thread"
);
remove_io_thread
(
&
param
->
read_cache
);
remove_io_thread
(
&
param
->
read_cache
);
sort_info
.
got_error
=
1
;
sort_info
.
got_error
=
1
;
}
}
else
else
...
@@ -2307,17 +2335,17 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2307,17 +2335,17 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
/* waiting for all threads to finish */
/* waiting for all threads to finish */
while
(
sort_info
.
threads_running
)
while
(
sort_info
.
threads_running
)
pthread_cond_wait
(
&
sort_info
.
cond
,
&
sort_info
.
mutex
);
pthread_cond_wait
(
&
sort_info
.
cond
,
&
sort_info
.
mutex
);
pthread_mutex_unlock
(
&
sort_info
.
mutex
);
pthread_mutex_unlock
(
&
sort_info
.
mutex
);
if
(
got_error
=
_thr_write_keys
(
sort_param
))
if
(
(
got_error
=
_thr_write_keys
(
sort_param
)
))
{
{
param
->
retry_repair
=
1
;
param
->
retry_repair
=
1
;
goto
err
;
goto
err
;
}
}
got_error
=
1
;
got_error
=
1
;
/* Assume the following may go wrong */
if
(
sort_param
[
0
].
fix_datafile
)
if
(
sort_param
->
fix_datafile
)
{
{
if
(
write_data_suffix
(
&
sort_info
,
1
)
||
end_io_cache
(
&
info
->
rec_cache
))
if
(
write_data_suffix
(
&
sort_info
,
1
)
||
end_io_cache
(
&
info
->
rec_cache
))
goto
err
;
goto
err
;
...
@@ -2330,8 +2358,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2330,8 +2358,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
goto
err
;
goto
err
;
}
}
}
}
share
->
state
.
state
.
data_file_length
=
info
->
state
->
data_file_length
share
->
state
.
state
.
data_file_length
=
info
->
state
->
data_file_length
=
=
sort_param
->
filepos
;
sort_param
->
filepos
;
/* Only whole records */
/* Only whole records */
share
->
state
.
version
=
(
ulong
)
time
((
time_t
*
)
0
);
share
->
state
.
version
=
(
ulong
)
time
((
time_t
*
)
0
);
my_close
(
info
->
dfile
,
MYF
(
0
));
my_close
(
info
->
dfile
,
MYF
(
0
));
...
@@ -2424,8 +2452,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
...
@@ -2424,8 +2452,8 @@ int mi_repair_by_sort_r(MI_CHECK *param, register MI_INFO *info,
share
->
state
.
changed
&=
~
STATE_NOT_OPTIMIZED_KEYS
;
share
->
state
.
changed
&=
~
STATE_NOT_OPTIMIZED_KEYS
;
share
->
state
.
changed
|=
STATE_NOT_SORTED_PAGES
;
share
->
state
.
changed
|=
STATE_NOT_SORTED_PAGES
;
pthread_cond_destroy
(
&
sort_info
.
cond
);
pthread_cond_destroy
(
&
sort_info
.
cond
);
pthread_mutex_destroy
(
&
sort_info
.
mutex
);
pthread_mutex_destroy
(
&
sort_info
.
mutex
);
my_free
((
gptr
)
sort_info
.
key_block
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
((
gptr
)
sort_info
.
key_block
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
((
gptr
)
sort_param
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
((
gptr
)
sort_param
,
MYF
(
MY_ALLOW_ZERO_PTR
));
...
@@ -2457,7 +2485,8 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
...
@@ -2457,7 +2485,8 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
"Found too many records; Can`t continue"
);
"Found too many records; Can`t continue"
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
}
}
sort_param
->
real_key_length
=
(
info
->
s
->
rec_reflength
+
sort_param
->
real_key_length
=
(
info
->
s
->
rec_reflength
+
_mi_make_key
(
info
,
sort_param
->
key
,
(
uchar
*
)
key
,
_mi_make_key
(
info
,
sort_param
->
key
,
(
uchar
*
)
key
,
sort_param
->
record
,
sort_param
->
filepos
));
sort_param
->
record
,
sort_param
->
filepos
));
DBUG_RETURN
(
sort_write_record
(
sort_param
));
DBUG_RETURN
(
sort_write_record
(
sort_param
));
...
@@ -2981,7 +3010,8 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
...
@@ -2981,7 +3010,8 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
/* Compare two keys from _create_index_by_sort */
/* Compare two keys from _create_index_by_sort */
static
int
sort_key_cmp
(
MI_SORT_PARAM
*
sort_param
,
const
void
*
a
,
const
void
*
b
)
static
int
sort_key_cmp
(
MI_SORT_PARAM
*
sort_param
,
const
void
*
a
,
const
void
*
b
)
{
{
uint
not_used
;
uint
not_used
;
return
(
_mi_key_cmp
(
sort_param
->
keyinfo
->
seg
,
*
((
uchar
**
)
a
),
*
((
uchar
**
)
b
),
return
(
_mi_key_cmp
(
sort_param
->
keyinfo
->
seg
,
*
((
uchar
**
)
a
),
*
((
uchar
**
)
b
),
...
@@ -2999,8 +3029,9 @@ static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
...
@@ -2999,8 +3029,9 @@ static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
if
(
sort_info
->
key_block
->
inited
)
if
(
sort_info
->
key_block
->
inited
)
{
{
cmp
=
_mi_key_cmp
(
sort_param
->
keyinfo
->
seg
,
sort_info
->
key_block
->
lastkey
,
cmp
=
_mi_key_cmp
(
sort_param
->
keyinfo
->
seg
,
sort_info
->
key_block
->
lastkey
,
(
uchar
*
)
a
,
USE_WHOLE_KEY
,
SEARCH_FIND
|
SEARCH_UPDATE
,
&
diff_pos
);
(
uchar
*
)
a
,
USE_WHOLE_KEY
,
SEARCH_FIND
|
SEARCH_UPDATE
,
&
diff_pos
);
sort_param
->
unique
[
diff_pos
-
1
]
++
;
sort_param
->
unique
[
diff_pos
-
1
]
++
;
}
}
else
else
...
@@ -3638,8 +3669,7 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
...
@@ -3638,8 +3669,7 @@ void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
*/
*/
my_bool
mi_test_if_sort_rep
(
MI_INFO
*
info
,
ha_rows
rows
,
my_bool
mi_test_if_sort_rep
(
MI_INFO
*
info
,
ha_rows
rows
,
ulonglong
key_map
,
ulonglong
key_map
,
my_bool
force
)
my_bool
force
)
{
{
MYISAM_SHARE
*
share
=
info
->
s
;
MYISAM_SHARE
*
share
=
info
->
s
;
MI_KEYDEF
*
key
=
share
->
keyinfo
;
MI_KEYDEF
*
key
=
share
->
keyinfo
;
...
...
myisam/sort.c
View file @
ade20c5b
This diff is collapsed.
Click to expand it.
myisammrg/myrg_delete.c
View file @
ade20c5b
...
@@ -18,12 +18,10 @@
...
@@ -18,12 +18,10 @@
#include "myrg_def.h"
#include "myrg_def.h"
int
myrg_delete
(
int
myrg_delete
(
MYRG_INFO
*
info
,
const
byte
*
record
)
MYRG_INFO
*
info
,
const
byte
*
record
)
{
{
if
(
!
info
->
current_table
)
if
(
!
info
->
current_table
)
return
my_errno
=
HA_ERR_NO_ACTIVE_RECORD
;
return
(
my_errno
=
HA_ERR_NO_ACTIVE_RECORD
)
;
return
mi_delete
(
info
->
current_table
->
table
,
record
);
return
mi_delete
(
info
->
current_table
->
table
,
record
);
}
}
myisammrg/myrg_rsame.c
View file @
ade20c5b
...
@@ -19,10 +19,10 @@
...
@@ -19,10 +19,10 @@
int
myrg_rsame
(
MYRG_INFO
*
info
,
byte
*
record
,
int
inx
)
int
myrg_rsame
(
MYRG_INFO
*
info
,
byte
*
record
,
int
inx
)
{
{
if
(
inx
)
/* not yet used, should be 0 */
if
(
inx
)
/* not yet used, should be 0 */
return
my_errno
=
HA_ERR_WRONG_INDEX
;
return
(
my_errno
=
HA_ERR_WRONG_INDEX
)
;
if
(
!
info
->
current_table
)
if
(
!
info
->
current_table
)
return
my_errno
=
HA_ERR_NO_ACTIVE_RECORD
;
return
(
my_errno
=
HA_ERR_NO_ACTIVE_RECORD
)
;
return
mi_rsame
(
info
->
current_table
->
table
,
record
,
inx
);
return
mi_rsame
(
info
->
current_table
->
table
,
record
,
inx
);
}
}
myisammrg/myrg_update.c
View file @
ade20c5b
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
int
myrg_update
(
register
MYRG_INFO
*
info
,
const
byte
*
oldrec
,
byte
*
newrec
)
int
myrg_update
(
register
MYRG_INFO
*
info
,
const
byte
*
oldrec
,
byte
*
newrec
)
{
{
if
(
!
info
->
current_table
)
if
(
!
info
->
current_table
)
return
my_errno
=
HA_ERR_NO_ACTIVE_RECORD
;
return
(
my_errno
=
HA_ERR_NO_ACTIVE_RECORD
)
;
return
mi_update
(
info
->
current_table
->
table
,
oldrec
,
newrec
);
return
mi_update
(
info
->
current_table
->
table
,
oldrec
,
newrec
);
}
}
myisammrg/myrg_write.c
View file @
ade20c5b
...
@@ -26,5 +26,5 @@ int myrg_write(register MYRG_INFO *info, byte *rec)
...
@@ -26,5 +26,5 @@ int myrg_write(register MYRG_INFO *info, byte *rec)
else
if
(
info
->
merge_insert_method
==
MERGE_INSERT_TO_LAST
)
else
if
(
info
->
merge_insert_method
==
MERGE_INSERT_TO_LAST
)
return
mi_write
(
info
->
end_table
[
-
1
].
table
,
rec
);
return
mi_write
(
info
->
end_table
[
-
1
].
table
,
rec
);
else
/* unsupported insertion method */
else
/* unsupported insertion method */
return
my_errno
=
HA_ERR_WRONG_COMMAND
;
return
(
my_errno
=
HA_ERR_WRONG_COMMAND
)
;
}
}
mysys/Makefile.am
View file @
ade20c5b
...
@@ -44,7 +44,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
...
@@ -44,7 +44,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_delete.c my_rename.c my_redel.c my_tempnam.c
\
my_delete.c my_rename.c my_redel.c my_tempnam.c
\
my_chsize.c my_lread.c my_lwrite.c my_clock.c
\
my_chsize.c my_lread.c my_lwrite.c my_clock.c
\
my_quick.c my_lockmem.c my_static.c
\
my_quick.c my_lockmem.c my_static.c
\
my_getopt.c
getvar.c
my_mkdir.c
\
my_getopt.c my_mkdir.c
\
default.c my_compress.c checksum.c raid.cc
\
default.c my_compress.c checksum.c raid.cc
\
my_net.c
\
my_net.c
\
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c
\
my_vsnprintf.c charset.c my_bitmap.c my_bit.c md5.c
\
...
...
mysys/getvar.c
deleted
100644 → 0
View file @
ddc8c540
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Allow use of the -O variable= option to set long variables */
#include "mysys_priv.h"
#include <m_string.h>
#include <m_ctype.h>
#include <my_getopt.h>
/* set all changeable variables */
void
set_all_changeable_vars
(
CHANGEABLE_VAR
*
vars
)
{
for
(
;
vars
->
name
;
vars
++
)
*
vars
->
varptr
=
vars
->
def_value
;
}
my_bool
set_changeable_varval
(
const
char
*
var
,
ulong
val
,
CHANGEABLE_VAR
*
vars
)
{
char
buffer
[
256
];
sprintf
(
buffer
,
"%s=%lu"
,
var
,
(
unsigned
long
)
val
);
return
set_changeable_var
(
buffer
,
vars
);
}
my_bool
set_changeable_var
(
my_string
str
,
CHANGEABLE_VAR
*
vars
)
{
char
endchar
;
my_string
end
;
DBUG_ENTER
(
"set_changeable_var"
);
DBUG_PRINT
(
"enter"
,(
"%s"
,
str
));
if
(
str
)
{
if
(
!
(
end
=
strchr
(
str
,
'='
)))
fprintf
(
stderr
,
"Can't find '=' in expression '%s' to option -O
\n
"
,
str
);
else
{
uint
length
,
found_count
=
0
;
CHANGEABLE_VAR
*
var
,
*
found
;
my_string
var_end
;
const
char
*
name
;
longlong
num
;
/* Skip end space from variable */
for
(
var_end
=
end
;
end
>
str
&&
isspace
(
var_end
[
-
1
])
;
var_end
--
)
;
length
=
(
uint
)
(
var_end
-
str
);
/* Skip start space from argument */
for
(
end
++
;
isspace
(
*
end
)
;
end
++
)
;
for
(
var
=
vars
,
found
=
0
;
(
name
=
var
->
name
)
;
var
++
)
{
if
(
!
my_casecmp
(
name
,
str
,
length
))
{
found
=
var
;
found_count
++
;
if
(
!
name
[
length
])
{
found_count
=
1
;
break
;
}
}
}
if
(
found_count
==
0
)
{
fprintf
(
stderr
,
"No variable match for: -O '%s'
\n
"
,
str
);
DBUG_RETURN
(
1
);
}
if
(
found_count
>
1
)
{
fprintf
(
stderr
,
"Variable prefix '%*s' is not unique
\n
"
,
length
,
str
);
DBUG_RETURN
(
1
);
}
num
=
strtoll
(
end
,
(
char
**
)
NULL
,
10
);
endchar
=
strend
(
end
)[
-
1
];
if
(
endchar
==
'k'
||
endchar
==
'K'
)
num
*=
1024
;
else
if
(
endchar
==
'm'
||
endchar
==
'M'
)
num
*=
1024L
*
1024L
;
else
if
(
endchar
==
'g'
||
endchar
==
'G'
)
num
*=
1024L
*
1024L
*
1024L
;
else
if
(
!
isdigit
(
endchar
))
{
fprintf
(
stderr
,
"Unknown prefix used for variable value '%s'
\n
"
,
str
);
DBUG_RETURN
(
1
);
}
if
(
num
<
(
longlong
)
found
->
min_value
)
num
=
(
longlong
)
found
->
min_value
;
else
if
(
num
>
0
&&
(
ulonglong
)
num
>
(
ulonglong
)
(
ulong
)
found
->
max_value
)
num
=
(
longlong
)
(
ulong
)
found
->
max_value
;
num
=
((
num
-
(
longlong
)
found
->
sub_size
)
/
(
ulonglong
)
found
->
block_size
);
(
*
found
->
varptr
)
=
(
long
)
(
num
*
(
ulonglong
)
found
->
block_size
);
DBUG_RETURN
(
0
);
}
}
DBUG_RETURN
(
1
);
}
sql/field.cc
View file @
ade20c5b
...
@@ -312,8 +312,8 @@ bool Field::optimize_range(uint idx)
...
@@ -312,8 +312,8 @@ bool Field::optimize_range(uint idx)
}
}
/****************************************************************************
/****************************************************************************
**
Functions for the Field_decimal class
Functions for the Field_decimal class
** This is an unpacked number.
This is an number stored as a pre-space (or pre-zero) string
****************************************************************************/
****************************************************************************/
void
void
...
@@ -326,6 +326,8 @@ void Field_decimal::overflow(bool negative)
...
@@ -326,6 +326,8 @@ void Field_decimal::overflow(bool negative)
{
{
uint
len
=
field_length
;
uint
len
=
field_length
;
char
*
to
=
ptr
,
filler
=
'9'
;
char
*
to
=
ptr
,
filler
=
'9'
;
current_thd
->
cuted_fields
++
;
if
(
negative
)
if
(
negative
)
{
{
if
(
!
unsigned_flag
)
if
(
!
unsigned_flag
)
...
@@ -419,7 +421,7 @@ void Field_decimal::store(const char *from,uint len)
...
@@ -419,7 +421,7 @@ void Field_decimal::store(const char *from,uint len)
if
((
tmp_dec
=
dec
))
if
((
tmp_dec
=
dec
))
tmp_dec
++
;
tmp_dec
++
;
for
(;
from
!=
end
&&
isspace
(
*
from
);
from
++
)
;
// Read spaces
for
(;
from
!=
end
&&
isspace
(
*
from
);
from
++
)
;
// Read spaces
if
(
from
==
end
)
if
(
from
==
end
)
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
...
@@ -436,15 +438,14 @@ void Field_decimal::store(const char *from,uint len)
...
@@ -436,15 +438,14 @@ void Field_decimal::store(const char *from,uint len)
{
{
if
(
sign_char
==
'-'
)
if
(
sign_char
==
'-'
)
{
{
current_thd
->
cuted_fields
++
;
Field_decimal
::
overflow
(
1
);
Field_decimal
::
overflow
(
1
);
return
;
return
;
}
}
else
else
sign_char
=
0
;
sign_char
=
0
;
}
}
}
}
pre_zeros_from
=
from
;
pre_zeros_from
=
from
;
for
(;
from
!=
end
&&
*
from
==
'0'
;
from
++
)
;
// Read prezeros
for
(;
from
!=
end
&&
*
from
==
'0'
;
from
++
)
;
// Read prezeros
pre_zeros_end
=
int_digits_from
=
from
;
pre_zeros_end
=
int_digits_from
=
from
;
...
@@ -484,7 +485,7 @@ void Field_decimal::store(const char *from,uint len)
...
@@ -484,7 +485,7 @@ void Field_decimal::store(const char *from,uint len)
if
(
current_thd
->
count_cuted_fields
)
if
(
current_thd
->
count_cuted_fields
)
{
{
for
(;
from
!=
end
&&
isspace
(
*
from
);
from
++
)
;
// Read end spaces
for
(;
from
!=
end
&&
isspace
(
*
from
);
from
++
)
;
// Read end spaces
if
(
from
!=
end
)
// If still something left, warn
if
(
from
!=
end
)
// If still something left, warn
{
{
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
...
@@ -563,7 +564,6 @@ void Field_decimal::store(const char *from,uint len)
...
@@ -563,7 +564,6 @@ void Field_decimal::store(const char *from,uint len)
if
(
field_length
<
tmp_uint
+
(
int
)
(
sign_char
==
'-'
))
if
(
field_length
<
tmp_uint
+
(
int
)
(
sign_char
==
'-'
))
{
{
current_thd
->
cuted_fields
++
;
// too big number, change to max or min number
// too big number, change to max or min number
Field_decimal
::
overflow
(
sign_char
==
'-'
);
Field_decimal
::
overflow
(
sign_char
==
'-'
);
return
;
return
;
...
@@ -606,7 +606,7 @@ void Field_decimal::store(const char *from,uint len)
...
@@ -606,7 +606,7 @@ void Field_decimal::store(const char *from,uint len)
}
}
else
else
{
{
left_wall
=
to
+
(
sign_char
!=
0
)
-
1
;
left_wall
=
to
+
(
sign_char
!=
0
)
-
1
;
if
(
!
expo_sign_char
)
// If exponent was specified, ignore prezeros
if
(
!
expo_sign_char
)
// If exponent was specified, ignore prezeros
{
{
for
(;
pos
!=
left_wall
&&
pre_zeros_from
!=
pre_zeros_end
;
for
(;
pos
!=
left_wall
&&
pre_zeros_from
!=
pre_zeros_end
;
...
@@ -659,7 +659,7 @@ void Field_decimal::store(const char *from,uint len)
...
@@ -659,7 +659,7 @@ void Field_decimal::store(const char *from,uint len)
{
{
if
(
tmp_char
!=
'0'
)
// Losing a non zero digit ?
if
(
tmp_char
!=
'0'
)
// Losing a non zero digit ?
{
{
if
(
current_thd
->
count_cuted_fields
&&
!
is_cuted_fields_incr
)
if
(
!
is_cuted_fields_incr
)
current_thd
->
cuted_fields
++
;
current_thd
->
cuted_fields
++
;
return
;
return
;
}
}
...
@@ -696,14 +696,12 @@ void Field_decimal::store(double nr)
...
@@ -696,14 +696,12 @@ void Field_decimal::store(double nr)
if
(
unsigned_flag
&&
nr
<
0
)
if
(
unsigned_flag
&&
nr
<
0
)
{
{
overflow
(
1
);
overflow
(
1
);
current_thd
->
cuted_fields
++
;
return
;
return
;
}
}
if
(
isinf
(
nr
))
// Handle infinity as special case
if
(
isinf
(
nr
))
// Handle infinity as special case
{
{
overflow
(
nr
<
0.0
);
overflow
(
nr
<
0.0
);
current_thd
->
cuted_fields
++
;
return
;
return
;
}
}
...
@@ -721,10 +719,7 @@ void Field_decimal::store(double nr)
...
@@ -721,10 +719,7 @@ void Field_decimal::store(double nr)
length
=
(
uint
)
strlen
(
buff
);
length
=
(
uint
)
strlen
(
buff
);
if
(
length
>
field_length
)
if
(
length
>
field_length
)
{
overflow
(
nr
<
0.0
);
overflow
(
nr
<
0.0
);
current_thd
->
cuted_fields
++
;
}
else
else
{
{
to
=
ptr
;
to
=
ptr
;
...
@@ -740,7 +735,6 @@ void Field_decimal::store(longlong nr)
...
@@ -740,7 +735,6 @@ void Field_decimal::store(longlong nr)
if
(
unsigned_flag
&&
nr
<
0
)
if
(
unsigned_flag
&&
nr
<
0
)
{
{
overflow
(
1
);
overflow
(
1
);
current_thd
->
cuted_fields
++
;
return
;
return
;
}
}
char
buff
[
22
];
char
buff
[
22
];
...
@@ -748,10 +742,7 @@ void Field_decimal::store(longlong nr)
...
@@ -748,10 +742,7 @@ void Field_decimal::store(longlong nr)
uint
int_part
=
field_length
-
(
dec
?
dec
+
1
:
0
);
uint
int_part
=
field_length
-
(
dec
?
dec
+
1
:
0
);
if
(
length
>
int_part
)
if
(
length
>
int_part
)
{
overflow
(
test
(
nr
<
0L
));
/* purecov: inspected */
overflow
(
test
(
nr
<
0L
));
/* purecov: inspected */
current_thd
->
cuted_fields
++
;
/* purecov: inspected */
}
else
else
{
{
char
fyllchar
=
zerofill
?
(
char
)
'0'
:
(
char
)
' '
;
char
fyllchar
=
zerofill
?
(
char
)
'0'
:
(
char
)
' '
;
...
...
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