Commit d44504d7 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

fix an error case that was confusing the optimization, which broke the build


git-svn-id: file:///svn/toku/tokudb@49874 c7de825b-a66e-492c-adef-691d508d4ae1
parent ba5f6504
...@@ -2520,7 +2520,7 @@ serialize_rollback_log_node_to_buf(ROLLBACK_LOG_NODE log, char *buf, size_t calc ...@@ -2520,7 +2520,7 @@ serialize_rollback_log_node_to_buf(ROLLBACK_LOG_NODE log, char *buf, size_t calc
} }
// TODO: can't fail. assert on ENOMEM for compressed_buf... // TODO: can't fail. assert on ENOMEM for compressed_buf...
static int static void
serialize_uncompressed_block_to_memory(char * uncompressed_buf, serialize_uncompressed_block_to_memory(char * uncompressed_buf,
int n_sub_blocks, int n_sub_blocks,
struct sub_block sub_block[/*n_sub_blocks*/], struct sub_block sub_block[/*n_sub_blocks*/],
...@@ -2532,9 +2532,6 @@ serialize_uncompressed_block_to_memory(char * uncompressed_buf, ...@@ -2532,9 +2532,6 @@ serialize_uncompressed_block_to_memory(char * uncompressed_buf,
size_t sub_block_header_len = sub_block_header_size(n_sub_blocks); size_t sub_block_header_len = sub_block_header_size(n_sub_blocks);
size_t header_len = node_header_overhead + sub_block_header_len + sizeof (uint32_t); // node + sub_block + checksum size_t header_len = node_header_overhead + sub_block_header_len + sizeof (uint32_t); // node + sub_block + checksum
char *XMALLOC_N(header_len + compressed_len, compressed_buf); char *XMALLOC_N(header_len + compressed_len, compressed_buf);
if (compressed_buf == NULL) {
return get_error_errno();
}
// copy the header // copy the header
memcpy(compressed_buf, uncompressed_buf, node_header_overhead); memcpy(compressed_buf, uncompressed_buf, node_header_overhead);
...@@ -2566,8 +2563,6 @@ serialize_uncompressed_block_to_memory(char * uncompressed_buf, ...@@ -2566,8 +2563,6 @@ serialize_uncompressed_block_to_memory(char * uncompressed_buf,
*n_bytes_to_write = header_len + compressed_len; *n_bytes_to_write = header_len + compressed_len;
*bytes_to_write = compressed_buf; *bytes_to_write = compressed_buf;
return 0;
} }
...@@ -2613,13 +2608,10 @@ toku_serialize_rollback_log_to (int fd, ROLLBACK_LOG_NODE log, SERIALIZED_ROLLBA ...@@ -2613,13 +2608,10 @@ toku_serialize_rollback_log_to (int fd, ROLLBACK_LOG_NODE log, SERIALIZED_ROLLBA
} }
BLOCKNUM blocknum = serialized_log->blocknum; BLOCKNUM blocknum = serialized_log->blocknum;
{ //Compress and malloc buffer to write
//Compress and malloc buffer to write serialize_uncompressed_block_to_memory(serialized_log->data,
int r = serialize_uncompressed_block_to_memory(serialized_log->data, serialized_log->n_sub_blocks, serialized_log->sub_block,
serialized_log->n_sub_blocks, serialized_log->sub_block, h->h->compression_method, &n_to_write, &compressed_buf);
h->h->compression_method, &n_to_write, &compressed_buf);
if (r!=0) return r;
}
{ {
lazy_assert(blocknum.b>=0); lazy_assert(blocknum.b>=0);
......
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