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
15ca553a
Commit
15ca553a
authored
Jun 02, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitmap bug fixes and interface change
parent
a46f4cf4
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
74 deletions
+112
-74
include/my_bitmap.h
include/my_bitmap.h
+6
-6
mysys/Makefile.am
mysys/Makefile.am
+3
-0
mysys/my_bitmap.c
mysys/my_bitmap.c
+80
-55
sql/handler.cc
sql/handler.cc
+16
-5
sql/opt_range.cc
sql/opt_range.cc
+7
-8
No files found.
include/my_bitmap.h
View file @
15ca553a
...
...
@@ -24,7 +24,7 @@
typedef
struct
st_bitmap
{
u
char
*
bitmap
;
u
int32
*
bitmap
;
uint
bitmap_size
;
/* number of bits occupied by the above */
uint32
last_word_mask
;
uint32
*
last_word_ptr
;
...
...
@@ -41,7 +41,7 @@ typedef struct st_bitmap
#ifdef __cplusplus
extern
"C"
{
#endif
extern
my_bool
bitmap_init
(
MY_BITMAP
*
map
,
u
char
*
buf
,
uint
bitmap_size
,
my_bool
thread_safe
);
extern
my_bool
bitmap_init
(
MY_BITMAP
*
map
,
u
int32
*
buf
,
uint
bitmap_size
,
my_bool
thread_safe
);
extern
my_bool
bitmap_is_clear_all
(
const
MY_BITMAP
*
map
);
extern
my_bool
bitmap_is_prefix
(
const
MY_BITMAP
*
map
,
uint
prefix_size
);
extern
my_bool
bitmap_is_set_all
(
const
MY_BITMAP
*
map
);
...
...
@@ -84,10 +84,10 @@ extern void bitmap_lock_invert(MY_BITMAP *map);
#define no_bytes_in_map(map) ((map->bitmap_size + 7)/8)
#define no_words_in_map(map) ((map->bitmap_size + 31)/32)
#define bytes_word_aligned(bytes) (4*((bytes + 3)/4))
#define bitmap_set_bit(MAP, BIT) ((MAP)->bitmap[(BIT) /
8] |= (1 << ((BIT) & 7
)))
#define bitmap_flip_bit(MAP, BIT) ((MAP)->bitmap[(BIT) /
8] ^= (1 << ((BIT) & 7
)))
#define bitmap_clear_bit(MAP, BIT) ((MAP)->bitmap[(BIT) /
8] &= ~ (1 << ((BIT) & 7
)))
#define bitmap_is_set(MAP, BIT) ((MAP)->bitmap[(BIT) /
8] & (1 << ((BIT) & 7
)))
#define bitmap_set_bit(MAP, BIT) ((MAP)->bitmap[(BIT) /
32] |= (1 << ((BIT) & 31
)))
#define bitmap_flip_bit(MAP, BIT) ((MAP)->bitmap[(BIT) /
32] ^= (1 << ((BIT) & 31
)))
#define bitmap_clear_bit(MAP, BIT) ((MAP)->bitmap[(BIT) /
32] &= ~ (1 << ((BIT) & 31
)))
#define bitmap_is_set(MAP, BIT) ((MAP)->bitmap[(BIT) /
32] & (1 << ((BIT) & 31
)))
#define bitmap_cmp(MAP1, MAP2) \
(memcmp((MAP1)->bitmap, (MAP2)->bitmap, 4*no_words_in_map((MAP1)))==0)
#define bitmap_clear_all(MAP) \
...
...
mysys/Makefile.am
View file @
15ca553a
...
...
@@ -80,6 +80,9 @@ FLAGS=$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @NOINST_LDFLAGS@
# which automaticly removes the object files you use to compile a final program
#
test_bitmap$(EXEEXT)
:
my_bitmap.c $(LIBRARIES)
$(LINK)
$(FLAGS)
-DMAIN
./my_bitmap.c
$(LDADD)
$(LIBS)
test_thr_alarm$(EXEEXT)
:
thr_alarm.c $(LIBRARIES)
$(CP)
$(srcdir)
/thr_alarm.c ./test_thr_alarm.c
$(LINK)
$(FLAGS)
-DMAIN
./test_thr_alarm.c
$(LDADD)
$(LIBS)
...
...
mysys/my_bitmap.c
View file @
15ca553a
This diff is collapsed.
Click to expand it.
sql/handler.cc
View file @
15ca553a
...
...
@@ -1360,20 +1360,31 @@ int handler::ha_initialise()
int
handler
::
ha_allocate_read_write_set
(
ulong
no_fields
)
{
uint
bitmap_size
=
4
*
(((
no_fields
+
1
)
+
31
)
/
32
);
uchar
*
read_buf
,
*
write_buf
;
uint32
*
read_buf
,
*
write_buf
;
#ifndef DEBUG_OFF
my_bool
r
;
#endif
DBUG_ENTER
(
"ha_allocate_read_write_set"
);
DBUG_PRINT
(
"info"
,
(
"no_fields = %d"
,
no_fields
));
read_set
=
(
MY_BITMAP
*
)
sql_alloc
(
sizeof
(
MY_BITMAP
));
write_set
=
(
MY_BITMAP
*
)
sql_alloc
(
sizeof
(
MY_BITMAP
));
read_buf
=
(
uchar
*
)
sql_alloc
(
bitmap_size
);
write_buf
=
(
uchar
*
)
sql_alloc
(
bitmap_size
);
DBUG_ASSERT
(
!
bitmap_init
(
read_set
,
read_buf
,
(
no_fields
+
1
),
FALSE
));
DBUG_ASSERT
(
!
bitmap_init
(
write_set
,
write_buf
,
(
no_fields
+
1
),
FALSE
));
read_buf
=
(
uint32
*
)
sql_alloc
(
bitmap_size
);
write_buf
=
(
uint32
*
)
sql_alloc
(
bitmap_size
);
if
(
!
read_set
||
!
write_set
||
!
read_buf
||
!
write_buf
)
{
ha_deallocate_read_write_set
();
DBUG_RETURN
(
TRUE
);
}
#ifndef DEBUG_OFF
r
=
#endif
bitmap_init
(
read_set
,
read_buf
,
no_fields
+
1
,
FALSE
);
DBUG_ASSERT
(
!
r
/*bitmap_init(read_set...)*/
);
#ifndef DEBUG_OFF
r
=
#endif
bitmap_init
(
write_set
,
write_buf
,
no_fields
+
1
,
FALSE
);
DBUG_ASSERT
(
!
r
/*bitmap_init(write_set...)*/
);
ha_clear_all_set
();
DBUG_RETURN
(
FALSE
);
}
...
...
sql/opt_range.cc
View file @
15ca553a
...
...
@@ -1566,9 +1566,9 @@ static int fill_used_fields_bitmap(PARAM *param)
{
TABLE
*
table
=
param
->
table
;
param
->
fields_bitmap_size
=
(
table
->
s
->
fields
/
8
+
1
);
u
char
*
tmp
;
u
int32
*
tmp
;
uint
pk
;
if
(
!
(
tmp
=
(
u
char
*
)
alloc_root
(
param
->
mem_root
,
if
(
!
(
tmp
=
(
u
int32
*
)
alloc_root
(
param
->
mem_root
,
bytes_word_aligned
(
param
->
fields_bitmap_size
)))
||
bitmap_init
(
&
param
->
needed_fields
,
tmp
,
param
->
fields_bitmap_size
*
8
,
FALSE
))
...
...
@@ -2309,7 +2309,7 @@ static
ROR_SCAN_INFO
*
make_ror_scan
(
const
PARAM
*
param
,
int
idx
,
SEL_ARG
*
sel_arg
)
{
ROR_SCAN_INFO
*
ror_scan
;
u
char
*
bitmap_buf
;
u
int32
*
bitmap_buf
;
uint
keynr
;
DBUG_ENTER
(
"make_ror_scan"
);
if
(
!
(
ror_scan
=
(
ROR_SCAN_INFO
*
)
alloc_root
(
param
->
mem_root
,
...
...
@@ -2323,7 +2323,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
ror_scan
->
sel_arg
=
sel_arg
;
ror_scan
->
records
=
param
->
table
->
quick_rows
[
keynr
];
if
(
!
(
bitmap_buf
=
(
u
char
*
)
alloc_root
(
param
->
mem_root
,
if
(
!
(
bitmap_buf
=
(
u
int32
*
)
alloc_root
(
param
->
mem_root
,
bytes_word_aligned
(
param
->
fields_bitmap_size
))))
DBUG_RETURN
(
NULL
);
...
...
@@ -2439,12 +2439,12 @@ static
ROR_INTERSECT_INFO
*
ror_intersect_init
(
const
PARAM
*
param
)
{
ROR_INTERSECT_INFO
*
info
;
u
char
*
buf
;
u
int32
*
buf
;
if
(
!
(
info
=
(
ROR_INTERSECT_INFO
*
)
alloc_root
(
param
->
mem_root
,
sizeof
(
ROR_INTERSECT_INFO
))))
return
NULL
;
info
->
param
=
param
;
if
(
!
(
buf
=
(
u
char
*
)
alloc_root
(
param
->
mem_root
,
if
(
!
(
buf
=
(
u
int32
*
)
alloc_root
(
param
->
mem_root
,
bytes_word_aligned
(
param
->
fields_bitmap_size
))))
return
NULL
;
if
(
bitmap_init
(
&
info
->
covered_fields
,
buf
,
param
->
fields_bitmap_size
*
8
,
...
...
@@ -3003,9 +3003,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
ror_scan_mark
=
tree
->
ror_scans
;
uint32
int_buf
[
MAX_KEY
/
32
+
1
];
uchar
*
buf
=
(
uchar
*
)
&
int_buf
;
MY_BITMAP
covered_fields
;
if
(
bitmap_init
(
&
covered_fields
,
buf
,
nbits
,
FALSE
))
if
(
bitmap_init
(
&
covered_fields
,
int_
buf
,
nbits
,
FALSE
))
DBUG_RETURN
(
0
);
bitmap_clear_all
(
&
covered_fields
);
...
...
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