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
d6c86507
Commit
d6c86507
authored
Nov 19, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
verify that home exists
git-svn-id:
file:///svn/tokudb@666
c7de825b-a66e-492c-adef-691d508d4ae1
parent
6db0a0b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
src/ydb.c
src/ydb.c
+27
-10
No files found.
src/ydb.c
View file @
d6c86507
...
@@ -222,6 +222,14 @@ int __toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int mode
...
@@ -222,6 +222,14 @@ int __toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int mode
return
EINVAL
;
return
EINVAL
;
if
(
!
home
)
return
EINVAL
;
if
(
!
home
)
return
EINVAL
;
else
{
// Verify that the home exists.
struct
stat
buf
;
r
=
stat
(
home
,
&
buf
);
if
(
r
!=
0
)
return
errno
;
}
if
(
!
(
flags
&
DB_PRIVATE
))
{
if
(
!
(
flags
&
DB_PRIVATE
))
{
// This means that we don't have to do anything with shared memory.
// This means that we don't have to do anything with shared memory.
...
@@ -250,21 +258,26 @@ int __toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int mode
...
@@ -250,21 +258,26 @@ int __toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int mode
if
(
flags
&
(
DB_INIT_TXN
|
DB_INIT_LOG
))
{
if
(
flags
&
(
DB_INIT_TXN
|
DB_INIT_LOG
))
{
r
=
tokulogger_create_and_open_logger
(
env
->
i
->
dir
,
&
env
->
i
->
logger
);
r
=
tokulogger_create_and_open_logger
(
env
->
i
->
dir
,
&
env
->
i
->
logger
);
assert
(
r
==
0
);
if
(
r
!=
0
)
goto
died1
;
if
(
0
)
{
died2:
tokulogger_log_close
(
&
env
->
i
->
logger
);
goto
died1
;
}
}
}
r
=
brt_create_cachetable
(
&
env
->
i
->
cachetable
,
env
->
i
->
cachetable_size
,
ZERO_LSN
,
env
->
i
->
logger
);
r
=
brt_create_cachetable
(
&
env
->
i
->
cachetable
,
env
->
i
->
cachetable_size
,
ZERO_LSN
,
env
->
i
->
logger
);
assert
(
r
==
0
);
if
(
r
!=
0
)
goto
died2
;
return
0
;
return
0
;
}
}
int
__toku_db_env_close
(
DB_ENV
*
env
,
u_int32_t
flags
)
{
int
__toku_db_env_close
(
DB_ENV
*
env
,
u_int32_t
flags
)
{
int
r0
=
0
,
r1
=
0
;
if
(
flags
)
return
EINVAL
;
if
(
flags
)
return
EINVAL
;
if
(
env
->
i
->
cachetable
)
if
(
env
->
i
->
cachetable
)
cachetable_close
(
&
env
->
i
->
cachetable
);
r0
=
cachetable_close
(
&
env
->
i
->
cachetable
);
if
(
env
->
i
->
logger
)
if
(
env
->
i
->
logger
)
tokulogger_log_close
(
&
env
->
i
->
logger
);
r1
=
tokulogger_log_close
(
&
env
->
i
->
logger
);
if
(
env
->
i
->
data_dir
)
if
(
env
->
i
->
data_dir
)
toku_free
(
env
->
i
->
data_dir
);
toku_free
(
env
->
i
->
data_dir
);
if
(
env
->
i
->
tmp_dir
)
if
(
env
->
i
->
tmp_dir
)
...
@@ -274,6 +287,9 @@ int __toku_db_env_close(DB_ENV * env, u_int32_t flags) {
...
@@ -274,6 +287,9 @@ int __toku_db_env_close(DB_ENV * env, u_int32_t flags) {
toku_free
(
env
->
i
->
dir
);
toku_free
(
env
->
i
->
dir
);
toku_free
(
env
->
i
);
toku_free
(
env
->
i
);
toku_free
(
env
);
toku_free
(
env
);
if
(
flags
!=
0
)
return
EINVAL
;
if
(
r0
)
return
r0
;
if
(
r1
)
return
r1
;
return
0
;
return
0
;
}
}
...
@@ -364,7 +380,7 @@ void __toku_default_errcall(const char *errpfx, char *msg) {
...
@@ -364,7 +380,7 @@ void __toku_default_errcall(const char *errpfx, char *msg) {
fprintf
(
stderr
,
"YDB: %s: %s"
,
errpfx
,
msg
);
fprintf
(
stderr
,
"YDB: %s: %s"
,
errpfx
,
msg
);
}
}
int
__toku_txn_begin
(
DB_ENV
*
env
,
DB_TXN
*
stxn
,
DB_TXN
**
txn
,
u_int32_t
flags
);
static
int
__toku_txn_begin
(
DB_ENV
*
env
,
DB_TXN
*
stxn
,
DB_TXN
**
txn
,
u_int32_t
flags
);
int
db_env_create
(
DB_ENV
**
envp
,
u_int32_t
flags
)
{
int
db_env_create
(
DB_ENV
**
envp
,
u_int32_t
flags
)
{
DB_ENV
*
result
=
toku_malloc
(
sizeof
(
*
result
));
DB_ENV
*
result
=
toku_malloc
(
sizeof
(
*
result
));
...
@@ -427,7 +443,7 @@ u_int32_t __toku_db_txn_id(DB_TXN * txn) {
...
@@ -427,7 +443,7 @@ u_int32_t __toku_db_txn_id(DB_TXN * txn) {
static
TXNID
next_txn
=
0
;
static
TXNID
next_txn
=
0
;
int
__toku_txn_begin
(
DB_ENV
*
env
,
DB_TXN
*
stxn
,
DB_TXN
**
txn
,
u_int32_t
flags
)
{
static
int
__toku_txn_begin
(
DB_ENV
*
env
,
DB_TXN
*
stxn
,
DB_TXN
**
txn
,
u_int32_t
flags
)
{
DB_TXN
*
result
=
toku_malloc
(
sizeof
(
*
result
));
DB_TXN
*
result
=
toku_malloc
(
sizeof
(
*
result
));
if
(
result
==
0
)
if
(
result
==
0
)
return
ENOMEM
;
return
ENOMEM
;
...
@@ -623,9 +639,10 @@ int __toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname,
...
@@ -623,9 +639,10 @@ int __toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname,
db
->
i
->
open_flags
=
flags
;
db
->
i
->
open_flags
=
flags
;
db
->
i
->
open_mode
=
mode
;
db
->
i
->
open_mode
=
mode
;
r
=
brt_open
(
db
->
i
->
brt
,
db
->
i
->
full_fname
,
dbname
,
flags
&
DB_CREATE
,
r
=
brt_open
(
db
->
i
->
brt
,
db
->
i
->
full_fname
,
dbname
,
flags
&
DB_EXCL
,
db
->
dbenv
->
i
->
cachetable
,
flags
&
DB_CREATE
,
flags
&
DB_EXCL
,
txn
?
txn
->
i
->
tokutxn
:
NULL_TXN
);
db
->
dbenv
->
i
->
cachetable
,
txn
?
txn
->
i
->
tokutxn
:
NULL_TXN
);
if
(
r
!=
0
)
if
(
r
!=
0
)
goto
error_cleanup
;
goto
error_cleanup
;
...
...
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