Commit 8a00b404 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

refs #5947 replace update base128 code with ft vlq code

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@52787 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5d3b5955
......@@ -681,7 +681,8 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
// construct the update message
tokudb::buffer update_message;
update_message.append_uint32(UPDATE_OP_UPDATE_2);
uint8_t op = UPDATE_OP_UPDATE_2;
update_message.append(&op, sizeof op);
uint32_t num_updates = update_fields.elements;
uint num_varchars = 0, num_blobs = 0;
......@@ -834,7 +835,8 @@ int ha_tokudb::send_upsert_message(THD *thd, List<Item> &update_fields, List<Ite
tokudb::buffer update_message;
// append the operation
update_message.append_uint32(UPDATE_OP_UPSERT_2);
uint8_t op = UPDATE_OP_UPSERT_2;
update_message.append(&op, sizeof op);
// append the row
update_message.append_uint32(row.size);
......
......@@ -1529,8 +1529,9 @@ static int tokudb_update_2_fun(
{
tokudb::buffer extra_val(extra->data, 0, extra->size);
uint32_t operation = extra_val.consume_uint32();
assert(operation == UPDATE_OP_UPDATE_2);
uint8_t op;
extra_val.consume(&op, sizeof op);
assert(op == UPDATE_OP_UPDATE_2);
if (old_val_dbt != NULL) {
tokudb::buffer old_val(old_val_dbt->data, old_val_dbt->size, old_val_dbt->size);
......@@ -1567,8 +1568,9 @@ static int tokudb_upsert_2_fun(
{
tokudb::buffer extra_val(extra->data, 0, extra->size);
uint32_t operation = extra_val.consume_uint32();
assert(operation == UPDATE_OP_UPSERT_2);
uint8_t op;
extra_val.consume(&op, sizeof op);
assert(op == UPDATE_OP_UPSERT_2);
uint32_t insert_length = extra_val.consume_uint32();
assert(insert_length < extra_val.limit());
......@@ -1645,6 +1647,7 @@ int tokudb_update_fun(
error = tokudb_upsert_2_fun(db, key, old_val, extra, set_val, set_extra);
break;
default:
assert(0);
error = EINVAL;
break;
}
......
......@@ -5,16 +5,12 @@ namespace tokudb {
static size_t base128_encode_uint32(uint32_t n, void *p, size_t s) {
unsigned char *pp = (unsigned char *)p;
uint i = 0;
while (i < s) {
uint32_t m = n & 127;
n >>= 7;
if (n != 0)
m |= 128;
pp[i++] = m;
if (n == 0)
break;
size_t i = 0;
while (n >= 128) {
pp[i++] = n%128;
n = n/128;
}
pp[i++] = 128+n;
return i;
}
......@@ -23,10 +19,10 @@ namespace tokudb {
uint32_t n = 0;
uint i = 0;
while (i < s) {
uint m = pp[i];
unsigned char m = pp[i];
n |= (m & 127) << 7*i;
i++;
if ((m & 128) == 0)
if ((m & 128) != 0)
break;
}
*np = n;
......
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