Commit 43675fa5 authored by Christian Rober's avatar Christian Rober Committed by Yoni Fogel

refs #5025 Fixed issue where the verification tool incorrectly decompresses old nodes.

git-svn-id: file:///svn/toku/tokudb@45679 c7de825b-a66e-492c-adef-691d508d4ae1
parent c3db83c9
...@@ -524,6 +524,11 @@ int toku_deserialize_bp_from_disk(FTNODE node, FTNODE_DISK_DATA ndd, int childnu ...@@ -524,6 +524,11 @@ int toku_deserialize_bp_from_disk(FTNODE node, FTNODE_DISK_DATA ndd, int childnu
int toku_deserialize_bp_from_compressed(FTNODE node, int childnum, DESCRIPTOR desc, ft_compare_func cmp); int toku_deserialize_bp_from_compressed(FTNODE node, int childnum, DESCRIPTOR desc, ft_compare_func cmp);
int toku_deserialize_ftnode_from (int fd, BLOCKNUM off, u_int32_t /*fullhash*/, FTNODE *ftnode, FTNODE_DISK_DATA* ndd, struct ftnode_fetch_extra* bfe); int toku_deserialize_ftnode_from (int fd, BLOCKNUM off, u_int32_t /*fullhash*/, FTNODE *ftnode, FTNODE_DISK_DATA* ndd, struct ftnode_fetch_extra* bfe);
// <CER> For verifying old, non-upgraded nodes (versions 13 and 14).
int
decompress_from_raw_block_into_rbuf(u_int8_t *raw_block, size_t raw_block_size, struct rbuf *rb, BLOCKNUM blocknum);
//
//////////////// <CER> TODO: Move these function declarations //////////////// <CER> TODO: Move these function declarations
int int
deserialize_ft_from_fd_into_rbuf(int fd, deserialize_ft_from_fd_into_rbuf(int fd,
......
...@@ -2749,7 +2749,7 @@ deserialize_rollback_log_from_rbuf_versioned (u_int32_t version, BLOCKNUM blockn ...@@ -2749,7 +2749,7 @@ deserialize_rollback_log_from_rbuf_versioned (u_int32_t version, BLOCKNUM blockn
return r; return r;
} }
static int int
decompress_from_raw_block_into_rbuf(u_int8_t *raw_block, size_t raw_block_size, struct rbuf *rb, BLOCKNUM blocknum) { decompress_from_raw_block_into_rbuf(u_int8_t *raw_block, size_t raw_block_size, struct rbuf *rb, BLOCKNUM blocknum) {
toku_trace("decompress"); toku_trace("decompress");
int r = 0; int r = 0;
......
...@@ -239,7 +239,16 @@ check_block(BLOCKNUM blocknum, int64_t UU(blocksize), int64_t UU(address), void ...@@ -239,7 +239,16 @@ check_block(BLOCKNUM blocknum, int64_t UU(blocksize), int64_t UU(address), void
// of the nodes on disk does indeed change in the future. // of the nodes on disk does indeed change in the future.
if (version < FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES) if (version < FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES)
{ {
r = check_old_node(node, &rb, version); struct rbuf nrb;
// Use old decompression method for legacy nodes.
r = decompress_from_raw_block_into_rbuf(rb.buf, rb.size, &nrb, blocknum);
if (r != 0) {
failure++;
goto cleanup;
}
// Check the end-to-end checksum.
r = check_old_node(node, &nrb, version);
if (r != 0) { if (r != 0) {
failure++; failure++;
} }
...@@ -344,7 +353,7 @@ check_block_table(int fd, BLOCK_TABLE bt, struct ft *h) ...@@ -344,7 +353,7 @@ check_block_table(int fd, BLOCK_TABLE bt, struct ft *h)
true, true,
true); true);
if (r != 0) { if (r != 0) {
// We can print more information here if necessary. // We can print more information here if necessary.
} }
assert(extra.blocks_done == extra.total_blocks); assert(extra.blocks_done == extra.total_blocks);
...@@ -362,13 +371,13 @@ check_args(int argc) ...@@ -362,13 +371,13 @@ check_args(int argc)
{ {
int r = 0; int r = 0;
if (argc < 3 || argc > 4) { if (argc < 3 || argc > 4) {
printf("ERROR: "); printf("ERROR: ");
printf("Too few arguments.\n"); printf("Too few arguments.\n");
printf("USAGE:\n"); printf("USAGE:\n");
printf(" verify_block_checksum"); printf(" verify_block_checksum");
printf(" DICTIONARY_FILE OUTPUT_FILE [PERCENTAGE]\n"); printf(" DICTIONARY_FILE OUTPUT_FILE [PERCENTAGE]\n");
printf(" [PERCENTAGE] is optional.\n"); printf(" [PERCENTAGE] is optional.\n");
r = 1; r = 1;
} }
return r; return r;
} }
...@@ -383,7 +392,7 @@ main(int argc, char *argv[]) ...@@ -383,7 +392,7 @@ main(int argc, char *argv[])
char *dictfname, *outfname; char *dictfname, *outfname;
r = check_args(argc); r = check_args(argc);
if (r) { if (r) {
goto exit; goto exit;
} }
assert(argc == 3 || argc == 4); assert(argc == 3 || argc == 4);
...@@ -429,7 +438,7 @@ main(int argc, char *argv[]) ...@@ -429,7 +438,7 @@ main(int argc, char *argv[])
check_block_table(dictfd, h2->blocktable, h2); check_block_table(dictfd, h2->blocktable, h2);
} }
if (h1 == NULL && h2 == NULL) { if (h1 == NULL && h2 == NULL) {
printf("Both headers have a corruption and could not be used.\n"); printf("Both headers have a corruption and could not be used.\n");
} }
toku_thread_pool_destroy(&ft_pool); toku_thread_pool_destroy(&ft_pool);
......
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