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
8db687e6
Commit
8db687e6
authored
Aug 26, 2014
by
John Esmet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FT-590 Calculate a node's weight using a 64 bit integer to prevent
overflow
parent
a0150fee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
ft/ft-flusher.cc
ft/ft-flusher.cc
+9
-13
No files found.
ft/ft-flusher.cc
View file @
8db687e6
...
@@ -182,25 +182,21 @@ static int
...
@@ -182,25 +182,21 @@ static int
find_heaviest_child
(
FTNODE
node
)
find_heaviest_child
(
FTNODE
node
)
{
{
int
max_child
=
0
;
int
max_child
=
0
;
int
max_weight
=
toku_bnc_nbytesinbuf
(
BNC
(
node
,
0
))
+
BP_WORKDONE
(
node
,
0
);
uint64_t
max_weight
=
toku_bnc_nbytesinbuf
(
BNC
(
node
,
0
))
+
BP_WORKDONE
(
node
,
0
);
int
i
;
i
f
(
0
)
printf
(
"%s:%d weights: %d"
,
__FILE__
,
__LINE__
,
max_weight
);
i
nvariant
(
node
->
n_children
>
0
);
paranoid_invariant
(
node
->
n_children
>
0
);
for
(
int
i
=
1
;
i
<
node
->
n_children
;
i
++
)
{
for
(
i
=
1
;
i
<
node
->
n_children
;
i
++
)
{
uint64_t
bytes_in_buf
=
toku_bnc_nbytesinbuf
(
BNC
(
node
,
i
));
#ifdef TOKU_DEBUG_PARANOID
uint64_t
workdone
=
BP_WORKDONE
(
node
,
i
);
if
(
BP_WORKDONE
(
node
,
i
)
)
{
if
(
workdone
>
0
)
{
assert
(
toku_bnc_nbytesinbuf
(
BNC
(
node
,
i
))
>
0
);
invariant
(
bytes_in_buf
>
0
);
}
}
#endif
uint64_t
this_weight
=
bytes_in_buf
+
workdone
;
int
this_weight
=
toku_bnc_nbytesinbuf
(
BNC
(
node
,
i
))
+
BP_WORKDONE
(
node
,
i
);;
if
(
0
)
printf
(
" %d"
,
this_weight
);
if
(
max_weight
<
this_weight
)
{
if
(
max_weight
<
this_weight
)
{
max_child
=
i
;
max_child
=
i
;
max_weight
=
this_weight
;
max_weight
=
this_weight
;
}
}
}
}
if
(
0
)
printf
(
"
\n
"
);
return
max_child
;
return
max_child
;
}
}
...
...
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