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
a3553a13
Commit
a3553a13
authored
Oct 30, 2019
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5.6.45-86.1
parent
24a0d7c5
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
231 additions
and
134 deletions
+231
-134
storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake
storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake
+1
-1
storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
+0
-34
storage/tokudb/PerconaFT/portability/CMakeLists.txt
storage/tokudb/PerconaFT/portability/CMakeLists.txt
+0
-1
storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
.../tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
+1
-1
storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
+1
-1
storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
...e/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
+1
-1
storage/tokudb/ha_tokudb.cc
storage/tokudb/ha_tokudb.cc
+2
-1
storage/tokudb/ha_tokudb.h
storage/tokudb/ha_tokudb.h
+2
-1
storage/tokudb/hatoku_cmp.cc
storage/tokudb/hatoku_cmp.cc
+4
-4
storage/tokudb/tests/math_test_int.cc
storage/tokudb/tests/math_test_int.cc
+118
-44
storage/tokudb/tests/math_test_uint.cc
storage/tokudb/tests/math_test_uint.cc
+61
-23
storage/tokudb/tests/sint_test.cc
storage/tokudb/tests/sint_test.cc
+0
-1
storage/tokudb/tests/tokudb_buffer_test.cc
storage/tokudb/tests/tokudb_buffer_test.cc
+8
-3
storage/tokudb/tests/uint_test.cc
storage/tokudb/tests/uint_test.cc
+0
-1
storage/tokudb/tests/vlq_test.cc
storage/tokudb/tests/vlq_test.cc
+6
-3
storage/tokudb/tests/vlq_test_uint32.cc
storage/tokudb/tests/vlq_test_uint32.cc
+10
-5
storage/tokudb/tests/vlq_test_uint64.cc
storage/tokudb/tests/vlq_test_uint64.cc
+10
-5
storage/tokudb/tokudb_buffer.h
storage/tokudb/tokudb_buffer.h
+2
-2
storage/tokudb/tokudb_math.h
storage/tokudb/tokudb_math.h
+4
-2
No files found.
storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake
View file @
a3553a13
...
@@ -6,7 +6,7 @@ FUNCTION(TOKU_GET_DEPENDEND_OS_LIBS target result)
...
@@ -6,7 +6,7 @@ FUNCTION(TOKU_GET_DEPENDEND_OS_LIBS target result)
IF
(
deps
)
IF
(
deps
)
FOREACH
(
lib
${
deps
}
)
FOREACH
(
lib
${
deps
}
)
# Filter out keywords for used for debug vs optimized builds
# Filter out keywords for used for debug vs optimized builds
IF
(
NOT lib MATCHES
"general"
AND NOT lib MATCHES
"debug"
AND NOT lib MATCHES
"optimized"
)
IF
(
TARGET
${
lib
}
)
GET_TARGET_PROPERTY
(
lib_location
${
lib
}
LOCATION
)
GET_TARGET_PROPERTY
(
lib_location
${
lib
}
LOCATION
)
IF
(
NOT lib_location
)
IF
(
NOT lib_location
)
SET
(
ret
${
ret
}
${
lib
}
)
SET
(
ret
${
ret
}
${
lib
}
)
...
...
storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
View file @
a3553a13
include
(
ExternalProject
)
include
(
ExternalProject
)
if
(
NOT DEFINED LIBJEMALLOC
)
## add jemalloc with an external project
set
(
JEMALLOC_SOURCE_DIR
"
${
TokuDB_SOURCE_DIR
}
/third_party/jemalloc"
CACHE FILEPATH
"Where to find jemalloc sources."
)
if
(
EXISTS
"
${
JEMALLOC_SOURCE_DIR
}
/configure"
)
set
(
jemalloc_configure_opts
"CC=
${
CMAKE_C_COMPILER
}
"
"--with-jemalloc-prefix="
"--with-private-namespace=tokudb_jemalloc_internal_"
"--enable-cc-silence"
)
option
(
JEMALLOC_DEBUG
"Build jemalloc with --enable-debug."
OFF
)
if
(
JEMALLOC_DEBUG
)
list
(
APPEND jemalloc_configure_opts --enable-debug
)
endif
()
ExternalProject_Add
(
build_jemalloc
PREFIX jemalloc
SOURCE_DIR
"
${
JEMALLOC_SOURCE_DIR
}
"
CONFIGURE_COMMAND
"
${
JEMALLOC_SOURCE_DIR
}
/configure"
${
jemalloc_configure_opts
}
"--prefix=
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_CFG_INTDIR
}
/jemalloc"
)
add_library
(
jemalloc STATIC IMPORTED GLOBAL
)
set_target_properties
(
jemalloc PROPERTIES IMPORTED_LOCATION
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_CFG_INTDIR
}
/jemalloc/lib/libjemalloc_pic.a"
)
add_dependencies
(
jemalloc build_jemalloc
)
add_library
(
jemalloc_nopic STATIC IMPORTED GLOBAL
)
set_target_properties
(
jemalloc_nopic PROPERTIES IMPORTED_LOCATION
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_CFG_INTDIR
}
/jemalloc/lib/libjemalloc.a"
)
add_dependencies
(
jemalloc_nopic build_jemalloc
)
# detect when we are being built as a subproject
if
(
NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
CMAKE_CFG_INTDIR
}
/jemalloc/lib"
DESTINATION .
COMPONENT tokukv_libs_extra
)
endif
()
endif
()
endif
()
## add lzma with an external project
## add lzma with an external project
set
(
xz_configure_opts --with-pic --enable-static
)
set
(
xz_configure_opts --with-pic --enable-static
)
if
(
APPLE
)
if
(
APPLE
)
...
...
storage/tokudb/PerconaFT/portability/CMakeLists.txt
View file @
a3553a13
...
@@ -20,7 +20,6 @@ target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT
...
@@ -20,7 +20,6 @@ target_link_libraries(${LIBTOKUPORTABILITY} LINK_PUBLIC ${CMAKE_THREAD_LIBS_INIT
add_library
(
tokuportability_static_conv STATIC
${
tokuportability_srcs
}
)
add_library
(
tokuportability_static_conv STATIC
${
tokuportability_srcs
}
)
set_target_properties
(
tokuportability_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON
)
set_target_properties
(
tokuportability_static_conv PROPERTIES POSITION_INDEPENDENT_CODE ON
)
add_dependencies
(
tokuportability_static_conv build_jemalloc
)
set
(
tokuportability_source_libs tokuportability_static_conv
${
LIBJEMALLOC
}
${
CMAKE_THREAD_LIBS_INIT
}
${
EXTRA_SYSTEM_LIBS
}
)
set
(
tokuportability_source_libs tokuportability_static_conv
${
LIBJEMALLOC
}
${
CMAKE_THREAD_LIBS_INIT
}
${
EXTRA_SYSTEM_LIBS
}
)
toku_merge_static_libs
(
${
LIBTOKUPORTABILITY
}
_static
${
LIBTOKUPORTABILITY
}
_static
"
${
tokuportability_source_libs
}
"
)
toku_merge_static_libs
(
${
LIBTOKUPORTABILITY
}
_static
${
LIBTOKUPORTABILITY
}
_static
"
${
tokuportability_source_libs
}
"
)
...
...
storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
View file @
a3553a13
...
@@ -26,7 +26,7 @@ if [ ! -d build ] ; then
...
@@ -26,7 +26,7 @@ if [ ! -d build ] ; then
-D
RUN_LONG_TESTS
=
ON
\
-D
RUN_LONG_TESTS
=
ON
\
-D
TOKUDB_DATA
=
$tokudbdir
/../tokudb.data
\
-D
TOKUDB_DATA
=
$tokudbdir
/../tokudb.data
\
..
..
ninja build_
jemalloc build_
lzma build_snappy
ninja build_lzma build_snappy
popd
popd
fi
fi
...
...
storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
View file @
a3553a13
...
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
...
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D
RUN_LONG_TESTS
=
ON
\
-D
RUN_LONG_TESTS
=
ON
\
-D
TOKUDB_DATA
=
$tokudbdir
/../tokudb.data
\
-D
TOKUDB_DATA
=
$tokudbdir
/../tokudb.data
\
..
..
ninja build_
jemalloc build_
lzma build_snappy
ninja build_lzma build_snappy
popd
popd
fi
fi
...
...
storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
View file @
a3553a13
...
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
...
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D
RUN_LONG_TESTS
=
ON
\
-D
RUN_LONG_TESTS
=
ON
\
-D
TOKUDB_DATA
=
$tokudbdir
/../tokudb.data
\
-D
TOKUDB_DATA
=
$tokudbdir
/../tokudb.data
\
..
..
ninja build_
jemalloc build_
lzma build_snappy
ninja build_lzma build_snappy
popd
popd
fi
fi
...
...
storage/tokudb/ha_tokudb.cc
View file @
a3553a13
...
@@ -1075,7 +1075,8 @@ static inline int tokudb_generate_row(DB* dest_db,
...
@@ -1075,7 +1075,8 @@ static inline int tokudb_generate_row(DB* dest_db,
}
}
buff
=
(
uchar
*
)
dest_key
->
data
;
buff
=
(
uchar
*
)
dest_key
->
data
;
assert_always
(
buff
!=
NULL
&&
max_key_len
>
0
);
assert_always
(
buff
!=
nullptr
);
assert_always
(
max_key_len
>
0
);
}
else
{
}
else
{
assert_unreachable
();
assert_unreachable
();
}
}
...
...
storage/tokudb/ha_tokudb.h
View file @
a3553a13
...
@@ -387,7 +387,8 @@ inline void TOKUDB_SHARE::init_cardinality_counts(
...
@@ -387,7 +387,8 @@ inline void TOKUDB_SHARE::init_cardinality_counts(
assert_debug
(
_mutex
.
is_owned_by_me
());
assert_debug
(
_mutex
.
is_owned_by_me
());
// can not change number of keys live
// can not change number of keys live
assert_always
(
_rec_per_key
==
NULL
&&
_rec_per_keys
==
0
);
assert_always
(
_rec_per_key
==
nullptr
);
assert_always
(
_rec_per_keys
==
0
);
_rec_per_keys
=
rec_per_keys
;
_rec_per_keys
=
rec_per_keys
;
_rec_per_key
=
rec_per_key
;
_rec_per_key
=
rec_per_key
;
}
}
...
...
storage/tokudb/hatoku_cmp.cc
View file @
a3553a13
...
@@ -954,9 +954,8 @@ static inline int tokudb_compare_two_hidden_keys(
...
@@ -954,9 +954,8 @@ static inline int tokudb_compare_two_hidden_keys(
const
void
*
saved_key_data
,
const
void
*
saved_key_data
,
const
uint32_t
saved_key_size
const
uint32_t
saved_key_size
)
{
)
{
assert_always
(
assert_always
(
new_key_size
>=
TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH
);
(
new_key_size
>=
TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH
)
&&
assert_always
(
saved_key_size
>=
TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH
);
(
saved_key_size
>=
TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH
));
ulonglong
a
=
hpk_char_to_num
((
uchar
*
)
new_key_data
);
ulonglong
a
=
hpk_char_to_num
((
uchar
*
)
new_key_data
);
ulonglong
b
=
hpk_char_to_num
((
uchar
*
)
saved_key_data
);
ulonglong
b
=
hpk_char_to_num
((
uchar
*
)
saved_key_data
);
return
a
<
b
?
-
1
:
(
a
>
b
?
1
:
0
);
return
a
<
b
?
-
1
:
(
a
>
b
?
1
:
0
);
...
@@ -2534,7 +2533,8 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
...
@@ -2534,7 +2533,8 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
bool
is_col_in_pk
=
false
;
bool
is_col_in_pk
=
false
;
if
(
bitmap_is_set
(
&
kc_info
->
key_filters
[
pk_index
],
field_index
))
{
if
(
bitmap_is_set
(
&
kc_info
->
key_filters
[
pk_index
],
field_index
))
{
assert_always
(
!
has_hpk
&&
prim_key
!=
NULL
);
assert_always
(
!
has_hpk
);
assert_always
(
prim_key
!=
nullptr
);
is_col_in_pk
=
true
;
is_col_in_pk
=
true
;
}
}
else
{
else
{
...
...
storage/tokudb/tests/math_test_int.cc
View file @
a3553a13
...
@@ -54,16 +54,20 @@ static void test_int8() {
...
@@ -54,16 +54,20 @@ static void test_int8() {
assert
(
over
);
assert
(
over
);
else
if
(
m
<
-
max
)
else
if
(
m
<
-
max
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
m
);
assert
(
!
over
);
assert
(
n
==
m
);
}
n
=
int_sub
(
x
,
y
,
8
,
&
over
);
n
=
int_sub
(
x
,
y
,
8
,
&
over
);
m
=
x
-
y
;
m
=
x
-
y
;
if
(
m
>
max
-
1
)
if
(
m
>
max
-
1
)
assert
(
over
);
assert
(
over
);
else
if
(
m
<
-
max
)
else
if
(
m
<
-
max
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
m
);
assert
(
!
over
);
asset
(
n
==
m
);
}
}
}
}
}
}
}
...
@@ -82,16 +86,20 @@ static void test_int16() {
...
@@ -82,16 +86,20 @@ static void test_int16() {
assert
(
over
);
assert
(
over
);
else
if
(
m
<
-
max
)
else
if
(
m
<
-
max
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
m
);
assert
(
!
over
);
assert
(
n
==
m
);
}
n
=
int_sub
(
x
,
y
,
16
,
&
over
);
n
=
int_sub
(
x
,
y
,
16
,
&
over
);
m
=
x
-
y
;
m
=
x
-
y
;
if
(
m
>
max
-
1
)
if
(
m
>
max
-
1
)
assert
(
over
);
assert
(
over
);
else
if
(
m
<
-
max
)
else
if
(
m
<
-
max
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
m
);
assert
(
!
over
);
assert
(
n
==
m
);
}
}
}
}
}
}
}
...
@@ -104,20 +112,42 @@ static void test_int24() {
...
@@ -104,20 +112,42 @@ static void test_int24() {
s
=
int_add
(
1
,
(
1ULL
<<
23
)
-
1
,
24
,
&
over
);
assert
(
over
);
s
=
int_add
(
1
,
(
1ULL
<<
23
)
-
1
,
24
,
&
over
);
assert
(
over
);
s
=
int_add
((
1ULL
<<
23
)
-
1
,
1
,
24
,
&
over
);
assert
(
over
);
s
=
int_add
((
1ULL
<<
23
)
-
1
,
1
,
24
,
&
over
);
assert
(
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
23
),
24
,
&
over
);
assert
(
!
over
&&
s
==
(
1ULL
<<
23
)
-
1
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
23
),
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
(
1ULL
<<
23
)
-
1
);
s
=
int_sub
((
1ULL
<<
23
),
1
,
24
,
&
over
);
assert
(
over
);
s
=
int_sub
((
1ULL
<<
23
),
1
,
24
,
&
over
);
assert
(
over
);
s
=
int_add
(
0
,
0
,
24
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
int_add
(
0
,
0
,
24
,
&
over
);
s
=
int_sub
(
0
,
0
,
24
,
&
over
);
assert
(
!
over
&&
s
==
0
);
assert
(
!
over
);
s
=
int_add
(
0
,
-
1
,
24
,
&
over
);
assert
(
!
over
&&
s
==
-
1
);
assert
(
s
==
0
);
s
=
int_sub
(
0
,
1
,
24
,
&
over
);
assert
(
!
over
&&
s
==
-
1
);
s
=
int_sub
(
0
,
0
,
24
,
&
over
);
s
=
int_add
(
0
,
(
1ULL
<<
23
),
24
,
&
over
);
assert
(
!
over
&&
(
s
&
((
1ULL
<<
24
)
-
1
))
==
(
1ULL
<<
23
));
assert
(
!
over
);
s
=
int_sub
(
0
,
(
1ULL
<<
23
)
-
1
,
24
,
&
over
);
assert
(
!
over
&&
(
s
&
((
1ULL
<<
24
)
-
1
))
==
(
1ULL
<<
23
)
+
1
);
assert
(
s
==
0
);
s
=
int_add
(
0
,
-
1
,
24
,
&
over
);
s
=
int_add
(
-
1
,
0
,
24
,
&
over
);
assert
(
!
over
&&
s
==
-
1
);
assert
(
!
over
);
s
=
int_add
(
-
1
,
1
,
24
,
&
over
);
assert
(
!
over
&&
s
==
0
);
assert
(
s
==
-
1
);
s
=
int_sub
(
-
1
,
-
1
,
24
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
int_sub
(
0
,
1
,
24
,
&
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
23
)
-
1
,
24
,
&
over
);
assert
(
!
over
&&
(
s
&
((
1ULL
<<
24
)
-
1
))
==
(
1ULL
<<
23
));
assert
(
!
over
);
assert
(
s
==
-
1
);
s
=
int_add
(
0
,
(
1ULL
<<
23
),
24
,
&
over
);
assert
(
!
over
);
assert
((
s
&
((
1ULL
<<
24
)
-
1
))
==
(
1ULL
<<
23
));
s
=
int_sub
(
0
,
(
1ULL
<<
23
)
-
1
,
24
,
&
over
);
assert
(
!
over
);
assert
((
s
&
((
1ULL
<<
24
)
-
1
))
==
(
1ULL
<<
23
)
+
1
);
s
=
int_add
(
-
1
,
0
,
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
-
1
);
s
=
int_add
(
-
1
,
1
,
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
int_sub
(
-
1
,
-
1
,
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
23
)
-
1
,
24
,
&
over
);
assert
(
!
over
);
assert
((
s
&
((
1ULL
<<
24
)
-
1
))
==
(
1ULL
<<
23
));
}
}
static
void
test_int32
()
{
static
void
test_int32
()
{
...
@@ -128,20 +158,42 @@ static void test_int32() {
...
@@ -128,20 +158,42 @@ static void test_int32() {
s
=
int_add
(
1
,
(
1ULL
<<
31
)
-
1
,
32
,
&
over
);
assert
(
over
);
s
=
int_add
(
1
,
(
1ULL
<<
31
)
-
1
,
32
,
&
over
);
assert
(
over
);
s
=
int_add
((
1ULL
<<
31
)
-
1
,
1
,
32
,
&
over
);
assert
(
over
);
s
=
int_add
((
1ULL
<<
31
)
-
1
,
1
,
32
,
&
over
);
assert
(
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
31
),
32
,
&
over
);
assert
(
s
==
(
1ULL
<<
31
)
-
1
&&
!
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
31
),
32
,
&
over
);
assert
(
s
==
(
1ULL
<<
31
)
-
1
);
assert
(
!
over
);
s
=
int_sub
((
1ULL
<<
31
),
1
,
32
,
&
over
);
assert
(
over
);
s
=
int_sub
((
1ULL
<<
31
),
1
,
32
,
&
over
);
assert
(
over
);
s
=
int_add
(
0
,
0
,
32
,
&
over
);
assert
(
s
==
0
&&
!
over
);
s
=
int_add
(
0
,
0
,
32
,
&
over
);
s
=
int_sub
(
0
,
0
,
32
,
&
over
);
assert
(
s
==
0
&&
!
over
);
assert
(
s
==
0
);
s
=
int_add
(
0
,
-
1
,
32
,
&
over
);
assert
(
s
==
-
1
&&
!
over
);
assert
(
!
over
);
s
=
int_sub
(
0
,
1
,
32
,
&
over
);
assert
(
s
==
-
1
&&
!
over
);
s
=
int_sub
(
0
,
0
,
32
,
&
over
);
s
=
int_add
(
0
,
(
1ULL
<<
31
),
32
,
&
over
);
assert
((
s
&
((
1ULL
<<
32
)
-
1
))
==
(
1ULL
<<
31
)
&&
!
over
);
assert
(
s
==
0
);
s
=
int_sub
(
0
,
(
1ULL
<<
31
)
-
1
,
32
,
&
over
);
assert
((
s
&
((
1ULL
<<
32
)
-
1
))
==
(
1ULL
<<
31
)
+
1
&&
!
over
);
assert
(
!
over
);
s
=
int_add
(
0
,
-
1
,
32
,
&
over
);
s
=
int_add
(
-
1
,
0
,
32
,
&
over
);
assert
(
s
==
-
1
&&
!
over
);
assert
(
s
==
-
1
);
s
=
int_add
(
-
1
,
1
,
32
,
&
over
);
assert
(
s
==
0
&&
!
over
);
assert
(
!
over
);
s
=
int_sub
(
-
1
,
-
1
,
32
,
&
over
);
assert
(
s
==
0
&&
!
over
);
s
=
int_sub
(
0
,
1
,
32
,
&
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
31
)
-
1
,
32
,
&
over
);
assert
((
s
&
((
1ULL
<<
32
)
-
1
))
==
(
1ULL
<<
31
)
&&
!
over
);
assert
(
s
==
-
1
);
assert
(
!
over
);
s
=
int_add
(
0
,
(
1ULL
<<
31
),
32
,
&
over
);
assert
((
s
&
((
1ULL
<<
32
)
-
1
))
==
(
1ULL
<<
31
));
assert
(
!
over
);
s
=
int_sub
(
0
,
(
1ULL
<<
31
)
-
1
,
32
,
&
over
);
assert
((
s
&
((
1ULL
<<
32
)
-
1
))
==
(
1ULL
<<
31
)
+
1
);
assert
(
!
over
);
s
=
int_add
(
-
1
,
0
,
32
,
&
over
);
assert
(
s
==
-
1
);
assert
(
!
over
);
s
=
int_add
(
-
1
,
1
,
32
,
&
over
);
assert
(
s
==
0
);
assert
(
!
over
);
s
=
int_sub
(
-
1
,
-
1
,
32
,
&
over
);
assert
(
s
==
0
);
assert
(
!
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
31
)
-
1
,
32
,
&
over
);
assert
((
s
&
((
1ULL
<<
32
)
-
1
))
==
(
1ULL
<<
31
));
assert
(
!
over
);
}
}
static
void
test_int64
()
{
static
void
test_int64
()
{
...
@@ -152,20 +204,42 @@ static void test_int64() {
...
@@ -152,20 +204,42 @@ static void test_int64() {
s
=
int_add
(
1
,
(
1ULL
<<
63
)
-
1
,
64
,
&
over
);
assert
(
over
);
s
=
int_add
(
1
,
(
1ULL
<<
63
)
-
1
,
64
,
&
over
);
assert
(
over
);
s
=
int_add
((
1ULL
<<
63
)
-
1
,
1
,
64
,
&
over
);
assert
(
over
);
s
=
int_add
((
1ULL
<<
63
)
-
1
,
1
,
64
,
&
over
);
assert
(
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
63
),
64
,
&
over
);
assert
(
s
==
(
1ULL
<<
63
)
-
1
&&
!
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
63
),
64
,
&
over
);
assert
(
s
==
(
1ULL
<<
63
)
-
1
);
assert
(
!
over
);
s
=
int_sub
((
1ULL
<<
63
),
1
,
64
,
&
over
);
assert
(
over
);
s
=
int_sub
((
1ULL
<<
63
),
1
,
64
,
&
over
);
assert
(
over
);
s
=
int_add
(
0
,
0
,
64
,
&
over
);
assert
(
s
==
0
&&
!
over
);
s
=
int_add
(
0
,
0
,
64
,
&
over
);
s
=
int_sub
(
0
,
0
,
64
,
&
over
);
assert
(
s
==
0
&&
!
over
);
assert
(
s
==
0
);
s
=
int_add
(
0
,
-
1
,
64
,
&
over
);
assert
(
s
==
-
1
&&
!
over
);
assert
(
!
over
);
s
=
int_sub
(
0
,
1
,
64
,
&
over
);
assert
(
s
==
-
1
&&
!
over
);
s
=
int_sub
(
0
,
0
,
64
,
&
over
);
s
=
int_add
(
0
,
(
1ULL
<<
63
),
64
,
&
over
);
assert
(
s
==
(
int64_t
)(
1ULL
<<
63
)
&&
!
over
);
assert
(
s
==
0
);
s
=
int_sub
(
0
,
(
1ULL
<<
63
)
-
1
,
64
,
&
over
);
assert
(
s
==
(
int64_t
)((
1ULL
<<
63
)
+
1
)
&&
!
over
);
assert
(
!
over
);
s
=
int_add
(
0
,
-
1
,
64
,
&
over
);
s
=
int_add
(
-
1
,
0
,
64
,
&
over
);
assert
(
s
==
-
1
&&
!
over
);
assert
(
s
==
-
1
);
s
=
int_add
(
-
1
,
1
,
64
,
&
over
);
assert
(
s
==
0
&&
!
over
);
assert
(
!
over
);
s
=
int_sub
(
-
1
,
-
1
,
64
,
&
over
);
assert
(
s
==
0
&&
!
over
);
s
=
int_sub
(
0
,
1
,
64
,
&
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
63
)
-
1
,
64
,
&
over
);
assert
(
s
==
(
int64_t
)(
1ULL
<<
63
)
&&
!
over
);
assert
(
s
==
-
1
);
assert
(
!
over
);
s
=
int_add
(
0
,
(
1ULL
<<
63
),
64
,
&
over
);
assert
(
s
==
(
int64_t
)(
1ULL
<<
63
));
assert
(
!
over
);
s
=
int_sub
(
0
,
(
1ULL
<<
63
)
-
1
,
64
,
&
over
);
assert
(
s
==
(
int64_t
)((
1ULL
<<
63
)
+
1
));
assert
(
!
over
);
s
=
int_add
(
-
1
,
0
,
64
,
&
over
);
assert
(
s
==
-
1
);
assert
(
!
over
);
s
=
int_add
(
-
1
,
1
,
64
,
&
over
);
assert
(
s
==
0
);
assert
(
!
over
);
s
=
int_sub
(
-
1
,
-
1
,
64
,
&
over
);
assert
(
s
==
0
);
assert
(
!
over
);
s
=
int_sub
(
-
1
,
(
1ULL
<<
63
)
-
1
,
64
,
&
over
);
assert
(
s
==
(
int64_t
)(
1ULL
<<
63
));
assert
(
!
over
);
}
}
static
void
test_int_sign
(
uint
length_bits
)
{
static
void
test_int_sign
(
uint
length_bits
)
{
...
...
storage/tokudb/tests/math_test_uint.cc
View file @
a3553a13
...
@@ -51,14 +51,18 @@ static void test_uint8() {
...
@@ -51,14 +51,18 @@ static void test_uint8() {
m
=
x
+
y
;
m
=
x
+
y
;
if
(
m
>
(
1ULL
<<
8
)
-
1
)
if
(
m
>
(
1ULL
<<
8
)
-
1
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
(
m
%
256
));
assert
(
!
over
);
assert
(
n
==
(
m
%
256
));
}
n
=
uint_sub
(
x
,
y
,
8
,
&
over
);
n
=
uint_sub
(
x
,
y
,
8
,
&
over
);
m
=
x
-
y
;
m
=
x
-
y
;
if
(
m
>
x
)
if
(
m
>
x
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
(
m
%
256
));
assert
(
!
over
);
assert
(
n
==
(
m
%
256
));
}
}
}
}
}
}
}
...
@@ -75,14 +79,18 @@ static void test_uint16() {
...
@@ -75,14 +79,18 @@ static void test_uint16() {
m
=
x
+
y
;
m
=
x
+
y
;
if
(
m
>
(
1ULL
<<
16
)
-
1
)
if
(
m
>
(
1ULL
<<
16
)
-
1
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
(
m
%
(
1ULL
<<
16
)));
assert
(
!
over
);
assert
(
n
==
(
m
%
(
1ULL
<<
16
)));
}
n
=
uint_sub
(
x
,
y
,
16
,
&
over
);
n
=
uint_sub
(
x
,
y
,
16
,
&
over
);
m
=
x
-
y
;
m
=
x
-
y
;
if
(
m
>
x
)
if
(
m
>
x
)
assert
(
over
);
assert
(
over
);
else
else
{
assert
(
!
over
&&
n
==
(
m
%
(
1ULL
<<
16
)));
assert
(
!
over
);
assert
(
n
==
(
m
%
(
1ULL
<<
16
)));
}
}
}
}
}
}
}
...
@@ -95,13 +103,23 @@ static void test_uint24() {
...
@@ -95,13 +103,23 @@ static void test_uint24() {
s
=
uint_add
((
1ULL
<<
24
)
-
1
,
(
1ULL
<<
24
)
-
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
24
)
-
1
,
(
1ULL
<<
24
)
-
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
24
)
-
1
,
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
24
)
-
1
,
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
24
)
-
1
,
0
,
24
,
&
over
);
assert
(
!
over
&&
s
==
(
1ULL
<<
24
)
-
1
);
s
=
uint_add
((
1ULL
<<
24
)
-
1
,
0
,
24
,
&
over
);
s
=
uint_add
(
0
,
1
,
24
,
&
over
);
assert
(
!
over
&&
s
==
1
);
assert
(
!
over
);
s
=
uint_add
(
0
,
0
,
24
,
&
over
);
assert
(
!
over
&&
s
==
0
);
assert
(
s
==
(
1ULL
<<
24
)
-
1
);
s
=
uint_sub
(
0
,
0
,
24
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
uint_add
(
0
,
1
,
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
1
);
s
=
uint_add
(
0
,
0
,
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
uint_sub
(
0
,
0
,
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
uint_sub
(
0
,
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
(
1ULL
<<
24
)
-
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
(
1ULL
<<
24
)
-
1
,
24
,
&
over
);
assert
(
over
);
s
=
uint_sub
((
1ULL
<<
24
)
-
1
,
(
1ULL
<<
24
)
-
1
,
24
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
uint_sub
((
1ULL
<<
24
)
-
1
,
(
1ULL
<<
24
)
-
1
,
24
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
}
}
static
void
test_uint32
()
{
static
void
test_uint32
()
{
...
@@ -112,13 +130,23 @@ static void test_uint32() {
...
@@ -112,13 +130,23 @@ static void test_uint32() {
s
=
uint_add
((
1ULL
<<
32
)
-
1
,
(
1ULL
<<
32
)
-
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
32
)
-
1
,
(
1ULL
<<
32
)
-
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
32
)
-
1
,
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
32
)
-
1
,
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_add
((
1ULL
<<
32
)
-
1
,
0
,
32
,
&
over
);
assert
(
!
over
&&
s
==
(
1ULL
<<
32
)
-
1
);
s
=
uint_add
((
1ULL
<<
32
)
-
1
,
0
,
32
,
&
over
);
s
=
uint_add
(
0
,
1
,
32
,
&
over
);
assert
(
!
over
&&
s
==
1
);
assert
(
!
over
);
s
=
uint_add
(
0
,
0
,
32
,
&
over
);
assert
(
!
over
&&
s
==
0
);
assert
(
s
==
(
1ULL
<<
32
)
-
1
);
s
=
uint_sub
(
0
,
0
,
32
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
uint_add
(
0
,
1
,
32
,
&
over
);
assert
(
!
over
);
assert
(
s
==
1
);
s
=
uint_add
(
0
,
0
,
32
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
uint_sub
(
0
,
0
,
32
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
uint_sub
(
0
,
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
(
1ULL
<<
32
)
-
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
(
1ULL
<<
32
)
-
1
,
32
,
&
over
);
assert
(
over
);
s
=
uint_sub
((
1ULL
<<
32
)
-
1
,
(
1ULL
<<
32
)
-
1
,
32
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
uint_sub
((
1ULL
<<
32
)
-
1
,
(
1ULL
<<
32
)
-
1
,
32
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
}
}
static
void
test_uint64
()
{
static
void
test_uint64
()
{
...
@@ -129,13 +157,23 @@ static void test_uint64() {
...
@@ -129,13 +157,23 @@ static void test_uint64() {
s
=
uint_add
(
~
0ULL
,
~
0ULL
,
64
,
&
over
);
assert
(
over
);
s
=
uint_add
(
~
0ULL
,
~
0ULL
,
64
,
&
over
);
assert
(
over
);
s
=
uint_add
(
~
0ULL
,
1
,
64
,
&
over
);
assert
(
over
);
s
=
uint_add
(
~
0ULL
,
1
,
64
,
&
over
);
assert
(
over
);
s
=
uint_add
(
~
0ULL
,
0
,
64
,
&
over
);
assert
(
!
over
&&
s
==
~
0ULL
);
s
=
uint_add
(
~
0ULL
,
0
,
64
,
&
over
);
s
=
uint_add
(
0
,
1
,
64
,
&
over
);
assert
(
!
over
&&
s
==
1
);
assert
(
!
over
);
s
=
uint_add
(
0
,
0
,
64
,
&
over
);
assert
(
!
over
&&
s
==
0
);
assert
(
s
==
~
0ULL
);
s
=
uint_sub
(
0
,
0
,
64
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
uint_add
(
0
,
1
,
64
,
&
over
);
assert
(
!
over
);
assert
(
s
==
1
);
s
=
uint_add
(
0
,
0
,
64
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
uint_sub
(
0
,
0
,
64
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
s
=
uint_sub
(
0
,
1
,
64
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
1
,
64
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
~
0ULL
,
64
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
0
,
~
0ULL
,
64
,
&
over
);
assert
(
over
);
s
=
uint_sub
(
~
0ULL
,
~
0ULL
,
64
,
&
over
);
assert
(
!
over
&&
s
==
0
);
s
=
uint_sub
(
~
0ULL
,
~
0ULL
,
64
,
&
over
);
assert
(
!
over
);
assert
(
s
==
0
);
}
}
int
main
()
{
int
main
()
{
...
...
storage/tokudb/tests/sint_test.cc
View file @
a3553a13
...
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
...
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <stdint.h>
#include <stdint.h>
#include <inttypes.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/types.h>
#include <tokudb_math.h>
#include <tokudb_math.h>
...
...
storage/tokudb/tests/tokudb_buffer_test.cc
View file @
a3553a13
...
@@ -32,9 +32,13 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
...
@@ -32,9 +32,13 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
static
void
test_null
()
{
static
void
test_null
()
{
tokudb
::
buffer
b
;
tokudb
::
buffer
b
;
assert
(
b
.
data
()
==
NULL
&&
b
.
size
()
==
0
&&
b
.
limit
()
==
0
);
assert
(
b
.
data
()
==
nullptr
);
assert
(
b
.
size
()
==
0
);
assert
(
b
.
limit
()
==
0
);
b
.
append
(
NULL
,
0
);
b
.
append
(
NULL
,
0
);
assert
(
b
.
data
()
==
NULL
&&
b
.
size
()
==
0
&&
b
.
limit
()
==
0
);
assert
(
b
.
data
()
==
nullptr
);
assert
(
b
.
size
()
==
0
);
assert
(
b
.
limit
()
==
0
);
}
}
static
void
append_az
(
tokudb
::
buffer
&
b
)
{
static
void
append_az
(
tokudb
::
buffer
&
b
)
{
...
@@ -132,7 +136,8 @@ static void test_replace_grow() {
...
@@ -132,7 +136,8 @@ static void test_replace_grow() {
}
}
for
(
size_t
i
=
0
;
i
<
a
.
size
()
/
2
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
a
.
size
()
/
2
;
i
++
)
{
unsigned
char
*
cp
=
(
unsigned
char
*
)
a
.
data
()
+
2
*
i
;
unsigned
char
*
cp
=
(
unsigned
char
*
)
a
.
data
()
+
2
*
i
;
assert
(
cp
[
0
]
==
'a'
+
i
&&
cp
[
1
]
==
'a'
+
i
);
assert
(
cp
[
0
]
==
'a'
+
i
);
assert
(
cp
[
1
]
==
'a'
+
i
);
}
}
}
}
...
...
storage/tokudb/tests/uint_test.cc
View file @
a3553a13
...
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
...
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <stdint.h>
#include <stdint.h>
#include <inttypes.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/types.h>
#include <tokudb_math.h>
#include <tokudb_math.h>
...
...
storage/tokudb/tests/vlq_test.cc
View file @
a3553a13
...
@@ -52,7 +52,8 @@ static void test_vlq_uint32_error(void) {
...
@@ -52,7 +52,8 @@ static void test_vlq_uint32_error(void) {
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
1
);
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
1
);
assert
(
in_s
==
0
);
assert
(
in_s
==
0
);
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
2
);
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
2
);
assert
(
in_s
==
2
&&
n
==
128
);
assert
(
in_s
==
2
);
assert
(
n
==
128
);
}
}
static
void
test_80000000
(
void
)
{
static
void
test_80000000
(
void
)
{
...
@@ -63,7 +64,8 @@ static void test_80000000(void) {
...
@@ -63,7 +64,8 @@ static void test_80000000(void) {
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
assert
(
out_s
==
5
);
assert
(
out_s
==
5
);
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
5
&&
n
==
v
);
assert
(
in_s
==
5
);
assert
(
n
==
v
);
}
}
static
void
test_100000000
(
void
)
{
static
void
test_100000000
(
void
)
{
...
@@ -74,7 +76,8 @@ static void test_100000000(void) {
...
@@ -74,7 +76,8 @@ static void test_100000000(void) {
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
assert
(
out_s
==
5
);
assert
(
out_s
==
5
);
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
5
&&
n
==
v
);
assert
(
in_s
==
5
);
assert
(
n
==
v
);
}
}
int
main
(
void
)
{
int
main
(
void
)
{
...
...
storage/tokudb/tests/vlq_test_uint32.cc
View file @
a3553a13
...
@@ -44,7 +44,8 @@ static void test_vlq_uint32(void) {
...
@@ -44,7 +44,8 @@ static void test_vlq_uint32(void) {
assert
(
out_s
==
1
);
assert
(
out_s
==
1
);
uint32_t
n
;
uint32_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
1
&&
n
==
v
);
assert
(
in_s
==
1
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
7
);
printf
(
"%u
\n
"
,
1
<<
7
);
...
@@ -54,7 +55,8 @@ static void test_vlq_uint32(void) {
...
@@ -54,7 +55,8 @@ static void test_vlq_uint32(void) {
assert
(
out_s
==
2
);
assert
(
out_s
==
2
);
uint32_t
n
;
uint32_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
2
&&
n
==
v
);
assert
(
in_s
==
2
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
14
);
printf
(
"%u
\n
"
,
1
<<
14
);
...
@@ -64,7 +66,8 @@ static void test_vlq_uint32(void) {
...
@@ -64,7 +66,8 @@ static void test_vlq_uint32(void) {
assert
(
out_s
==
3
);
assert
(
out_s
==
3
);
uint32_t
n
;
uint32_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
3
&&
n
==
v
);
assert
(
in_s
==
3
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
21
);
printf
(
"%u
\n
"
,
1
<<
21
);
...
@@ -74,7 +77,8 @@ static void test_vlq_uint32(void) {
...
@@ -74,7 +77,8 @@ static void test_vlq_uint32(void) {
assert
(
out_s
==
4
);
assert
(
out_s
==
4
);
uint32_t
n
;
uint32_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
4
&&
n
==
v
);
assert
(
in_s
==
4
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
28
);
printf
(
"%u
\n
"
,
1
<<
28
);
...
@@ -84,7 +88,8 @@ static void test_vlq_uint32(void) {
...
@@ -84,7 +88,8 @@ static void test_vlq_uint32(void) {
assert
(
out_s
==
5
);
assert
(
out_s
==
5
);
uint32_t
n
;
uint32_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint32_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
5
&&
n
==
v
);
assert
(
in_s
==
5
);
assert
(
n
==
v
);
}
}
}
}
...
...
storage/tokudb/tests/vlq_test_uint64.cc
View file @
a3553a13
...
@@ -46,7 +46,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
...
@@ -46,7 +46,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert
(
out_s
==
1
);
assert
(
out_s
==
1
);
uint64_t
n
;
uint64_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
1
&&
n
==
v
);
assert
(
in_s
==
1
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
7
);
printf
(
"%u
\n
"
,
1
<<
7
);
...
@@ -56,7 +57,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
...
@@ -56,7 +57,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert
(
out_s
==
2
);
assert
(
out_s
==
2
);
uint64_t
n
;
uint64_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
2
&&
n
==
v
);
assert
(
in_s
==
2
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
14
);
printf
(
"%u
\n
"
,
1
<<
14
);
...
@@ -66,7 +68,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
...
@@ -66,7 +68,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert
(
out_s
==
3
);
assert
(
out_s
==
3
);
uint64_t
n
;
uint64_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
3
&&
n
==
v
);
assert
(
in_s
==
3
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
21
);
printf
(
"%u
\n
"
,
1
<<
21
);
...
@@ -76,7 +79,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
...
@@ -76,7 +79,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert
(
out_s
==
4
);
assert
(
out_s
==
4
);
uint64_t
n
;
uint64_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
4
&&
n
==
v
);
assert
(
in_s
==
4
);
assert
(
n
==
v
);
}
}
printf
(
"%u
\n
"
,
1
<<
28
);
printf
(
"%u
\n
"
,
1
<<
28
);
...
@@ -90,7 +94,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
...
@@ -90,7 +94,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert
(
out_s
==
5
);
assert
(
out_s
==
5
);
uint64_t
n
;
uint64_t
n
;
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
size_t
in_s
=
tokudb
::
vlq_decode_ui
<
uint64_t
>
(
&
n
,
b
,
out_s
);
assert
(
in_s
==
5
&&
n
==
v
);
assert
(
in_s
==
5
);
assert
(
n
==
v
);
}
}
}
}
...
...
storage/tokudb/tokudb_buffer.h
View file @
a3553a13
...
@@ -134,8 +134,8 @@ class buffer {
...
@@ -134,8 +134,8 @@ class buffer {
char
*
data_offset
=
(
char
*
)
m_data
+
offset
;
char
*
data_offset
=
(
char
*
)
m_data
+
offset
;
if
(
new_s
!=
old_s
)
{
if
(
new_s
!=
old_s
)
{
size_t
n
=
m_size
-
(
offset
+
old_s
);
size_t
n
=
m_size
-
(
offset
+
old_s
);
assert_always
(
assert_always
(
offset
+
new_s
+
n
<=
m_limit
);
offset
+
new_s
+
n
<=
m_limit
&&
offset
+
old_s
+
n
<=
m_limit
);
assert_always
(
offset
+
old_s
+
n
<=
m_limit
);
memmove
(
data_offset
+
new_s
,
data_offset
+
old_s
,
n
);
memmove
(
data_offset
+
new_s
,
data_offset
+
old_s
,
n
);
if
(
new_s
>
old_s
)
if
(
new_s
>
old_s
)
m_size
+=
new_s
-
old_s
;
m_size
+=
new_s
-
old_s
;
...
...
storage/tokudb/tokudb_math.h
View file @
a3553a13
...
@@ -59,7 +59,8 @@ TOKUDB_UNUSED(static uint64_t uint_add(
...
@@ -59,7 +59,8 @@ TOKUDB_UNUSED(static uint64_t uint_add(
bool
*
over
));
bool
*
over
));
static
uint64_t
uint_add
(
uint64_t
x
,
uint64_t
y
,
uint
length_bits
,
bool
*
over
)
{
static
uint64_t
uint_add
(
uint64_t
x
,
uint64_t
y
,
uint
length_bits
,
bool
*
over
)
{
uint64_t
mask
=
uint_mask
(
length_bits
);
uint64_t
mask
=
uint_mask
(
length_bits
);
assert_always
((
x
&
~
mask
)
==
0
&&
(
y
&
~
mask
)
==
0
);
assert_always
((
x
&
~
mask
)
==
0
);
assert_always
((
y
&
~
mask
)
==
0
);
uint64_t
s
=
(
x
+
y
)
&
mask
;
uint64_t
s
=
(
x
+
y
)
&
mask
;
*
over
=
s
<
x
;
// check for overflow
*
over
=
s
<
x
;
// check for overflow
return
s
;
return
s
;
...
@@ -75,7 +76,8 @@ TOKUDB_UNUSED(static uint64_t uint_sub(
...
@@ -75,7 +76,8 @@ TOKUDB_UNUSED(static uint64_t uint_sub(
bool
*
over
));
bool
*
over
));
static
uint64_t
uint_sub
(
uint64_t
x
,
uint64_t
y
,
uint
length_bits
,
bool
*
over
)
{
static
uint64_t
uint_sub
(
uint64_t
x
,
uint64_t
y
,
uint
length_bits
,
bool
*
over
)
{
uint64_t
mask
=
uint_mask
(
length_bits
);
uint64_t
mask
=
uint_mask
(
length_bits
);
assert_always
((
x
&
~
mask
)
==
0
&&
(
y
&
~
mask
)
==
0
);
assert_always
((
x
&
~
mask
)
==
0
);
assert_always
((
y
&
~
mask
)
==
0
);
uint64_t
s
=
(
x
-
y
)
&
mask
;
uint64_t
s
=
(
x
-
y
)
&
mask
;
*
over
=
s
>
x
;
// check for overflow
*
over
=
s
>
x
;
// check for overflow
return
s
;
return
s
;
...
...
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