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
8cde040c
Commit
8cde040c
authored
Jun 23, 2014
by
John Esmet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FT-93 Fix another bug, add a sanity check after split/append/deserialize
to help catch these in the future
parent
caeafaa1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
ft/pivotkeys.cc
ft/pivotkeys.cc
+22
-1
No files found.
ft/pivotkeys.cc
View file @
8cde040c
...
...
@@ -138,6 +138,8 @@ void ftnode_pivot_keys::create_from_dbts(const DBT *keys, int n) {
_total_size
+=
size
;
}
}
sanity_check
();
}
void
ftnode_pivot_keys
::
_create_from_fixed_keys
(
const
char
*
fixedkeys
,
size_t
fixed_keylen
,
int
n
)
{
...
...
@@ -156,6 +158,8 @@ void ftnode_pivot_keys::create_from_pivot_keys(const ftnode_pivot_keys &pivotkey
}
else
{
create_from_dbts
(
pivotkeys
.
_dbt_keys
,
pivotkeys
.
_num_pivots
);
}
sanity_check
();
}
void
ftnode_pivot_keys
::
destroy
()
{
...
...
@@ -240,6 +244,8 @@ void ftnode_pivot_keys::deserialize_from_rbuf(struct rbuf *rb, int n) {
if
(
keys_same_size
&&
_num_pivots
>
0
)
{
_convert_to_fixed_format
();
}
sanity_check
();
}
DBT
ftnode_pivot_keys
::
get_pivot
(
int
i
)
const
{
...
...
@@ -341,6 +347,8 @@ void ftnode_pivot_keys::append(const ftnode_pivot_keys &pivotkeys) {
}
_num_pivots
+=
pivotkeys
.
_num_pivots
;
_total_size
+=
pivotkeys
.
_total_size
;
sanity_check
();
}
void
ftnode_pivot_keys
::
_replace_at_dbt
(
const
DBT
*
key
,
int
i
)
{
...
...
@@ -401,7 +409,7 @@ void ftnode_pivot_keys::_split_at_fixed(int i, ftnode_pivot_keys *other) {
other
->
_create_from_fixed_keys
(
_fixed_key
(
i
),
_fixed_keylen
,
_num_pivots
-
i
);
// shrink down to size
_total_size
=
i
*
_fixed_keylen
;
_total_size
=
i
*
_fixed_keylen
_aligned
;
REALLOC_N_ALIGNED
(
64
,
_total_size
,
_fixed_keys
);
}
...
...
@@ -425,6 +433,8 @@ void ftnode_pivot_keys::split_at(int i, ftnode_pivot_keys *other) {
}
_num_pivots
=
i
;
}
sanity_check
();
}
void
ftnode_pivot_keys
::
serialize_to_wbuf
(
struct
wbuf
*
wb
)
const
{
...
...
@@ -456,3 +466,14 @@ size_t ftnode_pivot_keys::serialized_size() const {
// on the fixed keylen and not the aligned keylen.
return
_fixed_format
()
?
_num_pivots
*
_fixed_keylen
:
_total_size
;
}
void
ftnode_pivot_keys
::
sanity_check
()
const
{
if
(
_fixed_format
())
{
invariant
(
_dbt_keys
==
nullptr
);
invariant
(
_fixed_keylen_aligned
==
_align4
(
_fixed_keylen
));
invariant
(
_num_pivots
*
_fixed_keylen
<=
_total_size
);
invariant
(
_num_pivots
*
_fixed_keylen_aligned
==
_total_size
);
}
else
{
invariant
(
_num_pivots
==
0
||
_dbt_keys
!=
nullptr
);
}
}
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