Commit ddec990a authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Make each rollback code take a list of arguments rather than a single...

Make each rollback code take a list of arguments rather than a single logentry.  Makes it easier to notice that I've got unused variables.  Addresses #27.

git-svn-id: file:///svn/tokudb@2206 c7de825b-a66e-492c-adef-691d508d4ae1
parent a30a89e7
......@@ -205,7 +205,9 @@ void generate_log_struct (void) {
fprintf(hf, " %-16s crc;\n", "u_int32_t");
fprintf(hf, " %-16s len;\n", "u_int32_t");
fprintf(hf, "};\n");
fprintf(hf, "void toku_recover_%s (struct logtype_%s *);\n", lt->name, lt->name);
fprintf(hf, "void toku_recover_%s (LSN lsn", lt->name);
DO_FIELDS(ft, lt, fprintf(hf, ", %s %s", ft->type, ft->name));
fprintf(hf, ");\n");
fprintf(hf, "int toku_rollback_%s (struct logtype_%s *, TOKUTXN);\n", lt->name, lt->name);
}));
fprintf(hf, "struct log_entry {\n");
......@@ -227,6 +229,14 @@ void generate_dispatch (void) {
DO_LOGTYPES(lt, fprintf(hf, " case LT_%s: var = funprefix ## %s (&(s)->u.%s, ## args); break;\\\n", lt->name, lt->name, lt->name));
fprintf(hf, " }})\n");
fprintf(hf, "#define logtype_dispatch_args(s, funprefix) ({ switch((s)->cmd) {\\\n");
DO_LOGTYPES(lt,
({
fprintf(hf, " case LT_%s: funprefix ## %s ((s)->u.%s.lsn", lt->name, lt->name, lt->name);
DO_FIELDS(ft, lt, fprintf(hf, ",(s)->u.%s.%s", lt->name, ft->name));
fprintf(hf, "); break;\\\n");
}));
fprintf(hf, " }})\n");
}
void generate_log_free(void) {
......
......@@ -37,7 +37,7 @@ int main (int argc, char *argv[]) {
assert(r==0 && version==0);
while ((r = toku_log_fread(f, &le))==0) {
//printf("%lld: Got cmd %c\n", le.u.commit.lsn.lsn, le.cmd);
logtype_dispatch(&le, toku_recover_);
logtype_dispatch_args(&le, toku_recover_);
entrycount++;
}
if (r!=EOF) {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment