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
33715e64
Commit
33715e64
authored
Mar 17, 2008
by
Yoni Fogel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
closes #549
git-svn-id:
file:///svn/tokudb@2903
c7de825b-a66e-492c-adef-691d508d4ae1
parent
18a7b8df
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
27 deletions
+28
-27
src/lock_tree/locktree.c
src/lock_tree/locktree.c
+5
-5
src/lock_tree/locktree.h
src/lock_tree/locktree.h
+2
-2
src/lock_tree/tests/test_00000_createclose.c
src/lock_tree/tests/test_00000_createclose.c
+1
-1
src/lock_tree/tests/test_00010_parameter_errors.c
src/lock_tree/tests/test_00010_parameter_errors.c
+13
-13
src/lock_tree/tests/test_00020_read.c
src/lock_tree/tests/test_00020_read.c
+1
-1
src/lock_tree/tests/test_00040_write.c
src/lock_tree/tests/test_00040_write.c
+1
-1
src/lock_tree/tests/test_00060_lock_escalation.c
src/lock_tree/tests/test_00060_lock_escalation.c
+1
-1
src/ydb.c
src/ydb.c
+4
-3
No files found.
src/lock_tree/locktree.c
View file @
33715e64
...
...
@@ -124,8 +124,8 @@ int toku__lt_point_cmp(const toku_point* x, const toku_point* y) {
static
inline
BOOL
toku__lt_percent_ranges_free
(
toku_lock_tree
*
tree
,
u_int32_t
percent
)
{
assert
(
tree
&&
tree
->
num_ranges
&&
(
percent
<=
100
));
u_int64_t
max_ranges64
=
tree
->
max_ranges
;
assert
(
tree
&&
tree
->
max_ranges
&&
tree
->
num_ranges
&&
(
percent
<=
100
));
u_int64_t
max_ranges64
=
*
tree
->
max_ranges
;
return
*
tree
->
num_ranges
<=
max_ranges64
*
(
100
-
percent
)
/
100
;
}
...
...
@@ -135,7 +135,7 @@ static inline BOOL toku__lt_range_test_incr(toku_lock_tree* tree, u_int32_t repl
assert
(
tree
);
assert
(
tree
->
num_ranges
);
assert
(
replace
<=
*
tree
->
num_ranges
);
return
*
tree
->
num_ranges
-
replace
<
tree
->
max_ranges
;
return
*
tree
->
num_ranges
-
replace
<
*
tree
->
max_ranges
;
}
static
inline
void
toku__lt_range_incr
(
toku_lock_tree
*
tree
,
u_int32_t
replace
)
{
...
...
@@ -924,7 +924,7 @@ static inline int toku__lt_borderwrite_insert(toku_lock_tree* tree,
}
int
toku_lt_create
(
toku_lock_tree
**
ptree
,
DB
*
db
,
BOOL
duplicates
,
int
(
*
panic
)(
DB
*
,
int
),
u_int32_t
max_ranges
,
int
(
*
panic
)(
DB
*
,
int
),
u_int32_t
*
max_ranges
,
u_int32_t
*
num_ranges
,
int
(
*
compare_fun
)(
DB
*
,
const
DBT
*
,
const
DBT
*
),
int
(
*
dup_compare
)(
DB
*
,
const
DBT
*
,
const
DBT
*
),
...
...
@@ -933,7 +933,7 @@ int toku_lt_create(toku_lock_tree** ptree, DB* db, BOOL duplicates,
void
*
(
*
user_realloc
)(
void
*
,
size_t
))
{
if
(
!
ptree
||
!
db
||
!
compare_fun
||
!
dup_compare
||
!
panic
||
!
max_ranges
||
!
num_ranges
||
!
user_malloc
||
!
user_free
||
!
user_realloc
)
{
return
EINVAL
;
}
!
user_realloc
||
!*
max_ranges
)
{
return
EINVAL
;
}
int
r
;
toku_lock_tree
*
tmp_tree
=
(
toku_lock_tree
*
)
user_malloc
(
sizeof
(
*
tmp_tree
));
...
...
src/lock_tree/locktree.h
View file @
33715e64
...
...
@@ -68,7 +68,7 @@ struct __toku_lock_tree {
toku_range
*
buf
;
u_int32_t
buflen
;
/**< The length of buf */
/** The maximum number of ranges allowed. */
u_int32_t
max_ranges
;
u_int32_t
*
max_ranges
;
/** The current number of ranges. */
u_int32_t
*
num_ranges
;
/** Whether lock escalation is allowed. */
...
...
@@ -149,7 +149,7 @@ typedef struct __toku_point toku_point;
instead.
*/
int
toku_lt_create
(
toku_lock_tree
**
ptree
,
DB
*
db
,
BOOL
duplicates
,
int
(
*
panic
)(
DB
*
,
int
),
u_int32_t
max_locks
,
int
(
*
panic
)(
DB
*
,
int
),
u_int32_t
*
max_locks
,
u_int32_t
*
num_locks
,
int
(
*
compare_fun
)(
DB
*
,
const
DBT
*
,
const
DBT
*
),
int
(
*
dup_compare
)(
DB
*
,
const
DBT
*
,
const
DBT
*
),
...
...
src/lock_tree/tests/test_00000_createclose.c
View file @
33715e64
...
...
@@ -9,7 +9,7 @@ int main() {
BOOL
duplicates
;
for
(
duplicates
=
0
;
duplicates
<
2
;
duplicates
++
)
{
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
max_locks
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
max_locks
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR
(
r
);
assert
(
lt
);
...
...
src/lock_tree/tests/test_00010_parameter_errors.c
View file @
33715e64
...
...
@@ -6,7 +6,7 @@ static DBT _key;
static
DBT
_data
;
DBT
*
key
;
DBT
*
data
;
u_int32_t
mem
=
4096
*
1000
;
u_int32_t
mem
=
1000
;
u_int32_t
memcnt
=
0
;
static
void
do_range_test
(
int
(
*
acquire
)(
toku_lock_tree
*
,
DB_TXN
*
,
...
...
@@ -41,7 +41,7 @@ static void do_range_test(int (*acquire)(toku_lock_tree*, DB_TXN*,
reverse_data_r
=
&
_data_r
;
}
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR
(
r
);
assert
(
lt
);
...
...
@@ -146,7 +146,7 @@ static void do_point_test(int (*acquire)(toku_lock_tree*, DB_TXN*,
data
=
NULL
;
}
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR
(
r
);
assert
(
lt
);
...
...
@@ -202,52 +202,52 @@ int main(int argc, const char *argv[]) {
/* create tests. */
for
(
duplicates
=
0
;
duplicates
<
2
;
duplicates
++
)
{
memcnt
=
0
;
r
=
toku_lt_create
(
NULL
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
NULL
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
NULL
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
NULL
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
NULL
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
NULL
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
u_int32_t
old_mem
=
mem
;
mem
=
0
;
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
mem
=
old_mem
;
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
NULL
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
NULL
,
NULL
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
NULL
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
NULL
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
NULL
,
toku_free
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
NULL
,
toku_realloc
);
CKERR2
(
r
,
EINVAL
);
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
mem
,
&
memcnt
,
r
=
toku_lt_create
(
&
lt
,
db
,
duplicates
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
NULL
);
CKERR2
(
r
,
EINVAL
);
}
...
...
src/lock_tree/tests/test_00020_read.c
View file @
33715e64
...
...
@@ -48,7 +48,7 @@ void init_query(BOOL dups) {
void
setup_tree
(
BOOL
dups
)
{
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
dups
,
dbpanic
,
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
r
=
toku_lt_create
(
&
lt
,
db
,
dups
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR
(
r
);
assert
(
lt
);
...
...
src/lock_tree/tests/test_00040_write.c
View file @
33715e64
...
...
@@ -47,7 +47,7 @@ void init_query(BOOL dups) {
void
setup_tree
(
BOOL
dups
)
{
memcnt
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
dups
,
dbpanic
,
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
r
=
toku_lt_create
(
&
lt
,
db
,
dups
,
dbpanic
,
&
mem
,
&
memcnt
,
dbcmp
,
dbcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR
(
r
);
assert
(
lt
);
...
...
src/lock_tree/tests/test_00060_lock_escalation.c
View file @
33715e64
...
...
@@ -47,7 +47,7 @@ void init_query(BOOL dups) {
void
setup_tree
(
BOOL
dups
)
{
num_locks
=
0
;
r
=
toku_lt_create
(
&
lt
,
db
,
dups
,
dbpanic
,
max_locks
,
&
num_locks
,
intcmp
,
charcmp
,
r
=
toku_lt_create
(
&
lt
,
db
,
dups
,
dbpanic
,
&
max_locks
,
&
num_locks
,
intcmp
,
charcmp
,
toku_malloc
,
toku_free
,
toku_realloc
);
CKERR
(
r
);
assert
(
lt
);
...
...
src/ydb.c
View file @
33715e64
...
...
@@ -540,8 +540,9 @@ static int toku_env_set_lk_detect(DB_ENV * env, u_int32_t detect) {
static
int
toku_env_set_lk_max_locks
(
DB_ENV
*
dbenv
,
u_int32_t
max
)
{
HANDLE_PANICKED_ENV
(
dbenv
);
if
(
env_opened
(
dbenv
))
return
EINVAL
;
if
(
!
max
)
return
EINVAL
;
if
(
env_opened
(
dbenv
))
{
return
EINVAL
;
}
if
(
!
max
)
{
return
EINVAL
;
}
if
(
max
<
dbenv
->
i
->
num_locks
)
{
return
EDOM
;
}
dbenv
->
i
->
max_locks
=
max
;
return
0
;
}
...
...
@@ -2029,7 +2030,7 @@ static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *db
if
(
need_locktree
)
{
r
=
toku_lt_create
(
&
db
->
i
->
lt
,
db
,
FALSE
,
toku_db_lt_panic
,
db
->
dbenv
->
i
->
max_locks
,
toku_db_lt_panic
,
&
db
->
dbenv
->
i
->
max_locks
,
&
db
->
dbenv
->
i
->
num_locks
,
db
->
i
->
brt
->
compare_fun
,
db
->
i
->
brt
->
dup_compare
,
toku_malloc
,
toku_free
,
toku_realloc
);
...
...
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