mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
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
This commit is contained in:
parent
a7d60e5577
commit
98b45ab5cf
3 changed files with 26 additions and 12 deletions
|
@ -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_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
|
||||
int
|
||||
deserialize_ft_from_fd_into_rbuf(int fd,
|
||||
|
|
|
@ -2749,7 +2749,7 @@ deserialize_rollback_log_from_rbuf_versioned (u_int32_t version, BLOCKNUM blockn
|
|||
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) {
|
||||
toku_trace("decompress");
|
||||
int r = 0;
|
||||
|
|
|
@ -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.
|
||||
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) {
|
||||
failure++;
|
||||
}
|
||||
|
@ -344,7 +353,7 @@ check_block_table(int fd, BLOCK_TABLE bt, struct ft *h)
|
|||
true,
|
||||
true);
|
||||
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);
|
||||
|
@ -362,13 +371,13 @@ check_args(int argc)
|
|||
{
|
||||
int r = 0;
|
||||
if (argc < 3 || argc > 4) {
|
||||
printf("ERROR: ");
|
||||
printf("Too few arguments.\n");
|
||||
printf("USAGE:\n");
|
||||
printf(" verify_block_checksum");
|
||||
printf(" DICTIONARY_FILE OUTPUT_FILE [PERCENTAGE]\n");
|
||||
printf(" [PERCENTAGE] is optional.\n");
|
||||
r = 1;
|
||||
printf("ERROR: ");
|
||||
printf("Too few arguments.\n");
|
||||
printf("USAGE:\n");
|
||||
printf(" verify_block_checksum");
|
||||
printf(" DICTIONARY_FILE OUTPUT_FILE [PERCENTAGE]\n");
|
||||
printf(" [PERCENTAGE] is optional.\n");
|
||||
r = 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -383,7 +392,7 @@ main(int argc, char *argv[])
|
|||
char *dictfname, *outfname;
|
||||
r = check_args(argc);
|
||||
if (r) {
|
||||
goto exit;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
assert(argc == 3 || argc == 4);
|
||||
|
@ -429,7 +438,7 @@ main(int argc, char *argv[])
|
|||
check_block_table(dictfd, h2->blocktable, h2);
|
||||
}
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue