Commit 49b78b8c authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Make brtdump print the root fifo. Fixes #748.

git-svn-id: file:///svn/tokudb@3672 c7de825b-a66e-492c-adef-691d508d4ae1
parent de13c2b5
...@@ -7,6 +7,20 @@ ...@@ -7,6 +7,20 @@
#include "key.h" #include "key.h"
#include "brt-internal.h" #include "brt-internal.h"
void print_item (bytevec val, ITEMLEN len) {
printf("\"");
ITEMLEN i;
for (i=0; i<len; i++) {
unsigned char ch = ((unsigned char*)val)[i];
if (isprint(ch) && ch!='\\' && ch!='"') {
printf("%c", ch);
} else {
printf("\\%03o", ch);
}
}
printf("\"");
}
void dump_header (int f, struct brt_header **header) { void dump_header (int f, struct brt_header **header) {
struct brt_header *h; struct brt_header *h;
int r; int r;
...@@ -26,20 +40,30 @@ void dump_header (int f, struct brt_header **header) { ...@@ -26,20 +40,30 @@ void dump_header (int f, struct brt_header **header) {
} }
printf(" flags=%d\n", h->flags); printf(" flags=%d\n", h->flags);
*header = h; *header = h;
} printf("Fifo:\n");
r = toku_deserialize_fifo_at(f, h->unused_memory, &h->fifo);
void print_item (bytevec val, ITEMLEN len) { printf(" fifo has %d entries\n", toku_fifo_n_entries(h->fifo));
printf("\""); FIFO_ITERATE(h->fifo, key, keylen, data, datalen, type, xid,
ITEMLEN i; ({
for (i=0; i<len; i++) { printf(" ");
unsigned char ch = ((unsigned char*)val)[i]; switch (type) {
if (isprint(ch) && ch!='\\' && ch!='"') { case BRT_NONE: printf("NONE"); goto ok;
printf("%c", ch); case BRT_INSERT: printf("INSERT"); goto ok;
} else { case BRT_DELETE_ANY: printf("DELETE_ANY"); goto ok;
printf("\\%03o", ch); case BRT_DELETE_BOTH: printf("DELETE_BOTH"); goto ok;
} case BRT_ABORT_ANY: printf("ABORT_ANY"); goto ok;
} case BRT_ABORT_BOTH: printf("ABORT_BOTH"); goto ok;
printf("\""); case BRT_COMMIT_ANY: printf("COMMIT_ANY"); goto ok;
case BRT_COMMIT_BOTH: printf("COMMIT_BOTH"); goto ok;
}
printf("huh?");
ok:
printf(" %lld ", (long long)xid);
print_item(key, keylen);
printf(" ");
print_item(data, datalen);
printf("\n");
}));
} }
void dump_node (int f, DISKOFF off) { void dump_node (int f, DISKOFF off) {
......
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