mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
Addresses #2197 refs[t:2197] brtdump: Provide cachefile for brt header.
git-svn-id: file:///svn/toku/tokudb@15989 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
2b9bd45bf3
commit
c3738f4487
1 changed files with 14 additions and 3 deletions
|
@ -8,6 +8,9 @@
|
||||||
|
|
||||||
static int dump_data = 1;
|
static int dump_data = 1;
|
||||||
|
|
||||||
|
|
||||||
|
static CACHETABLE ct;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_item (bytevec val, ITEMLEN len) {
|
print_item (bytevec val, ITEMLEN len) {
|
||||||
printf("\"");
|
printf("\"");
|
||||||
|
@ -24,10 +27,11 @@ print_item (bytevec val, ITEMLEN len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_header (int f, struct brt_header **header) {
|
dump_header (int f, struct brt_header **header, CACHEFILE cf) {
|
||||||
struct brt_header *h;
|
struct brt_header *h;
|
||||||
int r;
|
int r;
|
||||||
r = toku_deserialize_brtheader_from (f, &h); assert(r==0);
|
r = toku_deserialize_brtheader_from (f, &h); assert(r==0);
|
||||||
|
h->cf = cf;
|
||||||
printf("brtheader:\n");
|
printf("brtheader:\n");
|
||||||
printf(" layout_version=%d\n", h->layout_version);
|
printf(" layout_version=%d\n", h->layout_version);
|
||||||
printf(" layout_version_original=%d\n", h->layout_version_original);
|
printf(" layout_version_original=%d\n", h->layout_version_original);
|
||||||
|
@ -296,7 +300,14 @@ main (int argc, const char *argv[]) {
|
||||||
const char *n = argv[0];
|
const char *n = argv[0];
|
||||||
int f = open(n, O_RDONLY + O_BINARY); assert(f>=0);
|
int f = open(n, O_RDONLY + O_BINARY); assert(f>=0);
|
||||||
struct brt_header *h;
|
struct brt_header *h;
|
||||||
dump_header(f, &h);
|
// create a cachefile for the header
|
||||||
|
int r = toku_create_cachetable(&ct, 1<<25, (LSN){0}, 0);
|
||||||
|
assert(r == 0);
|
||||||
|
CACHEFILE cf;
|
||||||
|
FILENUM fn;
|
||||||
|
r = toku_cachetable_openfd_with_filenum (&cf, ct, f, n, FALSE, fn, FALSE);
|
||||||
|
assert(r==0);
|
||||||
|
dump_header(f, &h, cf);
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
while (1) {
|
while (1) {
|
||||||
printf("brtdump>"); fflush(stdout);
|
printf("brtdump>"); fflush(stdout);
|
||||||
|
@ -314,7 +325,7 @@ main (int argc, const char *argv[]) {
|
||||||
interactive_help();
|
interactive_help();
|
||||||
} else if (strcmp(fields[0], "header") == 0) {
|
} else if (strcmp(fields[0], "header") == 0) {
|
||||||
toku_brtheader_free(h);
|
toku_brtheader_free(h);
|
||||||
dump_header(f, &h);
|
dump_header(f, &h, cf);
|
||||||
} else if (strcmp(fields[0], "node") == 0 && nfields == 2) {
|
} else if (strcmp(fields[0], "node") == 0 && nfields == 2) {
|
||||||
BLOCKNUM off = make_blocknum(getuint64(fields[1]));
|
BLOCKNUM off = make_blocknum(getuint64(fields[1]));
|
||||||
dump_node(f, off, h);
|
dump_node(f, off, h);
|
||||||
|
|
Loading…
Add table
Reference in a new issue