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
5985904e
Commit
5985904e
authored
May 12, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Many fixes
parent
f8b75e07
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
940 additions
and
334 deletions
+940
-334
include/my_bitmap.h
include/my_bitmap.h
+44
-11
mysys/my_bitmap.c
mysys/my_bitmap.c
+764
-167
sql/handler.cc
sql/handler.cc
+14
-125
sql/handler.h
sql/handler.h
+100
-17
sql/opt_range.cc
sql/opt_range.cc
+7
-4
sql/sql_bitmap.h
sql/sql_bitmap.h
+6
-5
sql/sql_select.cc
sql/sql_select.cc
+5
-5
No files found.
include/my_bitmap.h
View file @
5985904e
...
...
@@ -21,10 +21,13 @@
#define MY_BIT_NONE (~(uint) 0)
typedef
struct
st_bitmap
{
uchar
*
bitmap
;
uint
bitmap_size
;
/* number of bytes occupied by the above */
uint
bitmap_size
;
/* number of bits occupied by the above */
uint32
last_word_mask
;
uint32
*
last_word_ptr
;
/*
mutex will be acquired for the duration of each bitmap operation if
thread_safe flag in bitmap_init was set. Otherwise, we optimize by not
...
...
@@ -38,30 +41,60 @@ typedef struct st_bitmap
#ifdef __cplusplus
extern
"C"
{
#endif
extern
my_bool
bitmap_cmp
(
const
MY_BITMAP
*
map1
,
const
MY_BITMAP
*
map2
);
extern
my_bool
bitmap_init
(
MY_BITMAP
*
map
,
uchar
*
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
(
const
MY_BITMAP
*
map
,
uint
bitmap_bit
);
extern
my_bool
bitmap_is_set_all
(
const
MY_BITMAP
*
map
);
extern
my_bool
bitmap_is_subset
(
const
MY_BITMAP
*
map1
,
const
MY_BITMAP
*
map2
);
extern
uint
bitmap_set_next
(
MY_BITMAP
*
map
);
extern
uint
bitmap_get_first
(
const
MY_BITMAP
*
map
);
extern
uint
bitmap_get_first_set
(
const
MY_BITMAP
*
map
);
extern
uint
bitmap_bits_set
(
const
MY_BITMAP
*
map
);
extern
void
bitmap_clear_all
(
MY_BITMAP
*
map
);
extern
void
bitmap_clear_bit
(
MY_BITMAP
*
map
,
uint
bitmap_bit
);
extern
void
bitmap_free
(
MY_BITMAP
*
map
);
extern
void
bitmap_intersect
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_set_all
(
MY_BITMAP
*
map
);
extern
void
bitmap_set_bit
(
MY_BITMAP
*
map
,
uint
bitmap_bit
);
extern
void
bitmap_set_prefix
(
MY_BITMAP
*
map
,
uint
prefix_size
);
extern
void
bitmap_intersect
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_subtract
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_union
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
uint
bitmap_lock_set_next
(
MY_BITMAP
*
map
);
extern
void
bitmap_lock_clear_bit
(
MY_BITMAP
*
map
,
uint
bitmap_bit
);
#ifdef NOT_USED
extern
uint
bitmap_lock_bits_set
(
const
MY_BITMAP
*
map
);
extern
my_bool
bitmap_lock_is_set_all
(
const
MY_BITMAP
*
map
);
extern
uint
bitmap_lock_get_first
(
const
MY_BITMAP
*
map
);
extern
uint
bitmap_lock_get_first_set
(
const
MY_BITMAP
*
map
);
extern
my_bool
bitmap_lock_is_subset
(
const
MY_BITMAP
*
map1
,
const
MY_BITMAP
*
map2
);
extern
my_bool
bitmap_lock_is_prefix
(
const
MY_BITMAP
*
map
,
uint
prefix_size
);
extern
my_bool
bitmap_lock_is_set
(
const
MY_BITMAP
*
map
,
uint
bitmap_bit
);
extern
my_bool
bitmap_lock_is_clear_all
(
const
MY_BITMAP
*
map
);
extern
my_bool
bitmap_lock_cmp
(
const
MY_BITMAP
*
map1
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_lock_set_all
(
MY_BITMAP
*
map
);
extern
void
bitmap_lock_clear_all
(
MY_BITMAP
*
map
);
extern
void
bitmap_lock_set_bit
(
MY_BITMAP
*
map
,
uint
bitmap_bit
);
extern
void
bitmap_lock_flip_bit
(
MY_BITMAP
*
map
,
uint
bitmap_bit
);
extern
void
bitmap_lock_set_prefix
(
MY_BITMAP
*
map
,
uint
prefix_size
);
extern
void
bitmap_lock_intersect
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_lock_subtract
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_lock_union
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_lock_xor
(
MY_BITMAP
*
map
,
const
MY_BITMAP
*
map2
);
extern
void
bitmap_lock_invert
(
MY_BITMAP
*
map
);
#endif
/* Fast, not thread safe, bitmap functions */
#define bitmap_fast_set_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] |= (1 << ((BIT) & 7))
#define bitmap_fast_clear_bit(MAP, BIT) (MAP)->bitmap[(BIT) / 8] &= ~ (1 << ((BIT) & 7))
#define bitmap_fast_is_set(MAP, BIT) (MAP)->bitmap[(BIT) / 8] & (1 << ((BIT) & 7))
#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_cmp(MAP1, MAP2) \
(memcmp((MAP1)->bitmap, (MAP2)->bitmap, 4*no_words_in_map((MAP1)))==0)
#define bitmap_clear_all(MAP) \
memset((MAP)->bitmap, 0, 4*no_words_in_map((MAP))); \
*(MAP)->last_word_ptr|= (MAP)->last_word_mask
#define bitmap_set_all(MAP) \
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
#ifdef __cplusplus
}
...
...
mysys/my_bitmap.c
View file @
5985904e
This diff is collapsed.
Click to expand it.
sql/handler.cc
View file @
5985904e
...
...
@@ -1357,16 +1357,17 @@ 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
;
DBUG_ENTER
(
"ha_allocate_read_write_set"
);
DBUG_PRINT
(
"info"
,
(
"no_fields = %d"
,
no_fields
));
read_set
=
new
bitvector
;
write_set
=
new
bitvector
;
if
(
!
read_set
||
!
write_set
)
{
ha_deallocate_read_write_set
();
DBUG_RETURN
(
TRUE
);
}
if
(
read_set
->
init
(
no_fields
+
1
)
||
write_set
->
init
(
no_fields
+
1
))
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
));
if
(
!
read_set
||
!
write_set
||
!
read_buf
||
!
write_buf
)
{
ha_deallocate_read_write_set
();
DBUG_RETURN
(
TRUE
);
...
...
@@ -1378,8 +1379,6 @@ int handler::ha_allocate_read_write_set(ulong no_fields)
void
handler
::
ha_deallocate_read_write_set
()
{
DBUG_ENTER
(
"ha_deallocate_read_write_set"
);
delete
read_set
;
delete
write_set
;
read_set
=
write_set
=
0
;
DBUG_VOID_RETURN
;
}
...
...
@@ -1387,127 +1386,17 @@ void handler::ha_deallocate_read_write_set()
void
handler
::
ha_clear_all_set
()
{
DBUG_ENTER
(
"ha_clear_all_set"
);
read_set
->
clear_all
();
write_set
->
clear_all
();
read_set
->
set_bit
((
uint
)
0
);
write_set
->
set_bit
((
uint
)
0
);
DBUG_VOID_RETURN
;
}
void
handler
::
ha_set_all_bits_in_read_set
()
{
DBUG_ENTER
(
"ha_set_all_bits_in_read_set"
);
read_set
->
set_all
();
DBUG_VOID_RETURN
;
}
void
handler
::
ha_set_all_bits_in_write_set
()
{
DBUG_ENTER
(
"ha_set_all_bits_in_write_set"
);
write_set
->
set_all
();
DBUG_VOID_RETURN
;
}
void
handler
::
ha_set_bit_in_read_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_set_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
read_set
->
set_bit
((
size_t
)
fieldnr
);
DBUG_VOID_RETURN
;
}
void
handler
::
ha_clear_bit_in_read_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_clear_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
read_set
->
clear_bit
((
size_t
)
fieldnr
);
DBUG_VOID_RETURN
;
}
void
handler
::
ha_set_bit_in_write_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_set_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
write_set
->
set_bit
((
size_t
)
fieldnr
);
DBUG_VOID_RETURN
;
}
void
handler
::
ha_clear_bit_in_write_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_clear_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
write_set
->
clear_bit
((
size_t
)
fieldnr
);
DBUG_VOID_RETURN
;
}
void
handler
::
ha_set_bit_in_rw_set
(
uint
fieldnr
,
bool
write_op
)
{
DBUG_ENTER
(
"ha_set_bit_in_rw_set"
);
if
(
!
write_op
)
{
DBUG_PRINT
(
"info"
,
(
"Set bit %u in read set"
,
fieldnr
));
read_set
->
set_bit
((
size_t
)
fieldnr
);
}
else
{
DBUG_PRINT
(
"info"
,
(
"Set bit %u in read and write set"
,
fieldnr
));
read_set
->
set_bit
((
size_t
)
fieldnr
);
write_set
->
set_bit
((
size_t
)
fieldnr
);
}
bitmap_clear_all
(
read_set
);
bitmap_clear_all
(
write_set
);
bitmap_set_bit
(
read_set
,
0
);
bitmap_set_bit
(
write_set
,
0
);
DBUG_VOID_RETURN
;
}
bool
handler
::
ha_get_bit_in_read_set
(
uint
fieldnr
)
{
bool
bit_set
=
read_set
->
get_bit
((
size_t
)
fieldnr
);
DBUG_ENTER
(
"ha_get_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"bit %u = %u"
,
fieldnr
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
bool
handler
::
ha_get_bit_in_write_set
(
uint
fieldnr
)
{
bool
bit_set
=
write_set
->
get_bit
((
size_t
)
fieldnr
);
DBUG_ENTER
(
"ha_get_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"bit %u = %u"
,
fieldnr
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
bool
handler
::
ha_get_all_bit_in_read_set
()
{
bool
bit_set
=
read_set
->
get_all_bits_set
();
DBUG_ENTER
(
"ha_get_all_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"all bits set = %u"
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
bool
handler
::
ha_get_all_bit_in_read_clear
()
{
bool
bit_set
=
read_set
->
get_all_bits_clear
();
DBUG_ENTER
(
"ha_get_all_bit_in_read_clear"
);
DBUG_PRINT
(
"info"
,
(
"all bits clear = %u"
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
bool
handler
::
ha_get_all_bit_in_write_set
()
{
bool
bit_set
=
write_set
->
get_all_bits_set
();
DBUG_ENTER
(
"ha_get_all_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"all bits set = %u"
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
bool
handler
::
ha_get_all_bit_in_write_clear
()
{
bool
bit_set
=
write_set
->
get_all_bits_clear
();
DBUG_ENTER
(
"ha_get_all_bit_in_write_clear"
);
DBUG_PRINT
(
"info"
,
(
"all bits clear = %u"
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
int
handler
::
ha_retrieve_all_cols
()
{
DBUG_ENTER
(
"handler::ha_retrieve_all_cols"
);
read_set
->
set_all
(
);
bitmap_set_all
(
read_set
);
DBUG_RETURN
(
0
);
}
...
...
sql/handler.h
View file @
5985904e
...
...
@@ -486,8 +486,8 @@ public:
bool
auto_increment_column_changed
;
bool
implicit_emptied
;
/* Can be !=0 only if HEAP */
const
COND
*
pushed_cond
;
bitvector
*
read_set
;
bitvector
*
write_set
;
MY_BITMAP
*
read_set
;
MY_BITMAP
*
write_set
;
handler
(
TABLE
*
table_arg
)
:
table
(
table_arg
),
ref
(
0
),
data_file_length
(
0
),
max_data_file_length
(
0
),
index_file_length
(
0
),
...
...
@@ -497,7 +497,7 @@ public:
key_used_on_scan
(
MAX_KEY
),
active_index
(
MAX_KEY
),
ref_length
(
sizeof
(
my_off_t
)),
block_size
(
0
),
raid_type
(
0
),
ft_handler
(
0
),
inited
(
NONE
),
implicit_emptied
(
0
),
pushed_cond
(
NULL
)
,
read_set
(
0
),
write_set
(
0
)
pushed_cond
(
NULL
)
{}
virtual
~
handler
(
void
)
{
...
...
@@ -597,24 +597,107 @@ public:
*/
virtual
int
ha_retrieve_all_cols
();
virtual
int
ha_retrieve_all_pk
();
void
ha_set_all_bits_in_read_set
();
void
ha_set_all_bits_in_write_set
();
void
ha_set_bit_in_read_set
(
uint
fieldnr
);
void
ha_clear_bit_in_read_set
(
uint
fieldnr
);
void
ha_set_bit_in_write_set
(
uint
fieldnr
);
void
ha_clear_bit_in_write_set
(
uint
fieldnr
);
void
ha_set_bit_in_rw_set
(
uint
fieldnr
,
bool
write_set
);
bool
ha_get_bit_in_read_set
(
uint
fieldnr
);
bool
ha_get_bit_in_write_set
(
uint
fieldnr
);
bool
ha_get_all_bit_in_read_set
();
bool
ha_get_all_bit_in_read_clear
();
bool
ha_get_all_bit_in_write_set
();
bool
ha_get_all_bit_in_write_clear
();
void
ha_set_all_bits_in_read_set
()
{
DBUG_ENTER
(
"ha_set_all_bits_in_read_set"
);
bitmap_set_all
(
read_set
);
DBUG_VOID_RETURN
;
}
void
ha_set_all_bits_in_write_set
()
{
DBUG_ENTER
(
"ha_set_all_bits_in_write_set"
);
bitmap_set_all
(
write_set
);
DBUG_VOID_RETURN
;
}
void
ha_set_bit_in_read_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_set_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
bitmap_set_bit
(
read_set
,
fieldnr
);
DBUG_VOID_RETURN
;
}
void
ha_clear_bit_in_read_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_clear_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
bitmap_clear_bit
(
read_set
,
fieldnr
);
DBUG_VOID_RETURN
;
}
void
ha_set_bit_in_write_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_set_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
bitmap_set_bit
(
write_set
,
fieldnr
);
DBUG_VOID_RETURN
;
}
void
ha_clear_bit_in_write_set
(
uint
fieldnr
)
{
DBUG_ENTER
(
"ha_clear_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"fieldnr = %d"
,
fieldnr
));
bitmap_clear_bit
(
write_set
,
fieldnr
);
DBUG_VOID_RETURN
;
}
void
ha_set_bit_in_rw_set
(
uint
fieldnr
,
bool
write_op
)
{
DBUG_ENTER
(
"ha_set_bit_in_rw_set"
);
DBUG_PRINT
(
"info"
,
(
"Set bit %u in read set"
,
fieldnr
));
bitmap_set_bit
(
read_set
,
fieldnr
);
if
(
!
write_op
)
{
DBUG_VOID_RETURN
;
}
else
{
DBUG_PRINT
(
"info"
,
(
"Set bit %u in read and write set"
,
fieldnr
));
bitmap_set_bit
(
write_set
,
fieldnr
);
}
DBUG_VOID_RETURN
;
}
bool
ha_get_bit_in_read_set
(
uint
fieldnr
)
{
bool
bit_set
=
bitmap_is_set
(
read_set
,
fieldnr
);
DBUG_ENTER
(
"ha_get_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"bit %u = %u"
,
fieldnr
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
bool
ha_get_bit_in_write_set
(
uint
fieldnr
)
{
bool
bit_set
=
bitmap_is_set
(
write_set
,
fieldnr
);
DBUG_ENTER
(
"ha_get_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"bit %u = %u"
,
fieldnr
,
bit_set
));
DBUG_RETURN
(
bit_set
);
}
bool
ha_get_all_bit_in_read_set
()
{
bool
all_bits_set
=
bitmap_is_set_all
(
read_set
);
DBUG_ENTER
(
"ha_get_all_bit_in_read_set"
);
DBUG_PRINT
(
"info"
,
(
"all bits set = %u"
,
all_bits_set
));
DBUG_RETURN
(
all_bits_set
);
}
bool
ha_get_all_bit_in_read_clear
()
{
bool
all_bits_set
=
bitmap_is_clear_all
(
read_set
);
DBUG_ENTER
(
"ha_get_all_bit_in_read_clear"
);
DBUG_PRINT
(
"info"
,
(
"all bits clear = %u"
,
all_bits_set
));
DBUG_RETURN
(
all_bits_set
);
}
bool
ha_get_all_bit_in_write_set
()
{
bool
all_bits_set
=
bitmap_is_set_all
(
write_set
);
DBUG_ENTER
(
"ha_get_all_bit_in_write_set"
);
DBUG_PRINT
(
"info"
,
(
"all bits set = %u"
,
all_bits_set
));
DBUG_RETURN
(
all_bits_set
);
}
bool
ha_get_all_bit_in_write_clear
()
{
bool
all_bits_set
=
bitmap_is_clear_all
(
write_set
);
DBUG_ENTER
(
"ha_get_all_bit_in_write_clear"
);
DBUG_PRINT
(
"info"
,
(
"all bits clear = %u"
,
all_bits_set
));
DBUG_RETURN
(
all_bits_set
);
}
void
ha_set_primary_key_in_read_set
();
int
ha_allocate_read_write_set
(
ulong
no_fields
);
void
ha_deallocate_read_write_set
();
void
ha_clear_all_set
();
uint
get_index
(
void
)
const
{
return
active_index
;
}
virtual
int
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
=
0
;
virtual
int
close
(
void
)
=
0
;
...
...
sql/opt_range.cc
View file @
5985904e
...
...
@@ -1566,7 +1566,8 @@ static int fill_used_fields_bitmap(PARAM *param)
param
->
fields_bitmap_size
=
(
table
->
s
->
fields
/
8
+
1
);
uchar
*
tmp
;
uint
pk
;
if
(
!
(
tmp
=
(
uchar
*
)
alloc_root
(
param
->
mem_root
,
param
->
fields_bitmap_size
))
||
if
(
!
(
tmp
=
(
uchar
*
)
alloc_root
(
param
->
mem_root
,
bytes_word_aligned
(
param
->
fields_bitmap_size
)))
||
bitmap_init
(
&
param
->
needed_fields
,
tmp
,
param
->
fields_bitmap_size
*
8
,
FALSE
))
return
1
;
...
...
@@ -2321,7 +2322,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
ror_scan
->
records
=
param
->
table
->
quick_rows
[
keynr
];
if
(
!
(
bitmap_buf
=
(
uchar
*
)
alloc_root
(
param
->
mem_root
,
param
->
fields_bitmap_size
)))
bytes_word_aligned
(
param
->
fields_bitmap_size
)
)))
DBUG_RETURN
(
NULL
);
if
(
bitmap_init
(
&
ror_scan
->
covered_fields
,
bitmap_buf
,
...
...
@@ -2441,7 +2442,8 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param)
sizeof
(
ROR_INTERSECT_INFO
))))
return
NULL
;
info
->
param
=
param
;
if
(
!
(
buf
=
(
uchar
*
)
alloc_root
(
param
->
mem_root
,
param
->
fields_bitmap_size
)))
if
(
!
(
buf
=
(
uchar
*
)
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
,
FALSE
))
...
...
@@ -2998,7 +3000,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
/*I=set of all covering indexes */
ror_scan_mark
=
tree
->
ror_scans
;
uchar
buf
[
MAX_KEY
/
8
+
1
];
uint32
int_buf
[
MAX_KEY
/
32
+
1
];
uchar
*
buf
=
(
uchar
*
)
&
int_buf
;
MY_BITMAP
covered_fields
;
if
(
bitmap_init
(
&
covered_fields
,
buf
,
nbits
,
FALSE
))
DBUG_RETURN
(
0
);
...
...
sql/sql_bitmap.h
View file @
5985904e
...
...
@@ -25,7 +25,7 @@
template
<
uint
default_width
>
class
Bitmap
{
MY_BITMAP
map
;
u
char
buffer
[(
default_width
+
7
)
/
8
];
u
int32
buffer
[(
default_width
+
31
)
/
32
];
public:
Bitmap
()
{
init
();
}
Bitmap
(
Bitmap
&
from
)
{
*
this
=
from
;
}
...
...
@@ -62,17 +62,18 @@ public:
char
*
print
(
char
*
buf
)
const
{
char
*
s
=
buf
;
int
i
;
uchar
*
uchar_buffer
=
(
uchar
*
)
&
buffer
;
for
(
i
=
sizeof
(
buffer
)
-
1
;
i
>=
0
;
i
--
)
{
if
((
*
s
=
_dig_vec_upper
[
buffer
[
i
]
>>
4
])
!=
'0'
)
if
((
*
s
=
_dig_vec_upper
[
uchar_
buffer
[
i
]
>>
4
])
!=
'0'
)
break
;
if
((
*
s
=
_dig_vec_upper
[
buffer
[
i
]
&
15
])
!=
'0'
)
if
((
*
s
=
_dig_vec_upper
[
uchar_
buffer
[
i
]
&
15
])
!=
'0'
)
break
;
}
for
(
s
++
,
i
--
;
i
>=
0
;
i
--
)
{
*
s
++=
_dig_vec_upper
[
buffer
[
i
]
>>
4
];
*
s
++=
_dig_vec_upper
[
buffer
[
i
]
&
15
];
*
s
++=
_dig_vec_upper
[
uchar_
buffer
[
i
]
>>
4
];
*
s
++=
_dig_vec_upper
[
uchar_
buffer
[
i
]
&
15
];
}
*
s
=
0
;
return
buf
;
...
...
sql/sql_select.cc
View file @
5985904e
...
...
@@ -7946,7 +7946,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
statistic_increment
(
thd
->
status_var
.
created_tmp_tables
,
&
LOCK_status
);
if
(
use_temp_pool
)
temp_pool_slot
=
bitmap_set_next
(
&
temp_pool
);
temp_pool_slot
=
bitmap_
lock_
set_next
(
&
temp_pool
);
if
(
temp_pool_slot
!=
MY_BIT_NONE
)
// we got a slot
sprintf
(
filename
,
"%s_%lx_%i"
,
tmp_file_prefix
,
...
...
@@ -7998,12 +7998,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
param
->
group_length
:
0
,
NullS
))
{
bitmap_clear_bit
(
&
temp_pool
,
temp_pool_slot
);
bitmap_
lock_
clear_bit
(
&
temp_pool
,
temp_pool_slot
);
DBUG_RETURN
(
NULL
);
/* purecov: inspected */
}
if
(
!
(
param
->
copy_field
=
copy
=
new
Copy_field
[
field_count
]))
{
bitmap_clear_bit
(
&
temp_pool
,
temp_pool_slot
);
bitmap_
lock_
clear_bit
(
&
temp_pool
,
temp_pool_slot
);
my_free
((
gptr
)
table
,
MYF
(
0
));
/* purecov: inspected */
DBUG_RETURN
(
NULL
);
/* purecov: inspected */
}
...
...
@@ -8449,7 +8449,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
err:
free_tmp_table
(
thd
,
table
);
/* purecov: inspected */
bitmap_clear_bit
(
&
temp_pool
,
temp_pool_slot
);
bitmap_
lock_
clear_bit
(
&
temp_pool
,
temp_pool_slot
);
DBUG_RETURN
(
NULL
);
/* purecov: inspected */
}
...
...
@@ -8723,7 +8723,7 @@ free_tmp_table(THD *thd, TABLE *entry)
my_free
((
gptr
)
entry
->
record
[
0
],
MYF
(
0
));
free_io_cache
(
entry
);
bitmap_clear_bit
(
&
temp_pool
,
entry
->
temp_pool_slot
);
bitmap_
lock_
clear_bit
(
&
temp_pool
,
entry
->
temp_pool_slot
);
my_free
((
gptr
)
entry
,
MYF
(
0
));
thd
->
proc_info
=
save_proc_info
;
...
...
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