Commit f9ac445e authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

delete logging cruft closes[t:2189]

git-svn-id: file:///svn/toku/tokudb@15929 c7de825b-a66e-492c-adef-691d508d4ae1
parent c9ed5c98
......@@ -759,43 +759,6 @@ toku_blocktable_create_new(BLOCK_TABLE *btp) {
*btp = bt;
}
// Depend on disk format.
#if 0
void
toku_blocktable_create_from_loggedheader(BLOCK_TABLE *btp, LOGGEDBRTHEADER h) {
// We don't need the lock for the block table for this operation.
BLOCK_TABLE bt = blocktable_create_internal();
// TODO: get translation Question: how is this different from translation_deserialize_from_buffer()?
assert(0);
blocktable_note_translation(bt->block_allocator, &bt->current);
copy_translation(&bt->checkpointed, &bt->current, TRANSLATION_CHECKPOINTED);
*btp = bt;
/********** obsolete:
toku_blocktable_create_internal (&bt,
h.free_blocks,
h.unused_blocks,
h.btt_size.b,
h.btt_diskoff);
int64_t i;
for (i=0; i<h.btt_size.b; i++) {
bt->block_translation[i].u.diskoff = h.btt_pairs[i].off;
bt->block_translation[i].size = h.btt_pairs[i].size;
if (h.btt_pairs[i].size > 0) {
block_allocator_alloc_block_at(bt->block_allocator, h.btt_pairs[i].size, h.btt_pairs[i].off);
}
}
*btp = bt;
*********************/
}
#endif
int
toku_blocktable_iterate (BLOCK_TABLE bt, enum translation_type type, BLOCKTABLE_CALLBACK f, void *extra, BOOL data_only, BOOL used_only) {
struct translation *src;
......
......@@ -2890,28 +2890,6 @@ brt_init_header_partial (BRT t) {
t->h->root_put_counter = global_root_put_counter++;
#if 0 //TODO: logged header logic //TODO: #1605
{
u_int64_t n_blocks_translated = toku_block_get_translated_blocknum_limit(t->h->blocktable);
assert(n_blocks_translated==0);
LOGGEDBRTHEADER lh = {.size= toku_serialize_brt_header_size(t->h),
.flags = t->flags,
.nodesize = t->h->nodesize,
.n_named_roots = t->h->n_named_roots,
.btt_size = make_blocknum(n_blocks_translated),
.btt_diskoff = 0, // No diskoffset yet allocated, since it's a new blocktable.
.btt_pairs = 0};
if (t->h->n_named_roots>=0) {
lh.u.many.names = t->h->names;
lh.u.many.roots = t->h->roots;
} else {
lh.u.one.root = t->h->roots[0];
}
#ifdef __ICL
lh = lh; //Satisfy icl (variable set but unused)
#endif
}
#endif
BLOCKNUM root = t->h->root;
if ((r=setup_initial_brt_root_node(t, root))!=0) { return r; }
//printf("%s:%d putting %p (%d)\n", __FILE__, __LINE__, t->h, 0);
......
......@@ -63,26 +63,6 @@ struct logged_btt_pair {
int32_t size;
};
// The data that appears in the log to encode a brtheader. */
typedef struct loggedbrtheader {
u_int32_t size;
u_int32_t flags;
u_int32_t nodesize;
BLOCKNUM free_blocks;
BLOCKNUM unused_blocks;
BLOCKNUM root;
BLOCKNUM btt_size; // block translation table size
DISKOFF btt_diskoff;
struct logged_btt_pair *btt_pairs;
} LOGGEDBRTHEADER;
typedef struct intpairarray {
u_int32_t size;
struct intpair {
u_int32_t a,b;
} *array;
} INTPAIRARRAY;
typedef struct cachetable *CACHETABLE;
typedef struct cachefile *CACHEFILE;
......
......@@ -153,20 +153,6 @@ static inline int toku_logsizeof_BYTESTRING (BYTESTRING bs) {
return 4+bs.len;
}
#if 0
static inline int toku_logsizeof_LOGGEDBRTHEADER (LOGGEDBRTHEADER bs) {
int in_both = 4+4+4+8+8+4+8;
in_both += 8; // for the number of block headers
assert(bs.btt_size.b< 30000000); // otherwise we in trouble on the next line
in_both += 12*bs.btt_size.b;
return in_both+8;
}
static inline int toku_logsizeof_INTPAIRARRAY (INTPAIRARRAY pa) {
return 4+(4+4)*pa.size;
}
#endif
static inline char *fixup_fname(BYTESTRING *f) {
assert(f->len>0);
char *fname = toku_xmalloc(f->len+1);
......
......@@ -638,14 +638,6 @@ int toku_fread_u_int32_t (FILE *f, u_int32_t *v, struct x1764 *checksum, u_int32
return 0;
}
static int toku_fread_int32_t (FILE *f, int32_t *v, struct x1764 *checksum, u_int32_t *len) {
u_int32_t uv;
int r = toku_fread_u_int32_t(f, &uv, checksum, len);
int32_t rv = uv;
if (r==0) *v=rv;
return r;
}
int toku_fread_u_int64_t (FILE *f, u_int64_t *v, struct x1764 *checksum, u_int32_t *len) {
u_int32_t v1,v2;
int r;
......@@ -691,40 +683,6 @@ int toku_fread_BYTESTRING (FILE *f, BYTESTRING *bs, struct x1764 *checksum, u_in
return 0;
}
int toku_fread_LOGGEDBRTHEADER (FILE *f, LOGGEDBRTHEADER *v, struct x1764 *checksum, u_int32_t *len) {
int r;
r = toku_fread_u_int32_t(f, &v->size, checksum, len); if (r!=0) return r;
r = toku_fread_u_int32_t(f, &v->flags, checksum, len); if (r!=0) return r;
r = toku_fread_u_int32_t(f, &v->nodesize, checksum, len); if (r!=0) return r;
r = toku_fread_BLOCKNUM (f, &v->free_blocks, checksum, len); if (r!=0) return r;
r = toku_fread_BLOCKNUM (f, &v->unused_blocks, checksum, len); if (r!=0) return r;
r = toku_fread_BLOCKNUM (f, &v->root, checksum, len); if (r!=0) return r;
r = toku_fread_BLOCKNUM (f, &v->btt_size, checksum, len); if (r!=0) return r;
r = toku_fread_DISKOFF (f, &v->btt_diskoff, checksum, len); if (r!=0) return r;
XMALLOC_N(v->btt_size.b, v->btt_pairs);
int64_t i;
for (i=0; i<v->btt_size.b; i++) {
r = toku_fread_DISKOFF(f, &v->btt_pairs[i].off, checksum, len);
if (r!=0) { toku_free(v->btt_pairs); return r; }
r = toku_fread_int32_t (f, &v->btt_pairs[i].size, checksum, len);
if (r!=0) { toku_free(v->btt_pairs); return r; }
}
return 0;
}
int toku_fread_INTPAIRARRAY (FILE *f, INTPAIRARRAY *v, struct x1764 *checksum, u_int32_t *len) {
int r;
u_int32_t i;
r = toku_fread_u_int32_t(f, &v->size, checksum, len); if (r!=0) return r;
MALLOC_N(v->size, v->array);
if (v->array==0) return errno;
for (i=0; i<v->size; i++) {
r = toku_fread_u_int32_t(f, &v->array[i].a, checksum, len); if (r!=0) return r;
r = toku_fread_u_int32_t(f, &v->array[i].b, checksum, len); if (r!=0) return r;
}
return 0;
}
int toku_logprint_LSN (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__))) {
LSN v;
int r = toku_fread_LSN(inf, &v, checksum, len);
......@@ -816,35 +774,6 @@ int toku_logprint_BLOCKNUM (FILE *outf, FILE *inf, const char *fieldname, struct
return 0;
}
int toku_logprint_LOGGEDBRTHEADER (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__))) {
LOGGEDBRTHEADER v;
int r = toku_fread_LOGGEDBRTHEADER(inf, &v, checksum, len);
if (r!=0) return r;
fprintf(outf, " %s={size=%u flags=%u nodesize=%u free_blocks=%" PRId64 " unused_memory=%" PRId64, fieldname, v.size, v.flags, v.nodesize, v.free_blocks.b, v.unused_blocks.b);
fprintf(outf, " btt_size=%" PRId64 " btt_diskoff=%" PRId64 " btt_pairs={", v.btt_size.b, v.btt_diskoff) ;
int64_t i;
for (i=0; i<v.btt_size.b; i++) {
if (i>0) printf(" ");
fprintf(outf, "%" PRId64 ",%d", v.btt_pairs[i].off, v.btt_pairs[i].size);
}
fprintf(outf, "}");
return 0;
}
int toku_logprint_INTPAIRARRAY (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__))) {
INTPAIRARRAY v;
u_int32_t i;
int r = toku_fread_INTPAIRARRAY(inf, &v, checksum, len);
if (r!=0) return r;
fprintf(outf, " %s={size=%u array={", fieldname, v.size);
for (i=0; i<v.size; i++) {
if (i!=0) fprintf(outf, " ");
fprintf(outf, "{%u %u}", v.array[i].a, v.array[i].b);
}
toku_free(v.array);
return 0;
}
int toku_read_and_print_logmagic (FILE *f, u_int32_t *versionp) {
{
......
......@@ -56,8 +56,6 @@ int toku_fread_DISKOFF (FILE *f, DISKOFF *diskoff, struct x1764 *checksum, u_int
int toku_fread_BLOCKNUM (FILE *f, BLOCKNUM *blocknum, struct x1764 *checksum, u_int32_t *len);
int toku_fread_TXNID (FILE *f, TXNID *txnid, struct x1764 *checksum, u_int32_t *len);
int toku_fread_BYTESTRING (FILE *f, BYTESTRING *bs, struct x1764 *checksum, u_int32_t *len);
int toku_fread_LOGGEDBRTHEADER (FILE *f, LOGGEDBRTHEADER *v, struct x1764 *checksum, u_int32_t *len);
int toku_fread_INTPAIRARRAY (FILE *f, INTPAIRARRAY *v, struct x1764 *checksum, u_int32_t *len);
int toku_logprint_LSN (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__)));
int toku_logprint_TXNID (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__)));
......@@ -69,8 +67,6 @@ int toku_logprint_BYTESTRING (FILE *outf, FILE *inf, const char *fieldname, stru
int toku_logprint_FILENUM (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format);
int toku_logprint_DISKOFF (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__)));
int toku_logprint_BLOCKNUM (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__)));
int toku_logprint_LOGGEDBRTHEADER (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__)));
int toku_logprint_INTPAIRARRAY (FILE *outf, FILE *inf, const char *fieldname, struct x1764 *checksum, u_int32_t *len, const char *format __attribute__((__unused__)));
int toku_read_and_print_logmagic (FILE *f, u_int32_t *versionp);
int toku_read_logmagic (FILE *f, u_int32_t *versionp);
......
......@@ -193,31 +193,4 @@ static inline void wbuf_FILENUM (struct wbuf *w, FILENUM fileid) {
wbuf_uint(w, fileid.fileid);
}
static inline void wbuf_LOGGEDBRTHEADER (struct wbuf *w, LOGGEDBRTHEADER h) {
wbuf_uint(w, h.size);
wbuf_uint(w, h.flags);
wbuf_uint(w, h.nodesize);
wbuf_BLOCKNUM(w, h.free_blocks);
wbuf_BLOCKNUM(w, h.unused_blocks);
wbuf_BLOCKNUM(w, h.root);
wbuf_BLOCKNUM(w, h.btt_size);
wbuf_DISKOFF(w, h.btt_diskoff);
{
BLOCKNUM i;
for (i.b=0; i.b<h.btt_size.b; i.b++) {
wbuf_DISKOFF(w, h.btt_pairs[i.b].off);
wbuf_int(w, h.btt_pairs[i.b].size);
}
}
}
static inline void wbuf_INTPAIRARRAY (struct wbuf *w, INTPAIRARRAY h) {
u_int32_t i;
wbuf_uint(w, h.size);
for (i=0; i<h.size; i++) {
wbuf_uint(w, h.array[i].a);
wbuf_uint(w, h.array[i].b);
}
}
#endif
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