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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
3f6491e3
Commit
3f6491e3
authored
Jul 14, 2002
by
serg@sergbook.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yet another generalization for rec_buff handling, MI_INFO doesn't need rec_alloc anymore
parent
0ae810ae
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
47 deletions
+50
-47
myisam/mi_close.c
myisam/mi_close.c
+1
-1
myisam/mi_dynrec.c
myisam/mi_dynrec.c
+4
-34
myisam/mi_extra.c
myisam/mi_extra.c
+1
-5
myisam/mi_open.c
myisam/mi_open.c
+35
-2
myisam/myisamdef.h
myisam/myisamdef.h
+9
-5
No files found.
myisam/mi_close.c
View file @
3f6491e3
...
...
@@ -101,7 +101,7 @@ int mi_close(register MI_INFO *info)
error
=
my_errno
;
myisam_log_command
(
MI_LOG_CLOSE
,
info
,
NULL
,
0
,
error
);
my_free
(
(
gptr
)
info
->
rec_alloc
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
mi_get_rec_buff_ptr
(
info
,
info
->
rec_buff
),
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
((
gptr
)
info
,
MYF
(
0
));
if
(
error
)
...
...
myisam/mi_dynrec.c
View file @
3f6491e3
...
...
@@ -724,8 +724,8 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
/*
** Check if a record was correctly packed. Used only by
isamchk
**
Returns 0 if record is ok.
Check if a record was correctly packed. Used only by my
isamchk
Returns 0 if record is ok.
*/
my_bool
_mi_rec_check
(
MI_INFO
*
info
,
const
char
*
record
)
...
...
@@ -1090,39 +1090,12 @@ err:
DBUG_RETURN
(
-
1
);
}
byte
*
mi_fix_rec_buff_for_blob
(
MI_INFO
*
info
,
ulong
length
)
{
uint
extra
;
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if
(
!
length
)
length
=
max
(
info
->
s
->
base
.
pack_reclength
,
info
->
s
->
base
.
max_key_length
);
if
(
!
info
->
rec_buff
||
length
>
info
->
alloced_rec_buff_length
)
{
byte
*
newptr
;
extra
=
((
info
->
s
->
options
&
HA_OPTION_PACK_RECORD
)
?
ALIGN_SIZE
(
MI_MAX_DYN_BLOCK_HEADER
)
+
MI_SPLIT_LENGTH
+
MI_DYN_DELETE_BLOCK_HEADER
:
0
);
if
(
!
(
newptr
=
(
byte
*
)
my_realloc
((
gptr
)
info
->
rec_alloc
,
length
+
extra
+
8
,
MYF
(
MY_ALLOW_ZERO_PTR
))))
return
(
byte
*
)
0
;
info
->
rec_alloc
=
newptr
;
info
->
rec_buff
=
newptr
+
(
extra
?
ALIGN_SIZE
(
MI_DYN_DELETE_BLOCK_HEADER
)
:
0
);
info
->
alloced_rec_buff_length
=
length
;
}
return
info
->
rec_buff
;
}
/* compare unique constraint between stored rows */
int
_mi_cmp_dynamic_unique
(
MI_INFO
*
info
,
MI_UNIQUEDEF
*
def
,
const
byte
*
record
,
my_off_t
pos
)
{
byte
*
rec_buff
,
*
rec_alloc
,
*
old_record
;
byte
*
rec_buff
,
*
old_record
;
uint
alloced_rec_buff_length
;
int
error
;
DBUG_ENTER
(
"_mi_cmp_dynamic_unique"
);
...
...
@@ -1132,12 +1105,10 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
/* Don't let the compare destroy blobs that may be in use */
rec_buff
=
info
->
rec_buff
;
rec_alloc
=
info
->
rec_alloc
;
alloced_rec_buff_length
=
info
->
alloced_rec_buff_length
;
if
(
info
->
s
->
base
.
blobs
)
{
info
->
rec_buff
=
0
;
info
->
rec_alloc
=
0
;
info
->
alloced_rec_buff_length
=
0
;
}
error
=
_mi_read_dynamic_record
(
info
,
pos
,
old_record
);
...
...
@@ -1145,9 +1116,8 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
error
=
mi_unique_comp
(
def
,
record
,
old_record
,
def
->
null_are_equal
);
if
(
info
->
s
->
base
.
blobs
)
{
my_free
(
info
->
rec_alloc
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
mi_get_rec_buff_ptr
(
info
,
info
->
rec_buff
),
MYF
(
MY_ALLOW_ZERO_PTR
));
info
->
rec_buff
=
rec_buff
;
info
->
rec_alloc
=
rec_alloc
;
info
->
alloced_rec_buff_length
=
alloced_rec_buff_length
;
}
my_afree
(
old_record
);
...
...
myisam/mi_extra.c
View file @
3f6491e3
...
...
@@ -328,11 +328,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function)
}
}
if
(
share
->
base
.
blobs
)
{
my_free
(
info
->
rec_alloc
,
MYF
(
MY_ALLOW_ZERO_PTR
));
info
->
rec_alloc
=
info
->
rec_buff
=
0
;
mi_fix_rec_buff_for_blob
(
info
,
0
);
}
mi_fix_rec_buff_for_blob
(
info
,
-
1
);
break
;
case
HA_EXTRA_NORMAL
:
/* Theese isn't in use */
info
->
quick_mode
=
0
;
...
...
myisam/mi_open.c
View file @
3f6491e3
...
...
@@ -507,9 +507,9 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
/* Allocate buffer for one record */
/* prerequisites: bzero(info) && info->s=share; are met. */
if
(
!
mi_fix_rec_buff_for_blob
(
&
info
,
0
))
if
(
!
mi_fix_rec_buff_for_blob
(
&
info
,
-
1
))
goto
err
;
bzero
(
info
.
rec_
alloc
,
info
.
alloced_rec_buff_length
);
bzero
(
info
.
rec_
buff
,
info
.
alloced_rec_buff_length
);
*
m_info
=
info
;
#ifdef THREAD
...
...
@@ -559,6 +559,39 @@ err:
DBUG_RETURN
(
NULL
);
}
/* mi_open */
gptr
mi_get_rec_buff_ptr
(
MI_INFO
*
info
,
byte
*
buf
)
{
if
(
info
->
s
->
options
&
HA_OPTION_PACK_RECORD
&&
buf
)
return
buf
-
MI_REC_BUFF_OFFSET
;
else
return
buf
;
}
byte
*
mi_alloc_rec_buff
(
MI_INFO
*
info
,
ulong
length
,
byte
**
buf
,
uint
*
buf_len
)
{
uint
extra
;
if
(
!
*
buf
||
length
>
*
buf_len
)
{
byte
*
newptr
=
*
buf
;
/* to simplify initial init of info->rec_buf in mi_open and mi_extra */
if
(
length
==
(
ulong
)
-
1
)
length
=
max
(
info
->
s
->
base
.
pack_reclength
,
info
->
s
->
base
.
max_key_length
);
extra
=
((
info
->
s
->
options
&
HA_OPTION_PACK_RECORD
)
?
ALIGN_SIZE
(
MI_MAX_DYN_BLOCK_HEADER
)
+
MI_SPLIT_LENGTH
+
MI_REC_BUFF_OFFSET
:
0
);
if
(
extra
&&
newptr
)
newptr
-=
MI_REC_BUFF_OFFSET
;
if
(
!
(
newptr
=
(
byte
*
)
my_realloc
((
gptr
)
newptr
,
length
+
extra
+
8
,
MYF
(
MY_ALLOW_ZERO_PTR
))))
return
0
;
*
buf
=
newptr
+
(
extra
?
MI_REC_BUFF_OFFSET
:
0
);
*
buf_len
=
length
;
}
return
*
buf
;
}
ulonglong
mi_safe_mul
(
ulonglong
a
,
ulonglong
b
)
{
...
...
myisam/myisamdef.h
View file @
3f6491e3
...
...
@@ -222,12 +222,11 @@ struct st_myisam_info {
MI_BLOB
*
blobs
;
/* Pointer to blobs */
MI_BIT_BUFF
bit_buff
;
/* accumulate indexfile changes between write's */
TREE
*
bulk_insert
;
TREE
*
bulk_insert
;
char
*
filename
;
/* parameter to open filename */
uchar
*
buff
,
/* Temp area for key */
*
lastkey
,
*
lastkey2
;
/* Last used search key */
byte
*
rec_buff
,
/* Tempbuff for recordpack */
*
rec_alloc
;
/* Malloced area for record */
byte
*
rec_buff
;
/* Tempbuff for recordpack */
uchar
*
int_keypos
,
/* Save position for next/previous */
*
int_maxpos
;
/* -""- */
int
(
*
read_record
)(
struct
st_myisam_info
*
,
my_off_t
,
byte
*
);
...
...
@@ -249,7 +248,7 @@ struct st_myisam_info {
uint
opt_flag
;
/* Optim. for space/speed */
uint
update
;
/* If file changed since open */
uint
alloced_rec_buff_length
;
/* Max recordlength malloced */
uint
int_nod_flag
;
/* -""- */
uint
int_nod_flag
;
/* -""- */
int
lastinx
;
/* Last used index */
uint
lastkey_length
;
/* Length of key in lastkey */
uint
last_rkey_length
;
/* Last length in mi_rkey() */
...
...
@@ -360,6 +359,7 @@ struct st_myisam_info {
#define MI_DYN_ALIGN_SIZE 4
/* Align blocks on this */
#define MI_MAX_DYN_HEADER_BYTE 13
/* max header byte for dynamic rows */
#define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1)))
#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER)
#define MEMMAP_EXTRA_MARGIN 7
/* Write this as a suffix for file */
...
...
@@ -523,7 +523,11 @@ 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
update_auto_increment
(
MI_INFO
*
info
,
const
byte
*
record
);
extern
byte
*
mi_fix_rec_buff_for_blob
(
MI_INFO
*
info
,
ulong
blob_length
);
extern
byte
*
mi_alloc_rec_buff
(
MI_INFO
*
,
ulong
,
byte
**
,
uint
*
);
extern
gptr
mi_get_rec_buff_ptr
(
MI_INFO
*
,
byte
*
);
#define mi_fix_rec_buff_for_blob(INFO,LENGTH) \
mi_alloc_rec_buff((INFO),(LENGTH), \
&((INFO)->rec_buff), &((INFO)->alloced_rec_buff_length))
extern
ulong
_mi_rec_unpack
(
MI_INFO
*
info
,
byte
*
to
,
byte
*
from
,
ulong
reclength
);
extern
my_bool
_mi_rec_check
(
MI_INFO
*
info
,
const
char
*
from
);
...
...
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