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
b3dac33e
Commit
b3dac33e
authored
Nov 14, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to parse the log
git-svn-id:
file:///svn/tokudb@560
c7de825b-a66e-492c-adef-691d508d4ae1
parent
35f841e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
8 deletions
+65
-8
newbrt/Makefile
newbrt/Makefile
+2
-0
newbrt/logdump.c
newbrt/logdump.c
+63
-8
No files found.
newbrt/Makefile
View file @
b3dac33e
...
...
@@ -43,6 +43,8 @@ BINS = $(REGRESSION_TESTS) \
randdb4
\
# This line intentially kept commented so I can have a
\
on the end of the previous line
logdump
:
LDFLAGS+=-lz
libs
:
log.o
bins
:
$(BINS)
check
:
bins
...
...
newbrt/logdump.c
View file @
b3dac33e
...
...
@@ -5,13 +5,27 @@
#include <sys/types.h>
#include <ctype.h>
#include <stdlib.h>
#include <zlib.h>
#include <assert.h>
u_int32_t
crc
=
0
;
u_int32_t
actual_len
=
0
;
unsigned
char
get_char
(
void
)
{
int
v
=
getchar
();
assert
(
v
!=
EOF
);
unsigned
char
c
=
v
;
crc
=
crc32
(
crc
,
&
c
,
1
);
actual_len
++
;
return
c
;
}
u_int32_t
get_uint32
(
void
)
{
u_int32_t
a
=
getchar
();
u_int32_t
b
=
getchar
();
u_int32_t
c
=
getchar
();
u_int32_t
d
=
getchar
();
u_int32_t
a
=
get
_
char
();
u_int32_t
b
=
get
_
char
();
u_int32_t
c
=
get
_
char
();
u_int32_t
d
=
get
_
char
();
return
(
a
<<
24
)
|
(
b
<<
16
)
|
(
c
<<
8
)
|
d
;
}
...
...
@@ -23,22 +37,48 @@ u_int64_t get_uint64 (void) {
lo
);
}
void
transcribe_lsn
(
void
)
{
long
long
value
=
get_uint64
();
printf
(
" lsn=%lld"
,
value
);
}
void
transcribe_txnid
(
void
)
{
long
long
value
=
get_uint64
();
printf
(
" txnid=%lld"
,
value
);
}
void
transcribe_fileid
(
void
)
{
u_int32_t
value
=
get_uint32
();
printf
(
" fileid=%d"
,
value
);
}
void
transcribe_diskoff
(
void
)
{
long
long
value
=
get_uint64
();
printf
(
" diskoff=%lld"
,
value
);
}
void
transcribe_crc32
(
void
)
{
u_int32_t
oldcrc
=
crc
;
u_int32_t
l
=
get_uint32
();
printf
(
" crc=%08x"
,
l
);
assert
(
l
==
oldcrc
);
}
void
transcribe_len
(
void
)
{
u_int32_t
l
=
get_uint32
();
printf
(
" len=%d"
,
l
);
if
(
l
!=
actual_len
)
printf
(
" actual_len=%d"
,
actual_len
);
assert
(
l
==
actual_len
);
}
void
transcribe_key_or_data
(
char
*
what
)
{
u_int32_t
l
=
get_uint32
();
unsigned
int
i
;
printf
(
" %s(%d):
\"
"
,
what
,
l
);
for
(
i
=
0
;
i
<
l
;
i
++
)
{
u_int32_t
c
=
getchar
();
u_int32_t
c
=
get
_
char
();
if
(
c
==
'\\'
)
printf
(
"
\\\\
"
);
else
if
(
c
==
'\n'
)
printf
(
"
\\
n"
);
else
if
(
c
==
' '
)
printf
(
"
\\
"
);
...
...
@@ -50,16 +90,27 @@ void transcribe_key_or_data (char *what) {
}
int
main
(
int
argc
__attribute__
((
__unused__
)),
char
*
argv
[]
__attribute__
((
__unused__
))
)
{
int
main
(
int
argc
,
char
*
argv
[]
)
{
int
cmd
;
while
((
cmd
=
getchar
())
!=
EOF
)
{
int
count
=-
1
;
int
i
;
if
(
argc
>
1
)
{
count
=
atoi
(
argv
[
1
]);
}
for
(
i
=
0
;
i
!=
count
&&
(
crc
=
0
,
cmd
=
get_char
())
!=
EOF
;
i
++
)
{
switch
(
cmd
)
{
case
LT_INSERT_WITH_NO_OVERWRITE
:
printf
(
"INSERT_WITH_NO_OVERWRITE:"
);
transcribe_lsn
();
transcribe_txnid
();
transcribe_fileid
();
transcribe_diskoff
();
transcribe_key_or_data
(
"key"
);
transcribe_key_or_data
(
"data"
);
transcribe_crc32
();
transcribe_len
();
printf
(
"
\n
"
);
break
;
...
...
@@ -74,14 +125,18 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
case
LT_COMMIT
:
printf
(
"COMMIT:"
);
transcribe_lsn
();
transcribe_txnid
();
transcribe_crc32
();
transcribe_len
();
printf
(
"
\n
"
);
break
;
default:
printf
(
"Huh?"
);
a
bort
(
);
a
ssert
(
0
);
}
}
return
0
;
}
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