Loading newbrt/ule.c +10 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,11 @@ msg_init_empty_ule(ULE ule, BRT_MSG msg) { ule_init_empty_ule(ule, keylen, keyp); } static void update_ule_key(ULE ule, BRT_MSG msg) { ule->keylen = brt_msg_get_keylen(msg); ule->keyp = brt_msg_get_key(msg); } // Purpose is to modify the unpacked leafentry in our private workspace. // Loading @@ -446,6 +451,11 @@ msg_modify_ule(ULE ule, BRT_MSG msg) { //fall through to BRT_INSERT on purpose. } case BRT_INSERT: { // even though the keys of the ule and the msg should techinically // be the same as far as comparison goes, tickets #4618 and #4631 // show why this is necessary. We need to update the key with the exact // bytes of the message update_ule_key(ule, msg); u_int32_t vallen = brt_msg_get_vallen(msg); invariant(IS_VALID_LEN(vallen)); void * valp = brt_msg_get_val(msg); Loading src/ydb_write.c +4 −1 Original line number Diff line number Diff line Loading @@ -682,6 +682,9 @@ env_update_multiple(DB_ENV *env, DB *src_db, DB_TXN *txn, } toku_dbt_cmp cmpfun = toku_db_get_compare_fun(db); BOOL key_eq = cmpfun(db, &curr_old_key, &curr_new_key) == 0; BOOL key_bytes_eq = (curr_old_key.size == curr_new_key.size && (memcmp(curr_old_key.data, curr_new_key.data, curr_old_key.size) == 0) ); if (!key_eq) { //Check overwrite constraints only in the case where // the keys are not equal. Loading Loading @@ -711,7 +714,7 @@ env_update_multiple(DB_ENV *env, DB *src_db, DB_TXN *txn, // we take a shortcut and avoid generating the old val // we assume that any new vals with size > 0 are different than the old val // if (!key_eq || !(dbt_cmp(&vals[which_db], &vals[which_db + num_dbs]) == 0)) { if (!key_eq || curr_new_val.size > 0) { if (!key_bytes_eq || curr_new_val.size > 0) { r = db_put_check_size_constraints(db, &curr_new_key, &curr_new_val); if (r != 0) goto cleanup; Loading Loading
newbrt/ule.c +10 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,11 @@ msg_init_empty_ule(ULE ule, BRT_MSG msg) { ule_init_empty_ule(ule, keylen, keyp); } static void update_ule_key(ULE ule, BRT_MSG msg) { ule->keylen = brt_msg_get_keylen(msg); ule->keyp = brt_msg_get_key(msg); } // Purpose is to modify the unpacked leafentry in our private workspace. // Loading @@ -446,6 +451,11 @@ msg_modify_ule(ULE ule, BRT_MSG msg) { //fall through to BRT_INSERT on purpose. } case BRT_INSERT: { // even though the keys of the ule and the msg should techinically // be the same as far as comparison goes, tickets #4618 and #4631 // show why this is necessary. We need to update the key with the exact // bytes of the message update_ule_key(ule, msg); u_int32_t vallen = brt_msg_get_vallen(msg); invariant(IS_VALID_LEN(vallen)); void * valp = brt_msg_get_val(msg); Loading
src/ydb_write.c +4 −1 Original line number Diff line number Diff line Loading @@ -682,6 +682,9 @@ env_update_multiple(DB_ENV *env, DB *src_db, DB_TXN *txn, } toku_dbt_cmp cmpfun = toku_db_get_compare_fun(db); BOOL key_eq = cmpfun(db, &curr_old_key, &curr_new_key) == 0; BOOL key_bytes_eq = (curr_old_key.size == curr_new_key.size && (memcmp(curr_old_key.data, curr_new_key.data, curr_old_key.size) == 0) ); if (!key_eq) { //Check overwrite constraints only in the case where // the keys are not equal. Loading Loading @@ -711,7 +714,7 @@ env_update_multiple(DB_ENV *env, DB *src_db, DB_TXN *txn, // we take a shortcut and avoid generating the old val // we assume that any new vals with size > 0 are different than the old val // if (!key_eq || !(dbt_cmp(&vals[which_db], &vals[which_db + num_dbs]) == 0)) { if (!key_eq || curr_new_val.size > 0) { if (!key_bytes_eq || curr_new_val.size > 0) { r = db_put_check_size_constraints(db, &curr_new_key, &curr_new_val); if (r != 0) goto cleanup; Loading