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
43ef1198
Commit
43ef1198
authored
Jul 26, 2002
by
serg@sergbook.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MyISAM: always store alloced_rec_buff_length with the buffer itself
parent
5d978447
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
46 deletions
+24
-46
include/myisam.h
include/myisam.h
+0
-1
myisam/mi_check.c
myisam/mi_check.c
+2
-6
myisam/mi_dynrec.c
myisam/mi_dynrec.c
+2
-9
myisam/mi_extra.c
myisam/mi_extra.c
+1
-2
myisam/mi_key.c
myisam/mi_key.c
+1
-2
myisam/mi_open.c
myisam/mi_open.c
+7
-18
myisam/mi_packrec.c
myisam/mi_packrec.c
+2
-4
myisam/myisamdef.h
myisam/myisamdef.h
+9
-4
No files found.
include/myisam.h
View file @
43ef1198
...
...
@@ -379,7 +379,6 @@ typedef struct st_mi_sort_param
my_off_t
pos
,
max_pos
,
filepos
,
start_recpos
;
uint
key
,
key_length
,
real_key_length
,
sortbuff_size
;
uint
maxbuffers
,
keys
,
find_length
,
sort_keys_length
;
uint
alloced_rec_buff_length
;
my_bool
fix_datafile
,
master
;
MI_KEYDEF
*
keyinfo
;
SORT_INFO
*
sort_info
;
...
...
myisam/mi_check.c
View file @
43ef1198
...
...
@@ -841,8 +841,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
if
(
info
->
s
->
base
.
blobs
)
{
if
(
!
(
to
=
mi_alloc_rec_buff
(
info
,
block_info
.
rec_len
,
&
info
->
rec_buff
,
&
info
->
alloced_rec_buff_length
)))
&
info
->
rec_buff
)))
{
mi_check_print_error
(
param
,
"Not enough memory for blob at %s"
,
llstr
(
start_recpos
,
llbuff
));
...
...
@@ -1146,7 +1145,6 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
goto
err
;
info
->
opt_flag
|=
WRITE_CACHE_USED
;
sort_param
.
rec_buff
=
info
->
rec_buff
;
sort_param
.
alloced_rec_buff_length
=
info
->
alloced_rec_buff_length
;
if
(
!
(
sort_param
.
record
=
(
byte
*
)
my_malloc
((
uint
)
share
->
base
.
pack_reclength
,
MYF
(
0
))))
{
...
...
@@ -1810,7 +1808,6 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
info
->
rec_cache
.
file
=
info
->
dfile
;
/* for sort_delete_record */
sort_param
.
rec_buff
=
info
->
rec_buff
;
sort_param
.
alloced_rec_buff_length
=
info
->
alloced_rec_buff_length
;
if
(
!
(
sort_param
.
record
=
(
byte
*
)
my_malloc
((
uint
)
share
->
base
.
pack_reclength
,
MYF
(
0
))))
{
...
...
@@ -2793,8 +2790,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
if
(
share
->
base
.
blobs
)
{
if
(
!
(
to
=
mi_alloc_rec_buff
(
info
,
block_info
.
rec_len
,
&
(
sort_param
->
rec_buff
),
&
(
sort_param
->
alloced_rec_buff_length
))))
&
(
sort_param
->
rec_buff
))))
{
mi_check_print_error
(
param
,
"Not enough memory for blob at %s"
,
llstr
(
sort_param
->
start_recpos
,
llbuff
));
...
...
myisam/mi_dynrec.c
View file @
43ef1198
...
...
@@ -1060,8 +1060,7 @@ int _mi_read_dynamic_record(MI_INFO *info, my_off_t filepos, byte *buf)
if
(
info
->
s
->
base
.
blobs
)
{
if
(
!
(
to
=
mi_alloc_rec_buff
(
info
,
block_info
.
rec_len
,
&
info
->
rec_buff
,
&
info
->
alloced_rec_buff_length
)))
&
info
->
rec_buff
)))
goto
err
;
}
else
...
...
@@ -1107,12 +1106,8 @@ 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
;
alloced_rec_buff_length
=
info
->
alloced_rec_buff_length
;
if
(
info
->
s
->
base
.
blobs
)
{
info
->
rec_buff
=
0
;
info
->
alloced_rec_buff_length
=
0
;
}
error
=
_mi_read_dynamic_record
(
info
,
pos
,
old_record
);
if
(
!
error
)
error
=
mi_unique_comp
(
def
,
record
,
old_record
,
def
->
null_are_equal
);
...
...
@@ -1120,7 +1115,6 @@ int _mi_cmp_dynamic_unique(MI_INFO *info, MI_UNIQUEDEF *def,
{
my_free
(
mi_get_rec_buff_ptr
(
info
,
info
->
rec_buff
),
MYF
(
MY_ALLOW_ZERO_PTR
));
info
->
rec_buff
=
rec_buff
;
info
->
alloced_rec_buff_length
=
alloced_rec_buff_length
;
}
my_afree
(
old_record
);
DBUG_RETURN
(
error
);
...
...
@@ -1331,8 +1325,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
if
(
share
->
base
.
blobs
)
{
if
(
!
(
to
=
mi_alloc_rec_buff
(
info
,
block_info
.
rec_len
,
&
info
->
rec_buff
,
&
info
->
alloced_rec_buff_length
)))
&
info
->
rec_buff
)))
goto
err
;
}
else
...
...
myisam/mi_extra.c
View file @
43ef1198
...
...
@@ -344,8 +344,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
}
if
(
share
->
base
.
blobs
)
mi_alloc_rec_buff
(
info
,
-
1
,
&
info
->
rec_buff
,
&
info
->
alloced_rec_buff_length
);
mi_alloc_rec_buff
(
info
,
-
1
,
&
info
->
rec_buff
);
break
;
case
HA_EXTRA_NORMAL
:
/* Theese isn't in use */
info
->
quick_mode
=
0
;
...
...
myisam/mi_key.c
View file @
43ef1198
...
...
@@ -251,8 +251,7 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
{
if
(
!
(
blob_ptr
=
mi_alloc_rec_buff
(
info
,
info
->
s
->
keyinfo
[
keynr
].
keylength
,
&
info
->
rec_buff
,
&
info
->
alloced_rec_buff_length
)))
&
info
->
rec_buff
)))
goto
err
;
}
key
=
(
byte
*
)
info
->
lastkey
;
...
...
myisam/mi_open.c
View file @
43ef1198
...
...
@@ -507,10 +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_alloc_rec_buff
(
&
info
,
-
1
,
&
info
.
rec_buff
,
&
info
.
alloced_rec_buff_length
))
if
(
!
mi_alloc_rec_buff
(
&
info
,
-
1
,
&
info
.
rec_buff
))
goto
err
;
bzero
(
info
.
rec_buff
,
info
.
alloced_rec_buff_length
);
bzero
(
info
.
rec_buff
,
mi_get_rec_buff_len
(
&
info
,
info
.
rec_buff
)
);
*
m_info
=
info
;
#ifdef THREAD
...
...
@@ -560,21 +559,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
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
)
byte
*
mi_alloc_rec_buff
(
MI_INFO
*
info
,
ulong
length
,
byte
**
buf
)
{
uint
extra
;
if
(
!
*
buf
||
length
>
*
buf_len
)
if
(
!
*
buf
||
length
>
mi_get_rec_buff_len
(
info
,
*
buf
)
)
{
byte
*
newptr
=
*
buf
;
...
...
@@ -588,10 +577,10 @@ byte *mi_alloc_rec_buff(MI_INFO *info, ulong length, byte **buf, uint *buf_len)
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
;
MYF
(
MY_ALLOW_ZERO_PTR
))))
return
newptr
;
*
((
uint
*
)
newptr
)
=
length
;
*
buf
=
newptr
+
(
extra
?
MI_REC_BUFF_OFFSET
:
0
);
*
buf_len
=
length
;
}
return
*
buf
;
}
...
...
myisam/mi_packrec.c
View file @
43ef1198
...
...
@@ -1058,8 +1058,7 @@ uint _mi_pack_get_block_info(MI_INFO *myisam, MI_BLOCK_INFO *info, File file,
head_length
+=
4
;
}
if
(
!
(
mi_alloc_rec_buff
(
myisam
,
info
->
rec_len
+
info
->
blob_len
,
&
myisam
->
rec_buff
,
&
myisam
->
alloced_rec_buff_length
)))
&
myisam
->
rec_buff
)))
return
BLOCK_FATAL_ERROR
;
/* not enough memory */
myisam
->
bit_buff
.
blob_pos
=
(
uchar
*
)
myisam
->
rec_buff
+
info
->
rec_len
;
myisam
->
blob_length
=
info
->
blob_len
;
...
...
@@ -1235,8 +1234,7 @@ static uchar *_mi_mempack_get_block_info(MI_INFO *myisam,MI_BLOCK_INFO *info,
}
/* mi_alloc_rec_buff sets my_errno on error */
if
(
!
(
mi_alloc_rec_buff
(
myisam
,
info
->
blob_len
,
&
myisam
->
rec_buff
,
&
myisam
->
alloced_rec_buff_length
)))
&
myisam
->
rec_buff
)))
return
0
;
/* not enough memory */
myisam
->
bit_buff
.
blob_pos
=
(
uchar
*
)
myisam
->
rec_buff
;
}
...
...
myisam/myisamdef.h
View file @
43ef1198
...
...
@@ -247,7 +247,6 @@ struct st_myisam_info {
int
dfile
;
/* The datafile */
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
;
/* -""- */
int
lastinx
;
/* Last used index */
uint
lastkey_length
;
/* Length of key in lastkey */
...
...
@@ -359,7 +358,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 MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER
+sizeof(uint)
)
#define MEMMAP_EXTRA_MARGIN 7
/* Write this as a suffix for file */
...
...
@@ -523,8 +522,14 @@ 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_alloc_rec_buff
(
MI_INFO
*
,
ulong
,
byte
**
,
uint
*
);
extern
gptr
mi_get_rec_buff_ptr
(
MI_INFO
*
,
byte
*
);
extern
byte
*
mi_alloc_rec_buff
(
MI_INFO
*
,
ulong
,
byte
**
);
#define mi_get_rec_buff_ptr(info,buf) \
((((info)->s->options & HA_OPTION_PACK_RECORD) && (buf)) ? \
(buf) - MI_REC_BUFF_OFFSET : (buf))
#define mi_get_rec_buff_len(info,buf) \
(*((uint *)(mi_get_rec_buff_ptr(info,buf))))
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
*
record
,
byte
*
packpos
);
...
...
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