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
f31f24c2
Commit
f31f24c2
authored
Dec 19, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make set_errfile work. Fixes #72.
git-svn-id:
file:///svn/tokudb@1260
c7de825b-a66e-492c-adef-691d508d4ae1
parent
382be293
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
8 deletions
+31
-8
buildheader/db.h_4_4
buildheader/db.h_4_4
+1
-1
include/db.h
include/db.h
+8
-6
src/tests/test_dup_dup.c
src/tests/test_dup_dup.c
+3
-0
src/tests/test_dup_insert.c
src/tests/test_dup_insert.c
+1
-1
src/ydb.c
src/ydb.c
+18
-0
No files found.
buildheader/db.h_4_4
View file @
f31f24c2
...
@@ -191,7 +191,7 @@ struct __toku_db {
...
@@ -191,7 +191,7 @@ struct __toku_db {
void* __toku_dummy10[3];
void* __toku_dummy10[3];
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=456 size=4, 64=bit offset=816 size=8 */
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=456 size=4, 64=bit offset=816 size=8 */
void* __toku_dummy11[2];
void* __toku_dummy11[2];
void (*set_errfile) (DB
_ENV
*, FILE*); /* 32-bit offset=468 size=4, 64=bit offset=840 size=8 */
void (*set_errfile) (DB *, FILE*); /* 32-bit offset=468 size=4, 64=bit offset=840 size=8 */
void* __toku_dummy12[2];
void* __toku_dummy12[2];
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=480 size=4, 64=bit offset=864 size=8 */
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=480 size=4, 64=bit offset=864 size=8 */
void* __toku_dummy13[6];
void* __toku_dummy13[6];
...
...
include/db.h
View file @
f31f24c2
...
@@ -190,16 +190,18 @@ struct __toku_db {
...
@@ -190,16 +190,18 @@ struct __toku_db {
int
(
*
set_bt_compare
)
(
DB
*
,
int
(
*
)(
DB
*
,
const
DBT
*
,
const
DBT
*
));
/* 32-bit offset=440 size=4, 64=bit offset=784 size=8 */
int
(
*
set_bt_compare
)
(
DB
*
,
int
(
*
)(
DB
*
,
const
DBT
*
,
const
DBT
*
));
/* 32-bit offset=440 size=4, 64=bit offset=784 size=8 */
void
*
__toku_dummy10
[
3
];
void
*
__toku_dummy10
[
3
];
int
(
*
set_dup_compare
)
(
DB
*
,
int
(
*
)(
DB
*
,
const
DBT
*
,
const
DBT
*
));
/* 32-bit offset=456 size=4, 64=bit offset=816 size=8 */
int
(
*
set_dup_compare
)
(
DB
*
,
int
(
*
)(
DB
*
,
const
DBT
*
,
const
DBT
*
));
/* 32-bit offset=456 size=4, 64=bit offset=816 size=8 */
void
*
__toku_dummy11
[
5
];
void
*
__toku_dummy11
[
2
];
void
(
*
set_errfile
)
(
DB
*
,
FILE
*
);
/* 32-bit offset=468 size=4, 64=bit offset=840 size=8 */
void
*
__toku_dummy12
[
2
];
int
(
*
set_flags
)
(
DB
*
,
u_int32_t
);
/* 32-bit offset=480 size=4, 64=bit offset=864 size=8 */
int
(
*
set_flags
)
(
DB
*
,
u_int32_t
);
/* 32-bit offset=480 size=4, 64=bit offset=864 size=8 */
void
*
__toku_dummy12
[
6
];
int
(
*
set_pagesize
)
(
DB
*
,
u_int32_t
);
/* 32-bit offset=508 size=4, 64=bit offset=920 size=8 */
void
*
__toku_dummy13
[
6
];
void
*
__toku_dummy13
[
6
];
int
(
*
set_pagesize
)
(
DB
*
,
u_int32_t
);
/* 32-bit offset=508 size=4, 64=bit offset=920 size=8 */
void
*
__toku_dummy14
[
6
];
int
(
*
stat
)
(
DB
*
,
void
*
,
u_int32_t
);
/* 32-bit offset=536 size=4, 64=bit offset=976 size=8 */
int
(
*
stat
)
(
DB
*
,
void
*
,
u_int32_t
);
/* 32-bit offset=536 size=4, 64=bit offset=976 size=8 */
void
*
__toku_dummy1
4
[
4
];
void
*
__toku_dummy1
5
[
4
];
int
(
*
verify
)
(
DB
*
,
const
char
*
,
const
char
*
,
FILE
*
,
u_int32_t
);
/* 32-bit offset=556 size=4, 64=bit offset=1016 size=8 */
int
(
*
verify
)
(
DB
*
,
const
char
*
,
const
char
*
,
FILE
*
,
u_int32_t
);
/* 32-bit offset=556 size=4, 64=bit offset=1016 size=8 */
void
*
__toku_dummy1
5
[
5
];
/* Padding at the end */
void
*
__toku_dummy1
6
[
5
];
/* Padding at the end */
char
__toku_dummy1
6
[
16
];
/* Padding at the end */
char
__toku_dummy1
7
[
16
];
/* Padding at the end */
};
};
struct
__toku_db_txn_active
{
struct
__toku_db_txn_active
{
u_int32_t
txnid
;
/* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
u_int32_t
txnid
;
/* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
...
...
src/tests/test_dup_dup.c
View file @
f31f24c2
...
@@ -43,6 +43,7 @@ void test_dup_key(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
...
@@ -43,6 +43,7 @@ void test_dup_key(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
/* create the dup database file */
/* create the dup database file */
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
db
->
set_errfile
(
db
,
stderr
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
#if USE_TDB
#if USE_TDB
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
...
@@ -93,6 +94,7 @@ void test_dup_dup(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
...
@@ -93,6 +94,7 @@ void test_dup_dup(int dup_mode, u_int32_t put_flags, int rexpect, int rexpectdup
/* create the dup database file */
/* create the dup database file */
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
db
->
set_errfile
(
db
,
stderr
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
#if USE_TDB
#if USE_TDB
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
...
@@ -143,6 +145,7 @@ void test_put_00_01_01(int dup_mode, u_int32_t put_flags) {
...
@@ -143,6 +145,7 @@ void test_put_00_01_01(int dup_mode, u_int32_t put_flags) {
/* create the dup database file */
/* create the dup database file */
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
null_env
,
0
);
assert
(
r
==
0
);
db
->
set_errfile
(
db
,
stderr
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
r
=
db
->
set_flags
(
db
,
dup_mode
);
#if USE_TDB
#if USE_TDB
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
if
(
r
!=
0
&&
dup_mode
==
DB_DUP
)
{
...
...
src/tests/test_dup_insert.c
View file @
f31f24c2
...
@@ -263,7 +263,7 @@ int main(int argc, const char *argv[]) {
...
@@ -263,7 +263,7 @@ int main(int argc, const char *argv[]) {
/* dup tests */
/* dup tests */
#if USE_TDB
#if USE_TDB
printf
(
"%s:%d:WARNING:tokudb does not support DB_DUP
\n
"
,
__FILE__
,
__LINE__
);
//
printf("%s:%d:WARNING:tokudb does not support DB_DUP\n", __FILE__, __LINE__);
#else
#else
for
(
i
=
1
;
i
<=
(
1
<<
16
);
i
*=
2
)
{
for
(
i
=
1
;
i
<=
(
1
<<
16
);
i
*=
2
)
{
test_insert
(
i
,
DB_DUP
);
test_insert
(
i
,
DB_DUP
);
...
...
src/ydb.c
View file @
f31f24c2
...
@@ -41,6 +41,7 @@ struct __toku_db_env_internal {
...
@@ -41,6 +41,7 @@ struct __toku_db_env_internal {
u_int32_t
open_flags
;
u_int32_t
open_flags
;
int
open_mode
;
int
open_mode
;
void
(
*
errcall
)
(
const
char
*
,
char
*
);
void
(
*
errcall
)
(
const
char
*
,
char
*
);
void
*
errfile
;
char
*
errpfx
;
char
*
errpfx
;
char
*
dir
;
/* A malloc'd copy of the directory. */
char
*
dir
;
/* A malloc'd copy of the directory. */
char
*
tmp_dir
;
char
*
tmp_dir
;
...
@@ -365,6 +366,10 @@ static void toku_db_env_set_errcall(DB_ENV * env, void (*errcall) (const char *,
...
@@ -365,6 +366,10 @@ static void toku_db_env_set_errcall(DB_ENV * env, void (*errcall) (const char *,
env
->
i
->
errcall
=
errcall
;
env
->
i
->
errcall
=
errcall
;
}
}
static
void
toku_db_env_set_errfile
(
DB_ENV
*
env
,
FILE
*
errfile
)
{
env
->
i
->
errfile
=
errfile
;
}
static
void
toku_db_env_set_errpfx
(
DB_ENV
*
env
,
const
char
*
errpfx
)
{
static
void
toku_db_env_set_errpfx
(
DB_ENV
*
env
,
const
char
*
errpfx
)
{
if
(
env
->
i
->
errpfx
)
if
(
env
->
i
->
errpfx
)
toku_free
(
env
->
i
->
errpfx
);
toku_free
(
env
->
i
->
errpfx
);
...
@@ -457,6 +462,7 @@ int db_env_create(DB_ENV ** envp, u_int32_t flags) {
...
@@ -457,6 +462,7 @@ int db_env_create(DB_ENV ** envp, u_int32_t flags) {
result
->
txn_checkpoint
=
toku_db_env_txn_checkpoint
;
result
->
txn_checkpoint
=
toku_db_env_txn_checkpoint
;
result
->
log_flush
=
toku_db_env_log_flush
;
result
->
log_flush
=
toku_db_env_log_flush
;
result
->
set_errcall
=
toku_db_env_set_errcall
;
result
->
set_errcall
=
toku_db_env_set_errcall
;
result
->
set_errfile
=
toku_db_env_set_errfile
;
result
->
set_errpfx
=
toku_db_env_set_errpfx
;
result
->
set_errpfx
=
toku_db_env_set_errpfx
;
//result->set_noticecall = toku_db_env_set_noticecall;
//result->set_noticecall = toku_db_env_set_noticecall;
result
->
set_flags
=
toku_db_env_set_flags
;
result
->
set_flags
=
toku_db_env_set_flags
;
...
@@ -484,6 +490,7 @@ int db_env_create(DB_ENV ** envp, u_int32_t flags) {
...
@@ -484,6 +490,7 @@ int db_env_create(DB_ENV ** envp, u_int32_t flags) {
result
->
i
->
ref_count
=
1
;
result
->
i
->
ref_count
=
1
;
result
->
i
->
errcall
=
toku_default_errcall
;
result
->
i
->
errcall
=
toku_default_errcall
;
result
->
i
->
errpfx
=
toku_strdup
(
""
);
result
->
i
->
errpfx
=
toku_strdup
(
""
);
result
->
i
->
errfile
=
0
;
ydb_add_ref
();
ydb_add_ref
();
*
envp
=
result
;
*
envp
=
result
;
...
@@ -1259,6 +1266,11 @@ static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *db
...
@@ -1259,6 +1266,11 @@ static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *db
return
r
;
return
r
;
}
}
static
void
do_error
(
DB_ENV
*
dbenv
,
const
char
*
string
)
{
if
(
dbenv
->
i
->
errfile
)
fprintf
(
dbenv
->
i
->
errfile
,
"%s
\n
"
,
string
);
}
static
int
toku_db_put_noassociate
(
DB
*
db
,
DB_TXN
*
txn
,
DBT
*
key
,
DBT
*
data
,
u_int32_t
flags
)
{
static
int
toku_db_put_noassociate
(
DB
*
db
,
DB_TXN
*
txn
,
DBT
*
key
,
DBT
*
data
,
u_int32_t
flags
)
{
int
r
;
int
r
;
...
@@ -1298,6 +1310,7 @@ static int toku_db_put_noassociate(DB * db, DB_TXN * txn, DBT * key, DBT * data,
...
@@ -1298,6 +1310,7 @@ static int toku_db_put_noassociate(DB * db, DB_TXN * txn, DBT * key, DBT * data,
if
(
r
==
0
)
if
(
r
==
0
)
return
DB_KEYEXIST
;
return
DB_KEYEXIST
;
#else
#else
do_error
(
db
->
dbenv
,
"Tokudb requires that db->put specify DB_YESOVERWRITE or DB_NOOVERWRITE on DB_DUPSORT databases"
);
return
EINVAL
;
return
EINVAL
;
#endif
#endif
}
}
...
@@ -1396,6 +1409,10 @@ static int toku_db_set_dup_compare(DB *db, int (*dup_compare)(DB *, const DBT *,
...
@@ -1396,6 +1409,10 @@ static int toku_db_set_dup_compare(DB *db, int (*dup_compare)(DB *, const DBT *,
return
r
;
return
r
;
}
}
static
void
toku_db_set_errfile
(
DB
*
db
,
FILE
*
errfile
)
{
db
->
dbenv
->
set_errfile
(
db
->
dbenv
,
errfile
);
}
static
int
toku_db_set_flags
(
DB
*
db
,
u_int32_t
flags
)
{
static
int
toku_db_set_flags
(
DB
*
db
,
u_int32_t
flags
)
{
/* the following matches BDB */
/* the following matches BDB */
...
@@ -1488,6 +1505,7 @@ int db_create(DB ** db, DB_ENV * env, u_int32_t flags) {
...
@@ -1488,6 +1505,7 @@ int db_create(DB ** db, DB_ENV * env, u_int32_t flags) {
result
->
rename
=
toku_db_rename
;
result
->
rename
=
toku_db_rename
;
result
->
set_bt_compare
=
toku_db_set_bt_compare
;
result
->
set_bt_compare
=
toku_db_set_bt_compare
;
result
->
set_dup_compare
=
toku_db_set_dup_compare
;
result
->
set_dup_compare
=
toku_db_set_dup_compare
;
result
->
set_errfile
=
toku_db_set_errfile
;
result
->
set_pagesize
=
toku_db_set_pagesize
;
result
->
set_pagesize
=
toku_db_set_pagesize
;
result
->
set_flags
=
toku_db_set_flags
;
result
->
set_flags
=
toku_db_set_flags
;
result
->
get_flags
=
toku_db_get_flags
;
result
->
get_flags
=
toku_db_get_flags
;
...
...
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