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
050040b9
Commit
050040b9
authored
Mar 25, 2014
by
Leif Walsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed engine status printing with errcall to print line by line Tokutek/mongo#1028
parent
a7e52e21
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
8 deletions
+100
-8
portability/toku_assert.cc
portability/toku_assert.cc
+6
-6
src/ydb.cc
src/ydb.cc
+92
-1
toku_include/toku_assert.h
toku_include/toku_assert.h
+2
-1
No files found.
portability/toku_assert.cc
View file @
050040b9
...
@@ -125,12 +125,15 @@ toku_assert_init(void)
...
@@ -125,12 +125,15 @@ toku_assert_init(void)
// Function pointers are zero by default so asserts can be used by brt-layer tests without an environment.
// Function pointers are zero by default so asserts can be used by brt-layer tests without an environment.
static
int
(
*
toku_maybe_get_engine_status_text_p
)(
char
*
buff
,
int
buffsize
)
=
0
;
static
int
(
*
toku_maybe_get_engine_status_text_p
)(
char
*
buff
,
int
buffsize
)
=
0
;
static
int
(
*
toku_maybe_err_engine_status_p
)(
void
)
=
0
;
static
void
(
*
toku_maybe_set_env_panic_p
)(
int
code
,
const
char
*
msg
)
=
0
;
static
void
(
*
toku_maybe_set_env_panic_p
)(
int
code
,
const
char
*
msg
)
=
0
;
void
toku_assert_set_fpointers
(
int
(
*
toku_maybe_get_engine_status_text_pointer
)(
char
*
,
int
),
void
toku_assert_set_fpointers
(
int
(
*
toku_maybe_get_engine_status_text_pointer
)(
char
*
,
int
),
int
(
*
toku_maybe_err_engine_status_pointer
)(
void
),
void
(
*
toku_maybe_set_env_panic_pointer
)(
int
,
const
char
*
),
void
(
*
toku_maybe_set_env_panic_pointer
)(
int
,
const
char
*
),
uint64_t
num_rows
)
{
uint64_t
num_rows
)
{
toku_maybe_get_engine_status_text_p
=
toku_maybe_get_engine_status_text_pointer
;
toku_maybe_get_engine_status_text_p
=
toku_maybe_get_engine_status_text_pointer
;
toku_maybe_err_engine_status_p
=
toku_maybe_err_engine_status_pointer
;
toku_maybe_set_env_panic_p
=
toku_maybe_set_env_panic_pointer
;
toku_maybe_set_env_panic_p
=
toku_maybe_set_env_panic_pointer
;
engine_status_num_rows
=
num_rows
;
engine_status_num_rows
=
num_rows
;
}
}
...
@@ -152,11 +155,8 @@ void db_env_do_backtrace_errfunc(toku_env_err_func errfunc, const void *env) {
...
@@ -152,11 +155,8 @@ void db_env_do_backtrace_errfunc(toku_env_err_func errfunc, const void *env) {
}
}
#endif
#endif
if
(
engine_status_num_rows
&&
toku_maybe_get_engine_status_text_p
)
{
if
(
engine_status_num_rows
&&
toku_maybe_err_engine_status_p
)
{
int
buffsize
=
engine_status_num_rows
*
128
;
// assume 128 characters per row (gross overestimate, should be safe)
toku_maybe_err_engine_status_p
();
char
buff
[
buffsize
];
toku_maybe_get_engine_status_text_p
(
buff
,
buffsize
);
errfunc
(
env
,
0
,
"Engine status:
\n
%s
\n
"
,
buff
);
}
else
{
}
else
{
errfunc
(
env
,
0
,
"Engine status function not available
\n
"
);
errfunc
(
env
,
0
,
"Engine status function not available
\n
"
);
}
}
...
...
src/ydb.cc
View file @
050040b9
...
@@ -233,6 +233,7 @@ static DB_ENV * volatile most_recent_env; // most recently opened env, used fo
...
@@ -233,6 +233,7 @@ static DB_ENV * volatile most_recent_env; // most recently opened env, used fo
static
int
env_get_iname
(
DB_ENV
*
env
,
DBT
*
dname_dbt
,
DBT
*
iname_dbt
);
static
int
env_get_iname
(
DB_ENV
*
env
,
DBT
*
dname_dbt
,
DBT
*
iname_dbt
);
static
int
toku_maybe_get_engine_status_text
(
char
*
buff
,
int
buffsize
);
// for use by toku_assert
static
int
toku_maybe_get_engine_status_text
(
char
*
buff
,
int
buffsize
);
// for use by toku_assert
static
int
toku_maybe_err_engine_status
(
void
);
static
void
toku_maybe_set_env_panic
(
int
code
,
const
char
*
msg
);
// for use by toku_assert
static
void
toku_maybe_set_env_panic
(
int
code
,
const
char
*
msg
);
// for use by toku_assert
int
int
...
@@ -1108,7 +1109,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
...
@@ -1108,7 +1109,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
most_recent_env
=
env
;
most_recent_env
=
env
;
uint64_t
num_rows
;
uint64_t
num_rows
;
env_get_engine_status_num_rows
(
env
,
&
num_rows
);
env_get_engine_status_num_rows
(
env
,
&
num_rows
);
toku_assert_set_fpointers
(
toku_maybe_get_engine_status_text
,
toku_maybe_set_env_panic
,
num_rows
);
toku_assert_set_fpointers
(
toku_maybe_get_engine_status_text
,
toku_maybe_
err_engine_status
,
toku_maybe_
set_env_panic
,
num_rows
);
}
}
return
r
;
return
r
;
}
}
...
@@ -2223,6 +2224,83 @@ env_get_engine_status_text(DB_ENV * env, char * buff, int bufsiz) {
...
@@ -2223,6 +2224,83 @@ env_get_engine_status_text(DB_ENV * env, char * buff, int bufsiz) {
return
r
;
return
r
;
}
}
// prints engine status using toku_env_err line-by-line
static
int
env_err_engine_status
(
DB_ENV
*
env
)
{
uint32_t
stringsize
=
1024
;
uint64_t
panic
;
char
panicstring
[
stringsize
];
uint64_t
num_rows
;
uint64_t
max_rows
;
fs_redzone_state
redzone_state
;
toku_env_err
(
env
,
0
,
"BUILD_ID = %d"
,
BUILD_ID
);
(
void
)
env_get_engine_status_num_rows
(
env
,
&
max_rows
);
TOKU_ENGINE_STATUS_ROW_S
mystat
[
max_rows
];
int
r
=
env
->
get_engine_status
(
env
,
mystat
,
max_rows
,
&
num_rows
,
&
redzone_state
,
&
panic
,
panicstring
,
stringsize
,
TOKU_ENGINE_STATUS
);
if
(
r
)
{
toku_env_err
(
env
,
0
,
"Engine status not available: "
);
if
(
!
env
)
{
toku_env_err
(
env
,
0
,
"no environment"
);
}
else
if
(
!
(
env
->
i
))
{
toku_env_err
(
env
,
0
,
"environment internal struct is null"
);
}
else
if
(
!
env_opened
(
env
))
{
toku_env_err
(
env
,
0
,
"environment is not open"
);
}
}
else
{
if
(
panic
)
{
toku_env_err
(
env
,
0
,
"Env panic code: %"
PRIu64
,
panic
);
if
(
strlen
(
panicstring
))
{
invariant
(
strlen
(
panicstring
)
<=
stringsize
);
toku_env_err
(
env
,
0
,
"Env panic string: %s"
,
panicstring
);
}
}
for
(
uint64_t
row
=
0
;
row
<
num_rows
;
row
++
)
{
switch
(
mystat
[
row
].
type
)
{
case
FS_STATE
:
toku_env_err
(
env
,
0
,
"%s: %"
PRIu64
,
mystat
[
row
].
legend
,
mystat
[
row
].
value
.
num
);
break
;
case
UINT64
:
toku_env_err
(
env
,
0
,
"%s: %"
PRIu64
,
mystat
[
row
].
legend
,
mystat
[
row
].
value
.
num
);
break
;
case
CHARSTR
:
toku_env_err
(
env
,
0
,
"%s: %s"
,
mystat
[
row
].
legend
,
mystat
[
row
].
value
.
str
);
break
;
case
UNIXTIME
:
{
char
tbuf
[
26
];
format_time
((
time_t
*
)
&
mystat
[
row
].
value
.
num
,
tbuf
);
toku_env_err
(
env
,
0
,
"%s: %s"
,
mystat
[
row
].
legend
,
tbuf
);
}
break
;
case
TOKUTIME
:
{
double
t
=
tokutime_to_seconds
(
mystat
[
row
].
value
.
num
);
toku_env_err
(
env
,
0
,
"%s: %.6f"
,
mystat
[
row
].
legend
,
t
);
}
break
;
case
PARCOUNT
:
{
uint64_t
v
=
read_partitioned_counter
(
mystat
[
row
].
value
.
parcount
);
toku_env_err
(
env
,
0
,
"%s: %"
PRIu64
,
mystat
[
row
].
legend
,
v
);
}
break
;
default:
toku_env_err
(
env
,
0
,
"%s: UNKNOWN STATUS TYPE: %d"
,
mystat
[
row
].
legend
,
mystat
[
row
].
type
);
break
;
}
}
}
return
r
;
}
// intended for use by toku_assert logic, when env is not known
// intended for use by toku_assert logic, when env is not known
static
int
static
int
toku_maybe_get_engine_status_text
(
char
*
buff
,
int
buffsize
)
{
toku_maybe_get_engine_status_text
(
char
*
buff
,
int
buffsize
)
{
...
@@ -2238,6 +2316,19 @@ toku_maybe_get_engine_status_text (char * buff, int buffsize) {
...
@@ -2238,6 +2316,19 @@ toku_maybe_get_engine_status_text (char * buff, int buffsize) {
return
r
;
return
r
;
}
}
static
int
toku_maybe_err_engine_status
(
void
)
{
DB_ENV
*
env
=
most_recent_env
;
int
r
;
if
(
engine_status_enable
&&
env
!=
NULL
)
{
r
=
env_err_engine_status
(
env
);
}
else
{
r
=
EOPNOTSUPP
;
}
return
r
;
}
// Set panic code and panic string if not already panicked,
// Set panic code and panic string if not already panicked,
// intended for use by toku_assert when about to abort().
// intended for use by toku_assert when about to abort().
static
void
static
void
...
...
toku_include/toku_assert.h
View file @
050040b9
...
@@ -122,6 +122,7 @@ set_errno(int new_errno)
...
@@ -122,6 +122,7 @@ set_errno(int new_errno)
void
toku_assert_init
(
void
)
__attribute__
((
constructor
));
void
toku_assert_init
(
void
)
__attribute__
((
constructor
));
void
toku_assert_set_fpointers
(
int
(
*
toku_maybe_get_engine_status_text_pointer
)(
char
*
,
int
),
void
toku_assert_set_fpointers
(
int
(
*
toku_maybe_get_engine_status_text_pointer
)(
char
*
,
int
),
int
(
*
toku_maybe_err_engine_status_pointer
)(
void
),
void
(
*
toku_maybe_set_env_panic_pointer
)(
int
,
const
char
*
),
void
(
*
toku_maybe_set_env_panic_pointer
)(
int
,
const
char
*
),
uint64_t
num_rows
);
uint64_t
num_rows
);
...
...
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