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
7cd2095c
Commit
7cd2095c
authored
Oct 23, 2015
by
Monty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sage cleanup in heap storage engine
Removed old not needed code withing #if Changed 0x%lx to %p
parent
7ec65585
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
18 additions
and
166 deletions
+18
-166
storage/heap/_check.c
storage/heap/_check.c
+4
-4
storage/heap/hp_delete.c
storage/heap/hp_delete.c
+3
-3
storage/heap/hp_hash.c
storage/heap/hp_hash.c
+1
-12
storage/heap/hp_info.c
storage/heap/hp_info.c
+0
-15
storage/heap/hp_open.c
storage/heap/hp_open.c
+3
-3
storage/heap/hp_rkey.c
storage/heap/hp_rkey.c
+1
-1
storage/heap/hp_rrnd.c
storage/heap/hp_rrnd.c
+2
-58
storage/heap/hp_test1.c
storage/heap/hp_test1.c
+0
-25
storage/heap/hp_test2.c
storage/heap/hp_test2.c
+0
-41
storage/heap/hp_write.c
storage/heap/hp_write.c
+4
-4
No files found.
storage/heap/_check.c
View file @
7cd2095c
...
...
@@ -128,8 +128,8 @@ static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
if
((
rec_link
=
hp_mask
(
hash_info
->
hash_of_key
,
blength
,
records
))
!=
i
)
{
DBUG_PRINT
(
"error"
,
(
"Record in wrong link: Link %lu Record:
0x%lx
Record-link %lu"
,
i
,
(
long
)
hash_info
->
ptr_to_rec
,
rec_link
));
(
"Record in wrong link: Link %lu Record:
%p
Record-link %lu"
,
i
,
hash_info
->
ptr_to_rec
,
rec_link
));
error
=
1
;
}
else
...
...
@@ -186,8 +186,8 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
key_length
,
SEARCH_FIND
|
SEARCH_SAME
,
not_used
))
{
error
=
1
;
DBUG_PRINT
(
"error"
,(
"Record in wrong link: key: %u Record:
0x%lx
\n
"
,
keynr
,
(
long
)
recpos
));
DBUG_PRINT
(
"error"
,(
"Record in wrong link: key: %u Record:
%p
\n
"
,
keynr
,
recpos
));
}
else
found
++
;
...
...
storage/heap/hp_delete.c
View file @
7cd2095c
...
...
@@ -23,7 +23,7 @@ int heap_delete(HP_INFO *info, const uchar *record)
HP_SHARE
*
share
=
info
->
s
;
HP_KEYDEF
*
keydef
,
*
end
,
*
p_lastinx
;
DBUG_ENTER
(
"heap_delete"
);
DBUG_PRINT
(
"enter"
,(
"info:
0x%lx record: 0x%lx"
,
(
long
)
info
,
(
long
)
record
));
DBUG_PRINT
(
"enter"
,(
"info:
%p record: %p"
,
info
,
record
));
test_active
(
info
);
...
...
@@ -139,8 +139,8 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
/* Save for heap_rnext/heap_rprev */
info
->
current_hash_ptr
=
last_ptr
;
info
->
current_ptr
=
last_ptr
?
last_ptr
->
ptr_to_rec
:
0
;
DBUG_PRINT
(
"info"
,(
"Corrected current_ptr to point at:
0x%lx
"
,
(
long
)
info
->
current_ptr
));
DBUG_PRINT
(
"info"
,(
"Corrected current_ptr to point at:
%p
"
,
info
->
current_ptr
));
}
empty
=
pos
;
if
(
gpos
)
...
...
storage/heap/hp_hash.c
View file @
7cd2095c
...
...
@@ -19,8 +19,6 @@
#include "heapdef.h"
#include <m_ctype.h>
/*
Find out how many rows there is in the given range
...
...
@@ -120,7 +118,7 @@ uchar *hp_search(HP_INFO *info, HP_KEYDEF *keyinfo, const uchar *key,
{
switch
(
nextflag
)
{
case
0
:
/* Search after key */
DBUG_PRINT
(
"exit"
,
(
"found key at
0x%lx"
,
(
long
)
pos
->
ptr_to_rec
));
DBUG_PRINT
(
"exit"
,
(
"found key at
%p"
,
pos
->
ptr_to_rec
));
info
->
current_hash_ptr
=
pos
;
DBUG_RETURN
(
info
->
current_ptr
=
pos
->
ptr_to_rec
);
case
1
:
/* Search next */
...
...
@@ -878,17 +876,8 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
/* Convert NULL from MySQL representation into HEAP's. */
if
(
!
(
*
key
++=
(
char
)
1
-
*
old
++
))
{
#if 0
/*
Skip length part of a variable length field.
Length of key-part used with heap_rkey() always 2.
See also hp_hashnr().
*/
if (seg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART))
#else
/* Add key pack length (2) to key for VARCHAR segments */
if
(
seg
->
type
==
HA_KEYTYPE_VARTEXT1
)
#endif
old
+=
2
;
continue
;
}
...
...
storage/heap/hp_info.c
View file @
7cd2095c
...
...
@@ -25,21 +25,6 @@ uchar *heap_position(HP_INFO *info)
}
#ifdef WANT_OLD_HEAP_VERSION
/*
The following should NOT be used anymore as this can't be used together with
heap_rkey()
*/
ulong
heap_position_old
(
HP_INFO
*
info
)
{
return
((
info
->
update
&
HA_STATE_AKTIV
)
?
info
->
current_record
:
(
ulong
)
~
0L
);
}
#endif
/* WANT_OLD_HEAP_CODE */
/* Note that heap_info does NOT return information about the
current position anymore; Use heap_position instead */
...
...
storage/heap/hp_open.c
View file @
7cd2095c
...
...
@@ -49,8 +49,8 @@ HP_INFO *heap_open_from_share(HP_SHARE *share, int mode)
#ifndef DBUG_OFF
info
->
opt_flag
=
READ_CHECK_USED
;
/* Check when changing */
#endif
DBUG_PRINT
(
"exit"
,(
"heap:
0x%lx
reclength: %d records_in_block: %lu"
,
(
long
)
info
,
share
->
reclength
,
DBUG_PRINT
(
"exit"
,(
"heap:
%p
reclength: %d records_in_block: %lu"
,
info
,
share
->
reclength
,
share
->
block
.
records_in_block
));
DBUG_RETURN
(
info
);
}
...
...
@@ -142,7 +142,7 @@ HP_SHARE *hp_find_named_heap(const char *name)
info
=
(
HP_SHARE
*
)
pos
->
data
;
if
(
!
strcmp
(
name
,
info
->
name
))
{
DBUG_PRINT
(
"exit"
,
(
"Old heap_database:
0x%lx"
,
(
long
)
info
));
DBUG_PRINT
(
"exit"
,
(
"Old heap_database:
%p"
,
info
));
DBUG_RETURN
(
info
);
}
}
...
...
storage/heap/hp_rkey.c
View file @
7cd2095c
...
...
@@ -23,7 +23,7 @@ int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
HP_SHARE
*
share
=
info
->
s
;
HP_KEYDEF
*
keyinfo
=
share
->
keydef
+
inx
;
DBUG_ENTER
(
"heap_rkey"
);
DBUG_PRINT
(
"enter"
,(
"info:
0x%lx inx: %d"
,
(
long
)
info
,
inx
));
DBUG_PRINT
(
"enter"
,(
"info:
%p inx: %d"
,
info
,
inx
));
if
((
uint
)
inx
>=
share
->
keys
)
{
...
...
storage/heap/hp_rrnd.c
View file @
7cd2095c
...
...
@@ -29,7 +29,7 @@ int heap_rrnd(register HP_INFO *info, uchar *record, uchar *pos)
{
HP_SHARE
*
share
=
info
->
s
;
DBUG_ENTER
(
"heap_rrnd"
);
DBUG_PRINT
(
"enter"
,(
"info:
0x%lx pos: %lx"
,(
long
)
info
,
(
long
)
pos
));
DBUG_PRINT
(
"enter"
,(
"info:
%p pos: %p"
,
info
,
pos
));
info
->
lastinx
=
-
1
;
if
(
!
(
info
->
current_ptr
=
pos
))
...
...
@@ -44,63 +44,7 @@ int heap_rrnd(register HP_INFO *info, uchar *record, uchar *pos)
}
info
->
update
=
HA_STATE_PREV_FOUND
|
HA_STATE_NEXT_FOUND
|
HA_STATE_AKTIV
;
memcpy
(
record
,
info
->
current_ptr
,(
size_t
)
share
->
reclength
);
DBUG_PRINT
(
"exit"
,
(
"found record at
0x%lx"
,
(
long
)
info
->
current_ptr
));
DBUG_PRINT
(
"exit"
,
(
"found record at
%p"
,
info
->
current_ptr
));
info
->
current_hash_ptr
=
0
;
/* Can't use rnext */
DBUG_RETURN
(
0
);
}
/* heap_rrnd */
#ifdef WANT_OLD_HEAP_VERSION
/*
If pos == -1 then read next record
Returns one of following values:
0 = Ok.
HA_ERR_RECORD_DELETED = Record is deleted.
HA_ERR_END_OF_FILE = EOF.
*/
int
heap_rrnd_old
(
register
HP_INFO
*
info
,
uchar
*
record
,
ulong
pos
)
{
HP_SHARE
*
share
=
info
->
s
;
DBUG_ENTER
(
"heap_rrnd"
);
DBUG_PRINT
(
"enter"
,(
"info: 0x%lx pos: %ld"
,
info
,
pos
));
info
->
lastinx
=
-
1
;
if
(
pos
==
(
ulong
)
-
1
)
{
pos
=
++
info
->
current_record
;
if
(
pos
%
share
->
block
.
records_in_block
&&
/* Quick next record */
pos
<
share
->
records
+
share
->
deleted
&&
(
info
->
update
&
HA_STATE_PREV_FOUND
))
{
info
->
current_ptr
+=
share
->
block
.
recbuffer
;
goto
end
;
}
}
else
info
->
current_record
=
pos
;
if
(
pos
>=
share
->
records
+
share
->
deleted
)
{
info
->
update
=
0
;
DBUG_RETURN
(
my_errno
=
HA_ERR_END_OF_FILE
);
}
/* Find record number pos */
hp_find_record
(
info
,
pos
);
end:
if
(
!
info
->
current_ptr
[
share
->
reclength
])
{
info
->
update
=
HA_STATE_PREV_FOUND
|
HA_STATE_NEXT_FOUND
;
DBUG_RETURN
(
my_errno
=
HA_ERR_RECORD_DELETED
);
}
info
->
update
=
HA_STATE_PREV_FOUND
|
HA_STATE_NEXT_FOUND
|
HA_STATE_AKTIV
;
memcpy
(
record
,
info
->
current_ptr
,(
size_t
)
share
->
reclength
);
DBUG_PRINT
(
"exit"
,(
"found record at 0x%lx"
,
info
->
current_ptr
));
info
->
current_hash_ptr
=
0
;
/* Can't use rnext */
DBUG_RETURN
(
0
);
}
/* heap_rrnd */
#endif
/* WANT_OLD_HEAP_VERSION */
storage/heap/hp_test1.c
View file @
7cd2095c
...
...
@@ -136,31 +136,6 @@ int main(int argc, char **argv)
}
}
#ifdef OLD_HEAP_VERSION
{
int
found
;
printf
(
"- Reading records with position
\n
"
);
for
(
i
=
1
,
found
=
0
;
i
<=
30
;
i
++
)
{
my_errno
=
0
;
if
((
error
=
heap_rrnd
(
file
,
record
,
i
==
1
?
0L
:
(
ulong
)
-
1
))
==
HA_ERR_END_OF_FILE
)
{
if
(
found
!=
25
-
deleted
)
printf
(
"Found only %d of %d records
\n
"
,
found
,
25
-
deleted
);
break
;
}
if
(
!
error
)
found
++
;
if
(
verbose
||
(
error
!=
0
&&
error
!=
HA_ERR_RECORD_DELETED
))
{
printf
(
"pos: %2d ni_rrnd: %3d my_errno: %3d record: %s
\n
"
,
i
-
1
,
error
,
my_errno
,(
char
*
)
record
+
1
);
}
}
}
#endif
if
(
heap_close
(
file
)
||
hp_panic
(
HA_PANIC_CLOSE
))
goto
err
;
my_end
(
MY_GIVE_INFO
);
...
...
storage/heap/hp_test2.c
View file @
7cd2095c
...
...
@@ -428,39 +428,6 @@ int main(int argc, char *argv[])
}
}
#ifdef OLD_HEAP_VERSION
{
uint
check
;
printf
(
"- Read through all records with rnd
\n
"
);
if
(
heap_extra
(
file
,
HA_EXTRA_RESET
)
||
heap_extra
(
file
,
HA_EXTRA_CACHE
))
{
puts
(
"got error from heap_extra"
);
goto
end
;
}
ant
=
check
=
0
;
while
((
error
=
heap_rrnd
(
file
,
record
,(
ulong
)
-
1
))
!=
HA_ERR_END_OF_FILE
&&
ant
<
write_count
+
10
)
{
if
(
!
error
)
{
ant
++
;
check
+=
calc_check
(
record
,
reclength
);
}
}
if
(
ant
!=
write_count
-
opt_delete
)
{
printf
(
"rrnd: I can only find: %d records of %d
\n
"
,
ant
,
write_count
-
opt_delete
);
goto
end
;
}
if
(
heap_extra
(
file
,
HA_EXTRA_NO_CACHE
))
{
puts
(
"got error from heap_extra(HA_EXTRA_NO_CACHE)"
);
goto
end
;
}
}
#endif
printf
(
"- Read through all records with scan
\n
"
);
if
(
heap_reset
(
file
)
||
heap_extra
(
file
,
HA_EXTRA_CACHE
))
{
...
...
@@ -484,14 +451,6 @@ int main(int argc, char *argv[])
write_count
-
opt_delete
);
goto
end
;
}
#ifdef OLD_HEAP_VERSION
if
(
check
!=
check2
)
{
puts
(
"scan: Checksum didn't match reading with rrnd"
);
goto
end
;
}
#endif
if
(
heap_extra
(
file
,
HA_EXTRA_NO_CACHE
))
{
...
...
storage/heap/hp_write.c
View file @
7cd2095c
...
...
@@ -144,7 +144,7 @@ static uchar *next_free_record_pos(HP_SHARE *info)
pos
=
info
->
del_link
;
info
->
del_link
=
*
((
uchar
**
)
pos
);
info
->
deleted
--
;
DBUG_PRINT
(
"exit"
,(
"Used old position:
0x%lx"
,(
long
)
pos
));
DBUG_PRINT
(
"exit"
,(
"Used old position:
%p"
,
pos
));
DBUG_RETURN
(
pos
);
}
if
(
!
(
block_pos
=
(
info
->
records
%
info
->
block
.
records_in_block
)))
...
...
@@ -166,9 +166,9 @@ static uchar *next_free_record_pos(HP_SHARE *info)
DBUG_RETURN
(
NULL
);
info
->
data_length
+=
length
;
}
DBUG_PRINT
(
"exit"
,(
"Used new position:
0x%lx
"
,
(
long
)
(
(
uchar
*
)
info
->
block
.
level_info
[
0
].
last_blocks
+
block_pos
*
info
->
block
.
recbuffer
)));
DBUG_PRINT
(
"exit"
,(
"Used new position:
%p
"
,
((
uchar
*
)
info
->
block
.
level_info
[
0
].
last_blocks
+
block_pos
*
info
->
block
.
recbuffer
)));
DBUG_RETURN
((
uchar
*
)
info
->
block
.
level_info
[
0
].
last_blocks
+
block_pos
*
info
->
block
.
recbuffer
);
}
...
...
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