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
ac01e9e8
Commit
ac01e9e8
authored
Nov 22, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More logformatting stuff. Addresses #11
git-svn-id:
file:///svn/tokudb@712
c7de825b-a66e-492c-adef-691d508d4ae1
parent
28d927af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
21 deletions
+26
-21
newbrt/logformat.c
newbrt/logformat.c
+26
-21
No files found.
newbrt/logformat.c
View file @
ac01e9e8
...
@@ -27,6 +27,10 @@ struct logtype {
...
@@ -27,6 +27,10 @@ struct logtype {
// In the fields, don't mention the command, the LSN, the CRC or the trailing LEN.
// In the fields, don't mention the command, the LSN, the CRC or the trailing LEN.
const
struct
logtype
logtypes
[]
=
{
const
struct
logtype
logtypes
[]
=
{
{
"fcreate"
,
'F'
,
FA
{{
"TXNID"
,
"txnid"
},
{
"BYTESTRING"
,
"fname"
},
{
"uint32"
,
"mode"
},
NULLFIELD
}},
{
"delete"
,
'D'
,
FA
{{
"FILENUM"
,
"filenum"
},
{
"delete"
,
'D'
,
FA
{{
"FILENUM"
,
"filenum"
},
{
"DISKOFF"
,
"diskoff"
},
{
"DISKOFF"
,
"diskoff"
},
{
"BYTESTRING"
,
"key"
},
{
"BYTESTRING"
,
"key"
},
...
@@ -145,40 +149,41 @@ void generate_log_reader (void) {
...
@@ -145,40 +149,41 @@ void generate_log_reader (void) {
}
}
void
generate_logprint
(
void
)
{
void
generate_logprint
(
void
)
{
fprintf
(
cf
,
"int logprint(FILE *outf, FILE *f, int n_records_limit) {
\n
"
);
fprintf
(
cf
,
"int toku_logprint_one_record(FILE *outf, FILE *f) {
\n
"
);
fprintf
(
cf
,
" int i, cmd, r;
\n
"
);
fprintf
(
cf
,
" int cmd, r;
\n
"
);
fprintf
(
cf
,
" for (i=0; i!=count && (cmd=fgetc(f))!=EOF; i++) {
\n
"
);
fprintf
(
cf
,
" cmd=fgetc(f);
\n
"
);
fprintf
(
cf
,
" u_int32_t len_in_file, len=1;
\n
"
);
fprintf
(
cf
,
" if (cmd==EOF) return EOF;
\n
"
);
fprintf
(
cf
,
" char charcmd = cmd;
\n
"
);
fprintf
(
cf
,
" u_int32_t len_in_file, len=1;
\n
"
);
fprintf
(
cf
,
" u_int32_t crc_in_file, crc = toku_crc32(0, &char_cmd, 1);
\n
"
);
fprintf
(
cf
,
" char charcmd = cmd;
\n
"
);
fprintf
(
cf
,
" switch ((enum lt_command)cmd) {
\n
"
);
fprintf
(
cf
,
" u_int32_t crc_in_file, crc = toku_crc32(0, &char_cmd, 1);
\n
"
);
fprintf
(
cf
,
" switch ((enum lt_command)cmd) {
\n
"
);
DO_LOGTYPES
(
lt
,
({
DO_LOGTYPES
(
lt
,
({
fprintf
(
cf
,
"
case LT_%s:
\n
"
,
lt
->
name
);
fprintf
(
cf
,
" case LT_%s:
\n
"
,
lt
->
name
);
// We aren't using the log reader here because we want better diagnostics as soon as things go wrong.
// We aren't using the log reader here because we want better diagnostics as soon as things go wrong.
fprintf
(
cf
,
" r = toku_logprint_LSN(outf, f, &crc, &len); if (r!=0) return r;
\n
"
);
fprintf
(
cf
,
"
r = toku_logprint_LSN(outf, f, &crc, &len); if (r!=0) return r;
\n
"
);
DO_FIELDS
(
ft
,
lt
,
DO_FIELDS
(
ft
,
lt
,
fprintf
(
cf
,
" r = toku_logprint_%s(outf, f, &crc, &len); if (r!=0) return r;
\n
"
,
ft
->
type
));
fprintf
(
cf
,
"
r = toku_logprint_%s(outf, f, &crc, &len); if (r!=0) return r;
\n
"
,
ft
->
type
));
fprintf
(
cf
,
" r = toku_fread_uint32(infile, &crc_in_file); len+=4; if (r!=0) return r;
\n
"
);
fprintf
(
cf
,
"
r = toku_fread_uint32(infile, &crc_in_file); len+=4; if (r!=0) return r;
\n
"
);
fprintf
(
cf
,
" fprintf(outf,
\"
crc=%%d
\"
, crc_in_file);
\n
"
);
fprintf
(
cf
,
"
fprintf(outf,
\"
crc=%%d
\"
, crc_in_file);
\n
"
);
fprintf
(
cf
,
" if (crc_in_file!=crc) fprintf(
\"
actual_crc=%%d
\"
, actual_crc);
\n
"
);
fprintf
(
cf
,
"
if (crc_in_file!=crc) fprintf(
\"
actual_crc=%%d
\"
, actual_crc);
\n
"
);
fprintf
(
cf
,
" r = toku_fread_uint32(infile, &len_in_file); len+=4; if (r!=0) return r;
\n
"
);
fprintf
(
cf
,
"
r = toku_fread_uint32(infile, &len_in_file); len+=4; if (r!=0) return r;
\n
"
);
fprintf
(
cf
,
" fprintf(outf,
\"
len=%%d
\"
, len_in_file);
\n
"
);
fprintf
(
cf
,
"
fprintf(outf,
\"
len=%%d
\"
, len_in_file);
\n
"
);
fprintf
(
cf
,
" if (len_in_file!=len) fprintf(
\"
actual_len=%%d
\"
, actual_len);
\n
"
);
fprintf
(
cf
,
"
if (len_in_file!=len) fprintf(
\"
actual_len=%%d
\"
, actual_len);
\n
"
);
fprintf
(
cf
,
" if (len_in_file!=len || crc_in_file!=crc) return DB_BADFORMAT;
\n
"
);
fprintf
(
cf
,
"
if (len_in_file!=len || crc_in_file!=crc) return DB_BADFORMAT;
\n
"
);
fprintf
(
cf
,
"
goto next
;
\n\n
"
);
fprintf
(
cf
,
"
return 0;
;
\n\n
"
);
}));
}));
fprintf
(
cf
,
" }
\n
"
);
fprintf
(
cf
,
" }
\n
"
);
fprintf
(
cf
,
" fprintf(outf,
\"
Unknown command %%d ('%%c')
\"
, cmd, cmd);
\n
"
);
fprintf
(
cf
,
" fprintf(outf,
\"
Unknown command %%d ('%%c')
\"
, cmd, cmd);
\n
"
);
fprintf
(
cf
,
" return DB_BADFORMAT;
\n
"
);
fprintf
(
cf
,
" return DB_BADFORMAT;
\n
"
);
fprintf
(
cf
,
" next: ;
\n
"
);
fprintf
(
cf
,
" }
\n
"
);
fprintf
(
cf
,
" return 0;
\n
"
);
fprintf
(
cf
,
"}
\n\n
"
);
fprintf
(
cf
,
"}
\n\n
"
);
}
}
int
main
(
int
argc
__attribute__
((
__unused__
)),
char
*
argv
[]
__attribute__
((
__unused__
)))
{
int
main
(
int
argc
__attribute__
((
__unused__
)),
char
*
argv
[]
__attribute__
((
__unused__
)))
{
cf
=
fopen
(
"log_code.c"
,
"w"
);
assert
(
cf
!=
0
);
cf
=
fopen
(
"log_code.c"
,
"w"
);
assert
(
cf
!=
0
);
hf
=
fopen
(
"log_header.h"
,
"w"
);
assert
(
hf
!=
0
);
hf
=
fopen
(
"log_header.h"
,
"w"
);
assert
(
hf
!=
0
);
fprintf
(
cf
,
"#include <stdio.h>
\n
"
);
fprintf
(
hf
,
"#include
\"
brt-internal.h
\"\n
"
);
fprintf
(
cf
,
"#include
\"
log_header.h
\"\n
"
);
generate_log_struct
();
generate_log_struct
();
generate_log_writer
();
generate_log_writer
();
generate_log_reader
();
generate_log_reader
();
...
...
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