mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 12:01:42 +01:00
015bc27f2f
This makes big difference for space (46% smaller) and a small time difference (5% faster), as measured by benchmark-test. Before: {{{ $ ./benchmark-test nodesize=1048576 keysize=8 valsize=8 Serial and random insertions of 1048576 per batch serial 8.753964s 119783/s random 5.640094s 185915/s cumulative 14.394118s 145695/s serial 9.381472s 111771/s random 7.325284s 143145/s cumulative 31.100944s 134861/s serial 9.859233s 106355/s random 6.734307s 155707/s cumulative 47.694553s 131911/s serial 11.069200s 94729/s random 6.885863s 152280/s cumulative 65.649695s 127778/s Shutdown 4.636875s Total time 70.286611s for 8388608 insertions = 119349/s $ ls -l sinsert.brt -rwxrwxr-x 1 bradley bradley 730344924 Jan 22 11:47 sinsert.brt }}} After: {{{ $ ./benchmark-test nodesize=1048576 keysize=8 valsize=8 Serial and random insertions of 1048576 per batch serial 8.521855s 123046/s random 5.730942s 182967/s cumulative 14.252861s 147139/s serial 9.106047s 115152/s random 7.001765s 149759/s cumulative 30.360740s 138149/s serial 9.543696s 109871/s random 6.651000s 157657/s cumulative 46.555503s 135139/s serial 10.627035s 98671/s random 6.555884s 159944/s cumulative 63.738491s 131610/s Shutdown 2.818513s Total time 66.557042s for 8388608 insertions = 126036/s $ ls -l sinsert.brt -rwxrwxr-x 1 bradley bradley 396894480 Jan 22 11:45 sinsert.brt }}} git-svn-id: file:///svn/tokudb@1798 c7de825b-a66e-492c-adef-691d508d4ae1
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
/* Tell me the diff between two brt files. */
|
|
#include <assert.h>
|
|
#include <fcntl.h>
|
|
|
|
#include "key.h"
|
|
#include "brt-internal.h"
|
|
|
|
void dump_header (int f, struct brt_header **header) {
|
|
struct brt_header *h;
|
|
int r;
|
|
r = toku_deserialize_brtheader_from (f, 0, &h); assert(r==0);
|
|
printf("brtheader:\n");
|
|
printf(" dirty=%d\n", h->dirty);
|
|
printf(" nodesize=%d\n", h->nodesize);
|
|
printf(" freelist=%lld\n", h->freelist);
|
|
printf(" unused_memory=%lld\n", h->unused_memory);
|
|
printf(" unnamed_root=%lld\n", h->unnamed_root);
|
|
printf(" n_named_roots=%d\n", h->n_named_roots);
|
|
if (h->n_named_roots>=0) {
|
|
int i;
|
|
for (i=0; i<h->n_named_roots; i++) {
|
|
printf(" %s -> %lld\n", h->names[i], h->roots[i]);
|
|
}
|
|
}
|
|
printf(" flags=%d\n", h->flags);
|
|
*header = h;
|
|
}
|
|
|
|
void dump_node (int f, DISKOFF off, struct brt_header *h) {
|
|
BRTNODE n;
|
|
int r = toku_deserialize_brtnode_from (f, off, &n, h->flags, h->nodesize,
|
|
toku_default_compare_fun, toku_default_compare_fun,
|
|
(DB*)0, (FILENUM){0});
|
|
assert(r==0);
|
|
|
|
}
|
|
|
|
int main (int argc, const char *argv[]) {
|
|
assert(argc==2);
|
|
const char *n = argv[1];
|
|
int f = open(n, O_RDONLY); assert(f>=0);
|
|
struct brt_header *h;
|
|
dump_header(f, &h);
|
|
dump_node(f, 1<<20, h);
|
|
return 0;
|
|
}
|