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
e88e650d
Commit
e88e650d
authored
Jun 09, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-4.1/
into serg.mylan:/usr/home/serg/Abk/mysql-4.1
parents
d764294f
a2b53947
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
27 deletions
+69
-27
myisam/ft_update.c
myisam/ft_update.c
+45
-21
myisam/mi_delete.c
myisam/mi_delete.c
+14
-1
myisam/mi_page.c
myisam/mi_page.c
+10
-5
No files found.
myisam/ft_update.c
View file @
e88e650d
...
...
@@ -31,18 +31,24 @@
void
_mi_ft_segiterator_init
(
MI_INFO
*
info
,
uint
keynr
,
const
byte
*
record
,
FT_SEG_ITERATOR
*
ftsi
)
{
DBUG_ENTER
(
"_mi_ft_segiterator_init"
);
ftsi
->
num
=
info
->
s
->
keyinfo
[
keynr
].
keysegs
;
ftsi
->
seg
=
info
->
s
->
keyinfo
[
keynr
].
seg
;
ftsi
->
rec
=
record
;
DBUG_VOID_RETURN
;
}
void
_mi_ft_segiterator_dummy_init
(
const
byte
*
record
,
uint
len
,
FT_SEG_ITERATOR
*
ftsi
)
{
DBUG_ENTER
(
"_mi_ft_segiterator_dummy_init"
);
ftsi
->
num
=
1
;
ftsi
->
seg
=
0
;
ftsi
->
pos
=
record
;
ftsi
->
len
=
len
;
DBUG_VOID_RETURN
;
}
/*
...
...
@@ -56,14 +62,16 @@ void _mi_ft_segiterator_dummy_init(const byte *record, uint len,
uint
_mi_ft_segiterator
(
register
FT_SEG_ITERATOR
*
ftsi
)
{
if
(
!
ftsi
->
num
)
return
0
;
else
ftsi
->
num
--
;
if
(
!
ftsi
->
seg
)
return
1
;
else
ftsi
->
seg
--
;
DBUG_ENTER
(
"_mi_ft_segiterator"
);
if
(
!
ftsi
->
num
)
DBUG_RETURN
(
0
)
else
ftsi
->
num
--
;
if
(
!
ftsi
->
seg
)
DBUG_RETURN
(
1
)
else
ftsi
->
seg
--
;
if
(
ftsi
->
seg
->
null_bit
&&
(
ftsi
->
rec
[
ftsi
->
seg
->
null_pos
]
&
ftsi
->
seg
->
null_bit
))
{
ftsi
->
pos
=
0
;
return
1
;
DBUG_RETURN
(
1
)
;
}
ftsi
->
pos
=
ftsi
->
rec
+
ftsi
->
seg
->
start
;
if
(
ftsi
->
seg
->
flag
&
HA_VAR_LENGTH
)
...
...
@@ -71,7 +79,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
ftsi
->
len
=
uint2korr
(
ftsi
->
pos
);
ftsi
->
pos
+=
2
;
/* Skip VARCHAR length */
set_if_smaller
(
ftsi
->
len
,
ftsi
->
seg
->
length
);
return
1
;
DBUG_RETURN
(
1
)
;
}
if
(
ftsi
->
seg
->
flag
&
HA_BLOB_PART
)
{
...
...
@@ -79,10 +87,10 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
memcpy_fixed
((
char
*
)
&
ftsi
->
pos
,
ftsi
->
pos
+
ftsi
->
seg
->
bit_start
,
sizeof
(
char
*
));
set_if_smaller
(
ftsi
->
len
,
ftsi
->
seg
->
length
);
return
1
;
DBUG_RETURN
(
1
)
;
}
ftsi
->
len
=
ftsi
->
seg
->
length
;
return
1
;
DBUG_RETURN
(
1
)
;
}
...
...
@@ -91,6 +99,8 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi)
uint
_mi_ft_parse
(
TREE
*
parsed
,
MI_INFO
*
info
,
uint
keynr
,
const
byte
*
record
)
{
FT_SEG_ITERATOR
ftsi
;
DBUG_ENTER
(
"_mi_ft_parse"
);
_mi_ft_segiterator_init
(
info
,
keynr
,
record
,
&
ftsi
);
ft_parse_init
(
parsed
,
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
);
...
...
@@ -98,9 +108,9 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record)
{
if
(
ftsi
.
pos
)
if
(
ft_parse
(
parsed
,
(
byte
*
)
ftsi
.
pos
,
ftsi
.
len
))
return
1
;
DBUG_RETURN
(
1
)
;
}
return
0
;
DBUG_RETURN
(
0
)
;
}
FT_WORD
*
_mi_ft_parserecord
(
MI_INFO
*
info
,
uint
keynr
,
...
...
@@ -108,32 +118,35 @@ FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr,
const
byte
*
record
)
{
TREE
ptree
;
DBUG_ENTER
(
"_mi_ft_parserecord"
);
bzero
((
char
*
)
&
ptree
,
sizeof
(
ptree
));
if
(
_mi_ft_parse
(
&
ptree
,
info
,
keynr
,
record
))
return
NULL
;
DBUG_RETURN
(
NULL
)
;
return
ft_linearize
(
&
ptree
);
DBUG_RETURN
(
ft_linearize
(
&
ptree
)
);
}
static
int
_mi_ft_store
(
MI_INFO
*
info
,
uint
keynr
,
byte
*
keybuf
,
FT_WORD
*
wlist
,
my_off_t
filepos
)
{
uint
key_length
;
DBUG_ENTER
(
"_mi_ft_store"
);
for
(;
wlist
->
pos
;
wlist
++
)
{
key_length
=
_ft_make_key
(
info
,
keynr
,
keybuf
,
wlist
,
filepos
);
if
(
_mi_ck_write
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
))
return
1
;
DBUG_RETURN
(
1
)
;
}
return
0
;
DBUG_RETURN
(
0
)
;
}
static
int
_mi_ft_erase
(
MI_INFO
*
info
,
uint
keynr
,
byte
*
keybuf
,
FT_WORD
*
wlist
,
my_off_t
filepos
)
{
uint
key_length
,
err
=
0
;
DBUG_ENTER
(
"_mi_ft_erase"
);
for
(;
wlist
->
pos
;
wlist
++
)
{
...
...
@@ -141,7 +154,7 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf,
if
(
_mi_ck_delete
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
))
err
=
1
;
}
return
err
;
DBUG_RETURN
(
err
)
;
}
/*
...
...
@@ -156,6 +169,8 @@ 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"
);
_mi_ft_segiterator_init
(
info
,
keynr
,
rec1
,
&
ftsi1
);
_mi_ft_segiterator_init
(
info
,
keynr
,
rec2
,
&
ftsi2
);
...
...
@@ -165,9 +180,9 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
(
!
ftsi1
.
pos
||
!
ftsi2
.
pos
||
mi_compare_text
(
cs
,
(
uchar
*
)
ftsi1
.
pos
,
ftsi1
.
len
,
(
uchar
*
)
ftsi2
.
pos
,
ftsi2
.
len
,
0
)))
return
THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT
;
DBUG_RETURN
(
THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT
)
;
}
return
GEE_THEY_ARE_ABSOLUTELY_IDENTICAL
;
DBUG_RETURN
(
GEE_THEY_ARE_ABSOLUTELY_IDENTICAL
)
;
}
...
...
@@ -181,6 +196,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
CHARSET_INFO
*
cs
=
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
;
uint
key_length
;
int
cmp
,
cmp2
;
DBUG_ENTER
(
"_mi_ft_update"
);
if
(
!
(
old_word
=
oldlist
=
_mi_ft_parserecord
(
info
,
keynr
,
keybuf
,
oldrec
)))
goto
err0
;
...
...
@@ -219,7 +235,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
err1:
my_free
((
char
*
)
oldlist
,
MYF
(
0
));
err0:
return
error
;
DBUG_RETURN
(
error
)
;
}
...
...
@@ -230,13 +246,14 @@ int _mi_ft_add(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
{
int
error
=
-
1
;
FT_WORD
*
wlist
;
DBUG_ENTER
(
"_mi_ft_add"
);
if
((
wlist
=
_mi_ft_parserecord
(
info
,
keynr
,
keybuf
,
record
)))
{
error
=
_mi_ft_store
(
info
,
keynr
,
keybuf
,
wlist
,
pos
);
my_free
((
char
*
)
wlist
,
MYF
(
0
));
}
return
error
;
DBUG_RETURN
(
error
)
;
}
...
...
@@ -247,27 +264,34 @@ int _mi_ft_del(MI_INFO *info, uint keynr, byte *keybuf, const byte *record,
{
int
error
=
-
1
;
FT_WORD
*
wlist
;
DBUG_ENTER
(
"_mi_ft_del"
);
DBUG_PRINT
(
"enter"
,(
"keynr: %d"
,
keynr
));
if
((
wlist
=
_mi_ft_parserecord
(
info
,
keynr
,
keybuf
,
record
)))
{
error
=
_mi_ft_erase
(
info
,
keynr
,
keybuf
,
wlist
,
pos
);
my_free
((
char
*
)
wlist
,
MYF
(
0
));
}
return
error
;
DBUG_PRINT
(
"exit"
,(
"Return: %d"
,
error
));
DBUG_RETURN
(
error
);
}
uint
_ft_make_key
(
MI_INFO
*
info
,
uint
keynr
,
byte
*
keybuf
,
FT_WORD
*
wptr
,
my_off_t
filepos
)
{
byte
buf
[
HA_FT_MAXLEN
+
16
];
DBUG_ENTER
(
"_ft_make_key"
);
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
float
weight
=
(
float
)
((
filepos
==
HA_OFFSET_ERROR
)
?
0
:
wptr
->
weight
);
mi_float4store
(
buf
,
weight
);
{
float
weight
=
(
float
)
((
filepos
==
HA_OFFSET_ERROR
)
?
0
:
wptr
->
weight
);
mi_float4store
(
buf
,
weight
);
}
#else
#error
#endif
int2store
(
buf
+
HA_FT_WLEN
,
wptr
->
len
);
memcpy
(
buf
+
HA_FT_WLEN
+
2
,
wptr
->
pos
,
wptr
->
len
);
return
_mi_make_key
(
info
,
keynr
,(
uchar
*
)
keybuf
,
buf
,
filepos
);
DBUG_RETURN
(
_mi_make_key
(
info
,
keynr
,(
uchar
*
)
keybuf
,
buf
,
filepos
)
);
}
myisam/mi_delete.c
View file @
e88e650d
...
...
@@ -33,7 +33,7 @@ static int underflow(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *anc_buff,
static
uint
remove_key
(
MI_KEYDEF
*
keyinfo
,
uint
nod_flag
,
uchar
*
keypos
,
uchar
*
lastkey
,
uchar
*
page_end
,
my_off_t
*
next_block
);
static
int
_mi_ck_real_delete
(
register
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
static
int
_mi_ck_real_delete
(
register
MI_INFO
*
info
,
MI_KEYDEF
*
keyinfo
,
uchar
*
key
,
uint
key_length
,
my_off_t
*
root
);
...
...
@@ -188,6 +188,7 @@ static int _mi_ck_real_delete(register MI_INFO *info, MI_KEYDEF *keyinfo,
}
err:
my_afree
((
gptr
)
root_buff
);
DBUG_PRINT
(
"exit"
,(
"Return: %d"
,
error
));
DBUG_RETURN
(
error
);
}
/* _mi_ck_real_delete */
...
...
@@ -234,6 +235,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if
(
subkeys
>=
0
)
{
/* normal word, one-level tree structure */
DBUG_PRINT
(
"info"
,(
"FT1"
));
flag
=
(
*
keyinfo
->
bin_search
)(
info
,
keyinfo
,
anc_buff
,
key
,
USE_WHOLE_KEY
,
comp_flag
,
&
keypos
,
lastkey
,
&
last_key
);
/* fall through to normal delete */
...
...
@@ -250,11 +252,13 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if
(
subkeys
==
-
1
)
{
/* the last entry in sub-tree */
DBUG_PRINT
(
"info"
,(
"FT2: the last entry"
));
_mi_dispose
(
info
,
keyinfo
,
root
);
/* fall through to normal delete */
}
else
{
DBUG_PRINT
(
"info"
,(
"FT2: going down"
));
keyinfo
=&
info
->
s
->
ft2_keyinfo
;
kpos
-=
keyinfo
->
keylength
;
/* we'll modify key entry 'in vivo' */
key
+=
off
;
...
...
@@ -265,6 +269,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
ft_intXstore
(
kpos
,
subkeys
);
if
(
!
ret_value
)
ret_value
=
_mi_write_keypage
(
info
,
keyinfo
,
page
,
anc_buff
);
DBUG_PRINT
(
"exit"
,(
"Return: %d"
,
ret_value
));
DBUG_RETURN
(
ret_value
);
}
}
...
...
@@ -279,6 +284,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
{
DBUG_PRINT
(
"error"
,(
"Couldn't allocate memory"
));
my_errno
=
ENOMEM
;
DBUG_PRINT
(
"exit"
,(
"Return: %d"
,
-
1
));
DBUG_RETURN
(
-
1
);
}
if
(
!
_mi_fetch_keypage
(
info
,
keyinfo
,
leaf_page
,
leaf_buff
,
0
))
...
...
@@ -304,14 +310,20 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
tmp
=
remove_key
(
keyinfo
,
nod_flag
,
keypos
,
lastkey
,
anc_buff
+
length
,
&
next_block
);
if
(
tmp
==
0
)
{
DBUG_PRINT
(
"exit"
,(
"Return: %d"
,
0
));
DBUG_RETURN
(
0
);
}
length
-=
tmp
;
mi_putint
(
anc_buff
,
length
,
nod_flag
);
if
(
!
nod_flag
)
{
/* On leaf page */
if
(
_mi_write_keypage
(
info
,
keyinfo
,
page
,
anc_buff
))
{
DBUG_PRINT
(
"exit"
,(
"Return: %d"
,
-
1
));
DBUG_RETURN
(
-
1
);
}
/* Page will be update later if we return 1 */
DBUG_RETURN
(
test
(
length
<=
(
info
->
quick_mode
?
MI_MIN_KEYBLOCK_LENGTH
:
(
uint
)
keyinfo
->
underflow_block_length
)));
...
...
@@ -348,6 +360,7 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_DUMP
(
"page"
,(
byte
*
)
anc_buff
,
mi_getint
(
anc_buff
));
}
my_afree
((
byte
*
)
leaf_buff
);
DBUG_PRINT
(
"exit"
,(
"Return: %d"
,
ret_value
));
DBUG_RETURN
(
ret_value
);
err:
my_afree
((
byte
*
)
leaf_buff
);
...
...
myisam/mi_page.c
View file @
e88e650d
...
...
@@ -28,6 +28,9 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
{
uchar
*
tmp
;
uint
page_size
;
DBUG_ENTER
(
"_mi_fetch_keypage"
);
DBUG_PRINT
(
"enter"
,(
"page: %ld"
,
page
));
tmp
=
(
uchar
*
)
key_cache_read
(
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
(
uint
)
keyinfo
->
block_length
,
(
uint
)
keyinfo
->
block_length
,
...
...
@@ -39,7 +42,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_PRINT
(
"error"
,(
"Got errno: %d from key_cache_read"
,
my_errno
));
info
->
last_keypage
=
HA_OFFSET_ERROR
;
my_errno
=
HA_ERR_CRASHED
;
return
0
;
DBUG_RETURN
(
0
)
;
}
info
->
last_keypage
=
page
;
page_size
=
mi_getint
(
tmp
);
...
...
@@ -51,7 +54,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
my_errno
=
HA_ERR_CRASHED
;
tmp
=
0
;
}
return
tmp
;
DBUG_RETURN
(
tmp
)
;
}
/* _mi_fetch_keypage */
...
...
@@ -61,6 +64,8 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_off_t
page
,
uchar
*
buff
)
{
reg3
uint
length
;
DBUG_ENTER
(
"_mi_write_keypage"
);
#ifndef FAST
/* Safety check */
if
(
page
<
info
->
s
->
base
.
keystart
||
page
+
keyinfo
->
block_length
>
info
->
state
->
key_file_length
||
...
...
@@ -71,7 +76,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
(
long
)
info
->
state
->
key_file_length
,
(
long
)
page
));
my_errno
=
EINVAL
;
return
(
-
1
);
DBUG_RETURN
((
-
1
)
);
}
DBUG_PRINT
(
"page"
,(
"write page at: %lu"
,(
long
)
page
,
buff
));
DBUG_DUMP
(
"buff"
,(
byte
*
)
buff
,
mi_getint
(
buff
));
...
...
@@ -87,10 +92,10 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
length
=
keyinfo
->
block_length
;
}
#endif
return
(
key_cache_write
(
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
length
,
DBUG_RETURN
(
(
key_cache_write
(
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
length
,
(
uint
)
keyinfo
->
block_length
,
(
int
)
((
info
->
lock_type
!=
F_UNLCK
)
||
info
->
s
->
delay_key_write
)));
info
->
s
->
delay_key_write
)))
)
;
}
/* mi_write_keypage */
...
...
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