mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
Addresses #394
Bugfix with the way data was copied out to static buffers. Now (again) copies to cursor's temp storage if it is not a temporary cursor if it is a db handle call, or a temporary cursor, it will use the db's temporary storage. git-svn-id: file:///svn/tokudb@3863 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
6ba33998c5
commit
467c49d564
3 changed files with 29 additions and 54 deletions
56
newbrt/brt.c
56
newbrt/brt.c
|
@ -2525,39 +2525,6 @@ int show_brt_blocknumbers (BRT brt) {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
int toku_brt_dbt_set_both(BRT brt, DBT* key, DBT* key_source,
|
||||
DBT* val, DBT* val_source) {
|
||||
int r = toku_dbt_set_two_values(key, key_source->data, key_source->size, &brt->skey,
|
||||
val, val_source->data, val_source->size, &brt->sval);
|
||||
return r;
|
||||
}
|
||||
|
||||
int toku_brt_dbt_set_three(BRT brt_primary, BRT brt_secondary,
|
||||
DBT* key, DBT* key_source,
|
||||
DBT* pkey, DBT* pkey_source,
|
||||
DBT* val, DBT* val_source) {
|
||||
int r = toku_dbt_set_three_values(key, key_source->data, key_source->size, &brt_secondary->skey,
|
||||
pkey, pkey_source->data, pkey_source->size, &brt_secondary->sval,
|
||||
val, val_source->data, val_source->size, &brt_primary->sval);
|
||||
return r;
|
||||
}
|
||||
|
||||
int toku_brt_dbt_set(DBT* key, DBT* key_source) {
|
||||
int r = toku_dbt_set_value(key, key_source->data, key_source->size, NULL);
|
||||
return r;
|
||||
}
|
||||
|
||||
int toku_brt_dbt_set_key(BRT brt, DBT* key, DBT* key_source) {
|
||||
int r = toku_dbt_set_value(key, key_source->data, key_source->size, &brt->skey);
|
||||
return r;
|
||||
}
|
||||
|
||||
int toku_brt_dbt_set_val(BRT brt, DBT* val, DBT* val_source) {
|
||||
int r = toku_dbt_set_value(val, val_source->data, val_source->size, &brt->sval);
|
||||
return r;
|
||||
}
|
||||
|
||||
typedef struct brt_split {
|
||||
int did_split;
|
||||
BRTNODE nodea;
|
||||
|
@ -2872,11 +2839,34 @@ static inline int brt_cursor_copyout(BRT_CURSOR cursor, DBT *key, DBT *val) {
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline int brt_cursor_copyout_with_dat(BRT_CURSOR cursor, DBT *key, DBT *val,
|
||||
BRT pdb, DBT* dat, DBT* dat_source) {
|
||||
int r = 0;
|
||||
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;
|
||||
r = toku_dbt_set_three_values(key, cursor->key.data, cursor->key.size, key_staticp,
|
||||
val, cursor->val.data, cursor->val.size, val_staticp,
|
||||
dat, dat_source->data, dat_source->size, dat_staticp);
|
||||
return r;
|
||||
}
|
||||
|
||||
int toku_brt_cursor_copyout_with_dat(BRT_CURSOR cursor, DBT *key, DBT *val,
|
||||
BRT pdb, DBT* dat, DBT* dat_source) {
|
||||
int r = brt_cursor_copyout_with_dat(cursor, key, val, pdb, dat, dat_source);
|
||||
return r;
|
||||
}
|
||||
|
||||
int toku_brt_cursor_copyout(BRT_CURSOR cursor, DBT *key, DBT *val) {
|
||||
int r = brt_cursor_copyout(cursor, key, val);
|
||||
return r;
|
||||
}
|
||||
|
||||
int toku_brt_dbt_set(DBT* key, DBT* key_source) {
|
||||
int r = toku_dbt_set_value(key, key_source->data, key_source->size, NULL);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Used to save the state of a cursor. */
|
||||
int brt_cursor_save_key_val(BRT_CURSOR cursor, DBT* key, DBT* val) {
|
||||
if (brt_cursor_not_set(cursor)) {
|
||||
|
|
10
newbrt/brt.h
10
newbrt/brt.h
|
@ -59,16 +59,10 @@ int brtenv_checkpoint (BRTENV env);
|
|||
extern int toku_brt_do_push_cmd; // control whether push occurs eagerly.
|
||||
|
||||
|
||||
int toku_brt_dbt_set_three(BRT brt_primary, BRT brt_secondary,
|
||||
DBT* key, DBT* key_source,
|
||||
DBT* pkey, DBT* pkey_source,
|
||||
DBT* val, DBT* val_source);
|
||||
int toku_brt_dbt_set_both(BRT brt, DBT* key, DBT* key_source,
|
||||
DBT* val, DBT* val_source);
|
||||
int toku_brt_dbt_set_key(BRT brt, DBT* key, DBT* key_source);
|
||||
int toku_brt_dbt_set_val(BRT brt, DBT* val, DBT* val_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_copyout_with_dat(BRT_CURSOR cursor, DBT *key, DBT *val,
|
||||
BRT pdb, DBT* dat, DBT* dat_source);
|
||||
|
||||
int toku_brt_get_fd(BRT, int *);
|
||||
|
||||
|
|
17
src/ydb.c
17
src/ydb.c
|
@ -1427,17 +1427,10 @@ static int toku_c_pget_assign_outputs(C_GET_VARS* g, DBT* key, DBT* val, DBT* da
|
|||
DBT* write_key = g->key_is_write ? key : NULL;
|
||||
DBT* write_val = g->val_is_write ? val : NULL;
|
||||
DBT* write_dat = g->dat_is_write ? dat : NULL;
|
||||
BRT primary = g->db->i->primary->i->brt;
|
||||
|
||||
/* In the case of a non-associated database, we call it a
|
||||
* 'secondary' here. */
|
||||
DB* pdb = g->db->i->primary;
|
||||
BRT primary = pdb ? pdb->i->brt : NULL;
|
||||
BRT secondary = g->db->i->brt;
|
||||
|
||||
r = toku_brt_dbt_set_three(primary, secondary,
|
||||
write_key, &g->tmp_key,
|
||||
write_val, &g->tmp_val,
|
||||
write_dat, &g->tmp_dat);
|
||||
r = toku_brt_cursor_copyout_with_dat(g->c->i->c, write_key, write_val,
|
||||
primary, write_dat, &g->tmp_dat);
|
||||
if (r!=0) goto cleanup;
|
||||
r = 0;
|
||||
cleanup:
|
||||
|
@ -1449,9 +1442,7 @@ 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_val = g->val_is_write ? val : NULL;
|
||||
|
||||
r = toku_brt_dbt_set_both(g->db->i->brt,
|
||||
write_key, &g->tmp_key,
|
||||
write_val, &g->tmp_val);
|
||||
r = toku_brt_cursor_copyout(g->c->i->c, write_key, write_val);
|
||||
if (r!=0) goto cleanup;
|
||||
r = 0;
|
||||
cleanup:
|
||||
|
|
Loading…
Add table
Reference in a new issue