Commit 5e4c3495 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #860

Removed extra mallocs and memcopies for toku_c_get
when the dbts use anything other than DB_DBT_USERMEM

git-svn-id: file:///svn/tokudb@4121 c7de825b-a66e-492c-adef-691d508d4ae1
parent 96d3b94b
...@@ -2711,19 +2711,15 @@ static int brt_search_leaf_node(BRT brt, BRTNODE node, brt_search_t *search, DBT ...@@ -2711,19 +2711,15 @@ static int brt_search_leaf_node(BRT brt, BRTNODE node, brt_search_t *search, DBT
if (!le_is_provdel(le)) goto got_a_good_value; if (!le_is_provdel(le)) goto got_a_good_value;
} }
} }
got_a_good_value: got_a_good_value:
if (newkey && newval) { if (newkey || newval) {
r = toku_dbt_set_two_values(newkey, le_latest_key(le), le_latest_keylen(le), &brt->skey, bytevec key = newkey ? le_latest_key(le) : NULL;
newval, le_latest_val(le), le_latest_vallen(le), &brt->sval); u_int32_t key_len = newkey ? le_latest_keylen(le) : 0;
if (r!=0) return r; bytevec val = newval ? le_latest_val(le) : NULL;
} u_int32_t val_len = newval ? le_latest_vallen(le) : 0;
else if (newkey) { r = toku_dbt_set_two_values(newkey, &key, key_len, &brt->skey, FALSE,
r = toku_dbt_set_value(newkey, le_latest_key(le), le_latest_keylen(le), &brt->skey); newval, &val, val_len, &brt->sval, FALSE);
if (r!=0) return r; if (r!=0) return r;
}
else if (newval) {
r = toku_dbt_set_value(newval, le_latest_val(le), le_latest_vallen(le), &brt->sval);
if (r!=0) return r;
} }
return 0; return 0;
} }
...@@ -2854,8 +2850,8 @@ static inline int brt_cursor_copyout(BRT_CURSOR cursor, DBT *key, DBT *val) { ...@@ -2854,8 +2850,8 @@ static inline int brt_cursor_copyout(BRT_CURSOR cursor, DBT *key, DBT *val) {
int r = 0; int r = 0;
void** key_staticp = cursor->is_temporary_cursor ? &cursor->brt->skey : &cursor->skey; void** key_staticp = cursor->is_temporary_cursor ? &cursor->brt->skey : &cursor->skey;
void** val_staticp = cursor->is_temporary_cursor ? &cursor->brt->sval : &cursor->sval; void** val_staticp = cursor->is_temporary_cursor ? &cursor->brt->sval : &cursor->sval;
r = toku_dbt_set_two_values(key, cursor->key.data, cursor->key.size, key_staticp, r = toku_dbt_set_two_values(key, (bytevec*)&cursor->key.data, cursor->key.size, key_staticp, FALSE,
val, cursor->val.data, cursor->val.size, val_staticp); val, (bytevec*)&cursor->val.data, cursor->val.size, val_staticp, FALSE);
return r; return r;
} }
...@@ -2865,25 +2861,39 @@ static inline int brt_cursor_copyout_with_dat(BRT_CURSOR cursor, DBT *key, DBT * ...@@ -2865,25 +2861,39 @@ static inline int brt_cursor_copyout_with_dat(BRT_CURSOR cursor, DBT *key, DBT *
void** key_staticp = cursor->is_temporary_cursor ? &cursor->brt->skey : &cursor->skey; void** key_staticp = cursor->is_temporary_cursor ? &cursor->brt->skey : &cursor->skey;
void** val_staticp = cursor->is_temporary_cursor ? &cursor->brt->sval : &cursor->sval; void** val_staticp = cursor->is_temporary_cursor ? &cursor->brt->sval : &cursor->sval;
void** dat_staticp = &pdb->sval; void** dat_staticp = &pdb->sval;
r = toku_dbt_set_three_values(key, cursor->key.data, cursor->key.size, key_staticp, r = toku_dbt_set_three_values(key, (bytevec*)&cursor->key.data, cursor->key.size, key_staticp, FALSE,
val, cursor->val.data, cursor->val.size, val_staticp, val, (bytevec*)&cursor->val.data, cursor->val.size, val_staticp, FALSE,
dat, dat_source->data, dat_source->size, dat_staticp); dat, (bytevec*)&dat_source->data, dat_source->size, dat_staticp, FALSE);
return r; return r;
} }
int toku_brt_cursor_copyout_with_dat(BRT_CURSOR cursor, DBT *key, DBT *val, int toku_brt_dbt_set(DBT* key, DBT* key_source) {
BRT pdb, DBT* dat, DBT* dat_source) { int r = toku_dbt_set_value(key, (bytevec*)&key_source->data, key_source->size, NULL, FALSE);
int r = brt_cursor_copyout_with_dat(cursor, key, val, pdb, dat, dat_source);
return r; return r;
} }
int toku_brt_cursor_copyout(BRT_CURSOR cursor, DBT *key, DBT *val) { int toku_brt_cursor_dbts_set(BRT_CURSOR cursor,
int r = brt_cursor_copyout(cursor, key, val); DBT* key, DBT* key_source, BOOL key_disposable,
DBT* val, DBT* val_source, BOOL val_disposable) {
void** key_staticp = cursor->is_temporary_cursor ? &cursor->brt->skey : &cursor->skey;
void** val_staticp = cursor->is_temporary_cursor ? &cursor->brt->sval : &cursor->sval;
int r;
r = toku_dbt_set_two_values(key, (bytevec*)&key_source->data, key_source->size, key_staticp, key_disposable,
val, (bytevec*)&val_source->data, val_source->size, val_staticp, val_disposable);
return r; return r;
} }
int toku_brt_dbt_set(DBT* key, DBT* key_source) { int toku_brt_cursor_dbts_set_with_dat(BRT_CURSOR cursor, BRT pdb,
int r = toku_dbt_set_value(key, key_source->data, key_source->size, NULL); DBT* key, DBT* key_source, BOOL key_disposable,
DBT* val, DBT* val_source, BOOL val_disposable,
DBT* dat, DBT* dat_source, BOOL dat_disposable) {
void** key_staticp = cursor->is_temporary_cursor ? &cursor->brt->skey : &cursor->skey;
void** val_staticp = cursor->is_temporary_cursor ? &cursor->brt->sval : &cursor->sval;
void** dat_staticp = &pdb->sval;
int r;
r = toku_dbt_set_three_values(key, (bytevec*)&key_source->data, key_source->size, key_staticp, key_disposable,
val, (bytevec*)&val_source->data, val_source->size, val_staticp, val_disposable,
dat, (bytevec*)&dat_source->data, dat_source->size, dat_staticp, dat_disposable);
return r; return r;
} }
......
...@@ -60,10 +60,14 @@ extern int toku_brt_do_push_cmd; // control whether push occurs eagerly. ...@@ -60,10 +60,14 @@ extern int toku_brt_do_push_cmd; // control whether push occurs eagerly.
int toku_brt_dbt_set(DBT* key, DBT* key_source); int toku_brt_dbt_set(DBT* key, DBT* key_source);
int toku_brt_cursor_copyout(BRT_CURSOR cursor, DBT *key, DBT *val); int toku_brt_cursor_dbts_set(BRT_CURSOR cursor,
int toku_brt_cursor_copyout_with_dat(BRT_CURSOR cursor, DBT *key, DBT *val, DBT* key, DBT* key_source, BOOL key_disposable,
BRT pdb, DBT* dat, DBT* dat_source); DBT* val, DBT* val_source, BOOL val_disposable);
int toku_brt_cursor_dbts_set_with_dat(BRT_CURSOR cursor, BRT pdb,
DBT* key, DBT* key_source, BOOL key_disposable,
DBT* val, DBT* val_source, BOOL val_disposable,
DBT* dat, DBT* dat_source, BOOL dat_disposable);
int toku_brt_get_fd(BRT, int *); int toku_brt_get_fd(BRT, int *);
int toku_brt_height_of_root(BRT, int *height); // for an open brt, return the current height. int toku_brt_height_of_root(BRT, int *height); // for an open brt, return the current height.
......
...@@ -13,14 +13,17 @@ static void ybt_test0 (void) { ...@@ -13,14 +13,17 @@ static void ybt_test0 (void) {
DBT t0,t1; DBT t0,t1;
toku_init_dbt(&t0); toku_init_dbt(&t0);
toku_init_dbt(&t1); toku_init_dbt(&t1);
toku_dbt_set_value(&t0, "hello", 6, &v0); char* temp1 = "hello";
toku_dbt_set_value(&t1, "foo", 4, &v1); toku_dbt_set_value(&t0, (bytevec*)&temp1, 6, &v0, FALSE);
char* temp2 = "foo";
toku_dbt_set_value(&t1, (bytevec*)&temp2, 4, &v1, FALSE);
assert(t0.size==6); assert(t0.size==6);
assert(strcmp(t0.data, "hello")==0); assert(strcmp(t0.data, "hello")==0);
assert(t1.size==4); assert(t1.size==4);
assert(strcmp(t1.data, "foo")==0); assert(strcmp(t1.data, "foo")==0);
toku_dbt_set_value(&t1, "byebye", 7, &v0); /* Use v0, not v1 */ char* temp3 = "byebye";
toku_dbt_set_value(&t1, (bytevec*)&temp3, 7, &v0, FALSE); /* Use v0, not v1 */
// This assertion would be wrong, since v0 may have been realloc'd, and t0.data may now point // This assertion would be wrong, since v0 may have been realloc'd, and t0.data may now point
// at the wrong place // at the wrong place
//assert(strcmp(t0.data, "byebye")==0); /* t0's data should be changed too, since it used v0 */ //assert(strcmp(t0.data, "byebye")==0); /* t0's data should be changed too, since it used v0 */
...@@ -33,7 +36,8 @@ static void ybt_test0 (void) { ...@@ -33,7 +36,8 @@ static void ybt_test0 (void) {
toku_init_dbt(&t0); toku_init_dbt(&t0);
t0.flags = DB_DBT_USERMEM; t0.flags = DB_DBT_USERMEM;
t0.ulen = 0; t0.ulen = 0;
toku_dbt_set_value(&t0, "hello", 6, 0); char* temp4 = "hello";
toku_dbt_set_value(&t0, (bytevec*)&temp4, 6, 0, FALSE);
assert(t0.data==0); assert(t0.data==0);
assert(t0.size==6); assert(t0.size==6);
...@@ -41,12 +45,14 @@ static void ybt_test0 (void) { ...@@ -41,12 +45,14 @@ static void ybt_test0 (void) {
toku_init_dbt(&t0); toku_init_dbt(&t0);
t0.flags = DB_DBT_REALLOC; t0.flags = DB_DBT_REALLOC;
v0 = 0; v0 = 0;
toku_dbt_set_value(&t0, "internationalization", 21, &v0); char* temp5 = "internationalization";
toku_dbt_set_value(&t0, (bytevec*)&temp5, 21, &v0, FALSE);
assert(v0==0); /* Didn't change v0 */ assert(v0==0); /* Didn't change v0 */
assert(t0.size==21); assert(t0.size==21);
assert(strcmp(t0.data, "internationalization")==0); assert(strcmp(t0.data, "internationalization")==0);
toku_dbt_set_value(&t0, "provincial", 11, &v0); char* temp6 = "provincial";
toku_dbt_set_value(&t0, (bytevec*)&temp6, 11, &v0, FALSE);
assert(t0.size==11); assert(t0.size==11);
assert(strcmp(t0.data, "provincial")==0); assert(strcmp(t0.data, "provincial")==0);
......
...@@ -16,7 +16,7 @@ DBT *toku_fill_dbt(DBT *dbt, bytevec k, ITEMLEN len) { ...@@ -16,7 +16,7 @@ DBT *toku_fill_dbt(DBT *dbt, bytevec k, ITEMLEN len) {
return dbt; return dbt;
} }
static inline int dbt_set_preprocess(DBT* ybt, ITEMLEN len, void** staticptrp, void** tmp_data) { static inline int dbt_set_preprocess(DBT* ybt, ITEMLEN len, void** staticptrp, void** tmp_data, BOOL input_disposable) {
int r = ENOSYS; int r = ENOSYS;
if (ybt) { if (ybt) {
if (ybt->flags==DB_DBT_USERMEM) { if (ybt->flags==DB_DBT_USERMEM) {
...@@ -28,8 +28,10 @@ static inline int dbt_set_preprocess(DBT* ybt, ITEMLEN len, void** staticptrp, v ...@@ -28,8 +28,10 @@ static inline int dbt_set_preprocess(DBT* ybt, ITEMLEN len, void** staticptrp, v
} }
else if (ybt->flags==DB_DBT_MALLOC || ybt->flags==DB_DBT_REALLOC || ybt->flags==0) { else if (ybt->flags==DB_DBT_MALLOC || ybt->flags==DB_DBT_REALLOC || ybt->flags==0) {
if (ybt->flags==0 && staticptrp==NULL) { r = -1; goto cleanup; } if (ybt->flags==0 && staticptrp==NULL) { r = -1; goto cleanup; }
*tmp_data = toku_malloc(len); if (!input_disposable) {
if (!*tmp_data && len > 0) { r = errno; goto cleanup; } *tmp_data = toku_malloc(len);
if (!*tmp_data && len > 0) { r = errno; goto cleanup; }
}
} }
else { r = EINVAL; goto cleanup; } else { r = EINVAL; goto cleanup; }
} }
...@@ -38,41 +40,47 @@ static inline int dbt_set_preprocess(DBT* ybt, ITEMLEN len, void** staticptrp, v ...@@ -38,41 +40,47 @@ static inline int dbt_set_preprocess(DBT* ybt, ITEMLEN len, void** staticptrp, v
return r; return r;
} }
static inline void dbt_set_copy(DBT* ybt, bytevec data, ITEMLEN len, void** staticptrp, void* tmp_data) { static inline void dbt_set_copy(DBT* ybt, bytevec* datap, ITEMLEN len, void** staticptrp, void** tmp_data, BOOL input_disposable) {
if (ybt) { if (ybt) {
bytevec data = *datap;
if (ybt->flags==DB_DBT_USERMEM) input_disposable = FALSE;
else if (input_disposable) {
*tmp_data = (void*)data;
*datap = NULL;
}
if (ybt->flags==DB_DBT_REALLOC && ybt->data) toku_free(ybt->data); if (ybt->flags==DB_DBT_REALLOC && ybt->data) toku_free(ybt->data);
else if (ybt->flags==0) { else if (ybt->flags==0) {
if (*staticptrp) toku_free(*staticptrp); if (*staticptrp) toku_free(*staticptrp);
*staticptrp = tmp_data; *staticptrp = *tmp_data;
} }
if (ybt->flags!=DB_DBT_USERMEM) { if (ybt->flags!=DB_DBT_USERMEM) {
if (ybt->flags!=0 || len>0) ybt->data = tmp_data; if (ybt->flags!=0 || len>0) ybt->data = *tmp_data;
else ybt->data = NULL; else ybt->data = NULL;
} }
if ((ybt->size = len) > 0) memcpy(ybt->data, data, (size_t)len); if ((ybt->size = len) > 0 && !input_disposable) memcpy(ybt->data, data, (size_t)len);
} }
} }
/* Atomically set three dbts, such that they either both succeed, or /* Atomically set three dbts, such that they either both succeed, or
* there is no side effect. */ * there is no side effect. */
int toku_dbt_set_three_values( int toku_dbt_set_three_values(
DBT* ybt1, bytevec ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp, DBT* ybt1, bytevec* ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp, BOOL ybt1_disposable,
DBT* ybt2, bytevec ybt2_data, ITEMLEN ybt2_len, void** ybt2_staticptrp, DBT* ybt2, bytevec* ybt2_data, ITEMLEN ybt2_len, void** ybt2_staticptrp, BOOL ybt2_disposable,
DBT* ybt3, bytevec ybt3_data, ITEMLEN ybt3_len, void** ybt3_staticptrp) { DBT* ybt3, bytevec* ybt3_data, ITEMLEN ybt3_len, void** ybt3_staticptrp, BOOL ybt3_disposable) {
int r = ENOSYS; int r = ENOSYS;
void* tmp_ybt1_data = NULL; void* tmp_ybt1_data = NULL;
void* tmp_ybt2_data = NULL; void* tmp_ybt2_data = NULL;
void* tmp_ybt3_data = NULL; void* tmp_ybt3_data = NULL;
/* Do all mallocs and check for all possible errors. */ /* Do all mallocs and check for all possible errors. */
if ((r = dbt_set_preprocess(ybt1, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data))) goto cleanup; if ((r = dbt_set_preprocess(ybt1, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data, ybt1_disposable))) goto cleanup;
if ((r = dbt_set_preprocess(ybt2, ybt2_len, ybt2_staticptrp, &tmp_ybt2_data))) goto cleanup; if ((r = dbt_set_preprocess(ybt2, ybt2_len, ybt2_staticptrp, &tmp_ybt2_data, ybt2_disposable))) goto cleanup;
if ((r = dbt_set_preprocess(ybt3, ybt3_len, ybt3_staticptrp, &tmp_ybt3_data))) goto cleanup; if ((r = dbt_set_preprocess(ybt3, ybt3_len, ybt3_staticptrp, &tmp_ybt3_data, ybt3_disposable))) goto cleanup;
/* Copy/modify atomically the dbts. */ /* Copy/modify atomically the dbts. */
dbt_set_copy(ybt1, ybt1_data, ybt1_len, ybt1_staticptrp, tmp_ybt1_data); dbt_set_copy(ybt1, ybt1_data, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data, ybt1_disposable);
dbt_set_copy(ybt2, ybt2_data, ybt2_len, ybt2_staticptrp, tmp_ybt2_data); dbt_set_copy(ybt2, ybt2_data, ybt2_len, ybt2_staticptrp, &tmp_ybt2_data, ybt2_disposable);
dbt_set_copy(ybt3, ybt3_data, ybt3_len, ybt3_staticptrp, tmp_ybt3_data); dbt_set_copy(ybt3, ybt3_data, ybt3_len, ybt3_staticptrp, &tmp_ybt3_data, ybt3_disposable);
r = 0; r = 0;
cleanup: cleanup:
...@@ -87,19 +95,19 @@ int toku_dbt_set_three_values( ...@@ -87,19 +95,19 @@ int toku_dbt_set_three_values(
/* Atomically set two dbts, such that they either both succeed, or /* Atomically set two dbts, such that they either both succeed, or
* there is no side effect. */ * there is no side effect. */
int toku_dbt_set_two_values( int toku_dbt_set_two_values(
DBT* ybt1, bytevec ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp, DBT* ybt1, bytevec *ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp, BOOL ybt1_disposable,
DBT* ybt2, bytevec ybt2_data, ITEMLEN ybt2_len, void** ybt2_staticptrp) { DBT* ybt2, bytevec *ybt2_data, ITEMLEN ybt2_len, void** ybt2_staticptrp, BOOL ybt2_disposable) {
int r = ENOSYS; int r = ENOSYS;
void* tmp_ybt1_data = NULL; void* tmp_ybt1_data = NULL;
void* tmp_ybt2_data = NULL; void* tmp_ybt2_data = NULL;
/* Do all mallocs and check for all possible errors. */ /* Do all mallocs and check for all possible errors. */
if ((r = dbt_set_preprocess(ybt1, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data))) goto cleanup; if ((r = dbt_set_preprocess(ybt1, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data, ybt1_disposable))) goto cleanup;
if ((r = dbt_set_preprocess(ybt2, ybt2_len, ybt2_staticptrp, &tmp_ybt2_data))) goto cleanup; if ((r = dbt_set_preprocess(ybt2, ybt2_len, ybt2_staticptrp, &tmp_ybt2_data, ybt2_disposable))) goto cleanup;
/* Copy/modify atomically the dbts. */ /* Copy/modify atomically the dbts. */
dbt_set_copy(ybt1, ybt1_data, ybt1_len, ybt1_staticptrp, tmp_ybt1_data); dbt_set_copy(ybt1, ybt1_data, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data, ybt1_disposable);
dbt_set_copy(ybt2, ybt2_data, ybt2_len, ybt2_staticptrp, tmp_ybt2_data); dbt_set_copy(ybt2, ybt2_data, ybt2_len, ybt2_staticptrp, &tmp_ybt2_data, ybt2_disposable);
r = 0; r = 0;
cleanup: cleanup:
...@@ -110,15 +118,15 @@ int toku_dbt_set_two_values( ...@@ -110,15 +118,15 @@ int toku_dbt_set_two_values(
return r; return r;
} }
int toku_dbt_set_value(DBT* ybt1, bytevec ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp) { int toku_dbt_set_value(DBT* ybt1, bytevec* ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp, BOOL ybt1_disposable) {
int r = ENOSYS; int r = ENOSYS;
void* tmp_ybt1_data = NULL; void* tmp_ybt1_data = NULL;
/* Do all mallocs and check for all possible errors. */ /* Do all mallocs and check for all possible errors. */
if ((r = dbt_set_preprocess(ybt1, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data))) goto cleanup; if ((r = dbt_set_preprocess(ybt1, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data, ybt1_disposable))) goto cleanup;
/* Copy/modify atomically the dbts. */ /* Copy/modify atomically the dbts. */
dbt_set_copy(ybt1, ybt1_data, ybt1_len, ybt1_staticptrp, tmp_ybt1_data); dbt_set_copy(ybt1, ybt1_data, ybt1_len, ybt1_staticptrp, &tmp_ybt1_data, ybt1_disposable);
r = 0; r = 0;
cleanup: cleanup:
......
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
DBT* toku_init_dbt (DBT *); DBT* toku_init_dbt (DBT *);
DBT *toku_fill_dbt(DBT *dbt, bytevec k, ITEMLEN len); DBT *toku_fill_dbt(DBT *dbt, bytevec k, ITEMLEN len);
int toku_dbt_set_value (DBT *, bytevec val, ITEMLEN vallen, void **staticptrp); int toku_dbt_set_value (DBT *, bytevec *val, ITEMLEN vallen, void **staticptrp, BOOL ybt1_disposable);
int toku_dbt_set_two_values(DBT* key, bytevec key_data, ITEMLEN key_len, void** key_staticptrp, int toku_dbt_set_two_values(DBT* key, bytevec *key_data, ITEMLEN key_len, void** key_staticptrp, BOOL key_disposable,
DBT* val, bytevec val_data, ITEMLEN val_len, void** val_staticptrp); DBT* val, bytevec *val_data, ITEMLEN val_len, void** val_staticptrp, BOOL val_disposable);
int toku_dbt_set_three_values( int toku_dbt_set_three_values(
DBT* ybt1, bytevec ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp, DBT* ybt1, bytevec *ybt1_data, ITEMLEN ybt1_len, void** ybt1_staticptrp, BOOL ybt1_disposable,
DBT* ybt2, bytevec ybt2_data, ITEMLEN ybt2_len, void** ybt2_staticptrp, DBT* ybt2, bytevec *ybt2_data, ITEMLEN ybt2_len, void** ybt2_staticptrp, BOOL ybt2_disposable,
DBT* ybt3, bytevec ybt3_data, ITEMLEN ybt3_len, void** ybt3_staticptrp); DBT* ybt3, bytevec *ybt3_data, ITEMLEN ybt3_len, void** ybt3_staticptrp, BOOL ybt3_disposable);
......
...@@ -1439,8 +1439,10 @@ static int toku_c_pget_assign_outputs(C_GET_VARS* g, DBT* key, DBT* val, DBT* da ...@@ -1439,8 +1439,10 @@ static int toku_c_pget_assign_outputs(C_GET_VARS* g, DBT* key, DBT* val, DBT* da
DBT* write_dat = g->dat_is_write ? dat : NULL; DBT* write_dat = g->dat_is_write ? dat : NULL;
BRT primary = g->db->i->primary->i->brt; BRT primary = g->db->i->primary->i->brt;
r = toku_brt_cursor_copyout_with_dat(g->c->i->c, write_key, write_val, r = toku_brt_cursor_dbts_set_with_dat(g->c->i->c, primary,
primary, write_dat, &g->tmp_dat); write_key, &g->tmp_key, TRUE,
write_val, &g->tmp_val, TRUE,
write_dat, &g->tmp_dat, TRUE);
if (r!=0) goto cleanup; if (r!=0) goto cleanup;
r = 0; r = 0;
cleanup: cleanup:
...@@ -1452,7 +1454,9 @@ static int toku_c_get_assign_outputs(C_GET_VARS* g, DBT* key, DBT* val) { ...@@ -1452,7 +1454,9 @@ static int toku_c_get_assign_outputs(C_GET_VARS* g, DBT* key, DBT* val) {
DBT* write_key = g->key_is_write ? key : NULL; DBT* write_key = g->key_is_write ? key : NULL;
DBT* write_val = g->val_is_write ? val : NULL; DBT* write_val = g->val_is_write ? val : NULL;
r = toku_brt_cursor_copyout(g->c->i->c, write_key, write_val); r = toku_brt_cursor_dbts_set(g->c->i->c,
write_key, &g->tmp_key, TRUE,
write_val, &g->tmp_val, TRUE);
if (r!=0) goto cleanup; if (r!=0) goto cleanup;
r = 0; r = 0;
cleanup: cleanup:
......
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