Loading newbrt/brt-internal.h +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ unsigned int toku_bnc_nbytesinbuf(NONLEAF_CHILDINFO bnc); int toku_bnc_n_entries(NONLEAF_CHILDINFO bnc); long toku_bnc_memory_size(NONLEAF_CHILDINFO bnc); long toku_bnc_memory_used(NONLEAF_CHILDINFO bnc); int toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, int type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp); int toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp); void toku_bnc_empty(NONLEAF_CHILDINFO bnc); int toku_bnc_flush_to_child( brt_compare_func compare_fun, Loading Loading @@ -485,7 +485,7 @@ void bring_node_fully_into_memory(BRTNODE node, struct brt_header* h); void toku_brt_nonleaf_append_child(BRTNODE node, BRTNODE child, struct kv_pair *pivotkey, size_t pivotkeysize); // append a cmd to a nonleaf node child buffer void toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, int type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val); void toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val); // Mark a node as dirty and update statistics in header. // Other than the node's constructor, this should be the ONLY place Loading newbrt/brt-verify.c +4 −2 Original line number Diff line number Diff line Loading @@ -52,15 +52,17 @@ compare_pair_to_key (BRT brt, struct kv_pair *a, bytevec key, ITEMLEN keylen) { } static int verify_msg_in_child_buffer(BRT brt, int type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) verify_msg_in_child_buffer(BRT brt, enum brt_msg_type type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) __attribute__((warn_unused_result)); static int verify_msg_in_child_buffer(BRT brt, int type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) { verify_msg_in_child_buffer(BRT brt, enum brt_msg_type type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) { int result = 0; if (msn.msn == ZERO_MSN.msn) result = EINVAL; switch (type) { default: break; case BRT_INSERT: case BRT_INSERT_NO_OVERWRITE: case BRT_DELETE_ANY: Loading newbrt/brt.c +6 −7 Original line number Diff line number Diff line Loading @@ -1757,7 +1757,7 @@ toku_fifo_entry_key_msn_cmp(void *extrap, const void *ap, const void *bp) } int toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, int type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp) toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp) // Effect: Enqueue the message represented by the parameters into the // bnc's buffer, and put it in either the fresh or stale message tree, // or the broadcast list. Loading @@ -1768,8 +1768,7 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons long offset; int r = toku_fifo_enq(bnc->buffer, key, keylen, data, datalen, type, msn, xids, is_fresh, &offset); assert_zero(r); enum brt_msg_type etype = (enum brt_msg_type) type; if (brt_msg_type_applies_once(etype)) { if (brt_msg_type_applies_once(type)) { struct toku_fifo_entry_key_msn_heaviside_extra extra = { .desc = desc, .cmp = cmp, .fifo = bnc->buffer, .key = key, .keylen = keylen, .msn = msn }; if (is_fresh) { r = toku_omt_insert(bnc->fresh_message_tree, (OMTVALUE) offset, toku_fifo_entry_key_msn_heaviside, &extra, NULL); Loading @@ -1778,7 +1777,7 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons r = toku_omt_insert(bnc->stale_message_tree, (OMTVALUE) offset, toku_fifo_entry_key_msn_heaviside, &extra, NULL); assert_zero(r); } } else if (brt_msg_type_applies_all(etype) || brt_msg_type_does_nothing(etype)) { } else if (brt_msg_type_applies_all(type) || brt_msg_type_does_nothing(type)) { u_int32_t idx = toku_omt_size(bnc->broadcast_list); r = toku_omt_insert_at(bnc->broadcast_list, (OMTVALUE) offset, idx); assert_zero(r); Loading @@ -1792,7 +1791,7 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons // append a cmd to a nonleaf node's child buffer // should be static, but used by test programs void toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, int type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val) { toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val) { assert(BP_STATE(node,childnum) == PT_AVAIL); int r = toku_bnc_insert_msg(BNC(node, childnum), key->data, key->size, val->data, val->size, type, msn, xids, is_fresh, desc, compare_fun); invariant_zero(r); Loading Loading @@ -2055,7 +2054,7 @@ toku_bnc_flush_to_child( bnc->buffer, key, keylen, val, vallen, type, msn, xids, is_fresh, ({ DBT hk,hv; BRT_MSG_S brtcmd = { (enum brt_msg_type)type, msn, xids, .u.id= {toku_fill_dbt(&hk, key, keylen), BRT_MSG_S brtcmd = { type, msn, xids, .u.id= {toku_fill_dbt(&hk, key, keylen), toku_fill_dbt(&hv, val, vallen)} }; brtnode_put_cmd( compare_fun, Loading Loading @@ -4383,7 +4382,7 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, if (entry->msn.msn > bn->max_msn_applied.msn) { ITEMLEN keylen = entry->keylen; ITEMLEN vallen = entry->vallen; enum brt_msg_type type = (enum brt_msg_type)entry->type; enum brt_msg_type type = fifo_entry_get_msg_type(entry); MSN msn = entry->msn; const XIDS xids = (XIDS) &entry->xids_s; bytevec key = xids_get_end_of_array(xids); Loading newbrt/fifo.c +5 −5 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ void toku_fifo_size_hint(FIFO fifo, size_t size) { } } int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *data, unsigned int datalen, int type, MSN msn, XIDS xids, bool is_fresh, long *dest) { int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *data, unsigned int datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest) { int need_space_here = sizeof(struct fifo_entry) + keylen + datalen + xids_get_size(xids) Loading Loading @@ -103,7 +103,7 @@ int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *d } } struct fifo_entry *entry = (struct fifo_entry *)(fifo->memory + fifo->memory_start + fifo->memory_used); entry->type = (unsigned char)type; fifo_entry_set_msg_type(entry, type); entry->msn = msn; xids_cpy(&entry->xids_s, xids); entry->is_fresh = is_fresh; Loading @@ -126,7 +126,7 @@ int toku_fifo_enq_cmdstruct (FIFO fifo, const BRT_MSG cmd, bool is_fresh, long * } /* peek at the head (the oldest entry) of the fifo */ int toku_fifo_peek(FIFO fifo, bytevec *key, unsigned int *keylen, bytevec *data, unsigned int *datalen, u_int32_t *type, MSN *msn, XIDS *xids, bool *is_fresh) { int toku_fifo_peek(FIFO fifo, bytevec *key, unsigned int *keylen, bytevec *data, unsigned int *datalen, enum brt_msg_type *type, MSN *msn, XIDS *xids, bool *is_fresh) { struct fifo_entry *entry = fifo_peek(fifo); if (entry == 0) return -1; unsigned char *e_key = xids_get_end_of_array(&entry->xids_s); Loading @@ -134,7 +134,7 @@ int toku_fifo_peek(FIFO fifo, bytevec *key, unsigned int *keylen, bytevec *data, *keylen = entry->keylen; *data = e_key + entry->keylen; *datalen = entry->vallen; *type = entry->type; *type = fifo_entry_get_msg_type(entry); *msn = entry->msn; *xids = &entry->xids_s; *is_fresh = entry->is_fresh; Loading Loading @@ -186,7 +186,7 @@ struct fifo_entry * toku_fifo_iterate_internal_get_entry(FIFO fifo, int off) { return (struct fifo_entry *)(fifo->memory + off); } void toku_fifo_iterate (FIFO fifo, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen,int type, MSN msn, XIDS xids, bool is_fresh, void*), void *arg) { void toku_fifo_iterate (FIFO fifo, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void *arg) { FIFO_ITERATE(fifo, key, keylen, data, datalen, type, msn, xids, is_fresh, f(key,keylen,data,datalen,type,msn,xids,is_fresh, arg)); Loading newbrt/fifo.h +21 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,24 @@ struct __attribute__((__packed__)) fifo_entry { XIDS_S xids_s; }; // get and set the brt message type for a fifo entry. // it is internally stored as a single unsigned char. static inline enum brt_msg_type fifo_entry_get_msg_type(const struct fifo_entry * entry) { enum brt_msg_type msg_type; msg_type = (enum brt_msg_type) entry->type; return msg_type; } static inline void fifo_entry_set_msg_type(struct fifo_entry * entry, enum brt_msg_type msg_type) { unsigned char type = (unsigned char) msg_type; entry->type = type; } #if TOKU_WINDOWS #pragma pack(pop) #endif Loading @@ -47,7 +65,7 @@ int toku_fifo_n_entries(FIFO); int toku_fifo_enq_cmdstruct (FIFO fifo, const BRT_MSG cmd, bool is_fresh, long *dest); int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, int type, MSN msn, XIDS xids, bool is_fresh, long *dest); int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest); int toku_fifo_peek (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, u_int32_t *type, MSN *msn, XIDS *xids, bool *is_fresh); Loading @@ -65,7 +83,7 @@ unsigned long toku_fifo_memory_size(FIFO); // return how much memory fifo has al //These two are problematic, since I don't want to malloc() the bytevecs, but dequeueing the fifo frees the memory. //int toku_fifo_peek_deq (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, u_int32_t *type, TXNID *xid); //int toku_fifo_peek_deq_cmdstruct (FIFO, BRT_MSG, DBT*, DBT*); // fill in the BRT_MSG, using the two DBTs for the DBT part. void toku_fifo_iterate (FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen,int type, MSN msn, XIDS xids, bool is_fresh, void*), void*); void toku_fifo_iterate(FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void*); #define FIFO_ITERATE(fifo,keyvar,keylenvar,datavar,datalenvar,typevar,msnvar,xidsvar,is_freshvar,body) ({ \ for (int fifo_iterate_off = toku_fifo_iterate_internal_start(fifo); \ Loading @@ -74,7 +92,7 @@ void toku_fifo_iterate (FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,I struct fifo_entry *e = toku_fifo_iterate_internal_get_entry(fifo, fifo_iterate_off); \ ITEMLEN keylenvar = e->keylen; \ ITEMLEN datalenvar = e->vallen; \ enum brt_msg_type typevar = (enum brt_msg_type)e->type; \ enum brt_msg_type typevar = fifo_entry_get_msg_type(e); \ MSN msnvar = e->msn; \ XIDS xidsvar = &e->xids_s; \ bytevec keyvar = xids_get_end_of_array(xidsvar); \ Loading Loading
newbrt/brt-internal.h +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ unsigned int toku_bnc_nbytesinbuf(NONLEAF_CHILDINFO bnc); int toku_bnc_n_entries(NONLEAF_CHILDINFO bnc); long toku_bnc_memory_size(NONLEAF_CHILDINFO bnc); long toku_bnc_memory_used(NONLEAF_CHILDINFO bnc); int toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, int type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp); int toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp); void toku_bnc_empty(NONLEAF_CHILDINFO bnc); int toku_bnc_flush_to_child( brt_compare_func compare_fun, Loading Loading @@ -485,7 +485,7 @@ void bring_node_fully_into_memory(BRTNODE node, struct brt_header* h); void toku_brt_nonleaf_append_child(BRTNODE node, BRTNODE child, struct kv_pair *pivotkey, size_t pivotkeysize); // append a cmd to a nonleaf node child buffer void toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, int type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val); void toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val); // Mark a node as dirty and update statistics in header. // Other than the node's constructor, this should be the ONLY place Loading
newbrt/brt-verify.c +4 −2 Original line number Diff line number Diff line Loading @@ -52,15 +52,17 @@ compare_pair_to_key (BRT brt, struct kv_pair *a, bytevec key, ITEMLEN keylen) { } static int verify_msg_in_child_buffer(BRT brt, int type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) verify_msg_in_child_buffer(BRT brt, enum brt_msg_type type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) __attribute__((warn_unused_result)); static int verify_msg_in_child_buffer(BRT brt, int type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) { verify_msg_in_child_buffer(BRT brt, enum brt_msg_type type, MSN msn, bytevec key, ITEMLEN keylen, bytevec UU(data), ITEMLEN UU(datalen), XIDS UU(xids), struct kv_pair *lesser_pivot, struct kv_pair *greatereq_pivot) { int result = 0; if (msn.msn == ZERO_MSN.msn) result = EINVAL; switch (type) { default: break; case BRT_INSERT: case BRT_INSERT_NO_OVERWRITE: case BRT_DELETE_ANY: Loading
newbrt/brt.c +6 −7 Original line number Diff line number Diff line Loading @@ -1757,7 +1757,7 @@ toku_fifo_entry_key_msn_cmp(void *extrap, const void *ap, const void *bp) } int toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, int type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp) toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, DESCRIPTOR desc, brt_compare_func cmp) // Effect: Enqueue the message represented by the parameters into the // bnc's buffer, and put it in either the fresh or stale message tree, // or the broadcast list. Loading @@ -1768,8 +1768,7 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons long offset; int r = toku_fifo_enq(bnc->buffer, key, keylen, data, datalen, type, msn, xids, is_fresh, &offset); assert_zero(r); enum brt_msg_type etype = (enum brt_msg_type) type; if (brt_msg_type_applies_once(etype)) { if (brt_msg_type_applies_once(type)) { struct toku_fifo_entry_key_msn_heaviside_extra extra = { .desc = desc, .cmp = cmp, .fifo = bnc->buffer, .key = key, .keylen = keylen, .msn = msn }; if (is_fresh) { r = toku_omt_insert(bnc->fresh_message_tree, (OMTVALUE) offset, toku_fifo_entry_key_msn_heaviside, &extra, NULL); Loading @@ -1778,7 +1777,7 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons r = toku_omt_insert(bnc->stale_message_tree, (OMTVALUE) offset, toku_fifo_entry_key_msn_heaviside, &extra, NULL); assert_zero(r); } } else if (brt_msg_type_applies_all(etype) || brt_msg_type_does_nothing(etype)) { } else if (brt_msg_type_applies_all(type) || brt_msg_type_does_nothing(type)) { u_int32_t idx = toku_omt_size(bnc->broadcast_list); r = toku_omt_insert_at(bnc->broadcast_list, (OMTVALUE) offset, idx); assert_zero(r); Loading @@ -1792,7 +1791,7 @@ toku_bnc_insert_msg(NONLEAF_CHILDINFO bnc, const void *key, ITEMLEN keylen, cons // append a cmd to a nonleaf node's child buffer // should be static, but used by test programs void toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, int type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val) { toku_brt_append_to_child_buffer(brt_compare_func compare_fun, DESCRIPTOR desc, BRTNODE node, int childnum, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, const DBT *key, const DBT *val) { assert(BP_STATE(node,childnum) == PT_AVAIL); int r = toku_bnc_insert_msg(BNC(node, childnum), key->data, key->size, val->data, val->size, type, msn, xids, is_fresh, desc, compare_fun); invariant_zero(r); Loading Loading @@ -2055,7 +2054,7 @@ toku_bnc_flush_to_child( bnc->buffer, key, keylen, val, vallen, type, msn, xids, is_fresh, ({ DBT hk,hv; BRT_MSG_S brtcmd = { (enum brt_msg_type)type, msn, xids, .u.id= {toku_fill_dbt(&hk, key, keylen), BRT_MSG_S brtcmd = { type, msn, xids, .u.id= {toku_fill_dbt(&hk, key, keylen), toku_fill_dbt(&hv, val, vallen)} }; brtnode_put_cmd( compare_fun, Loading Loading @@ -4383,7 +4382,7 @@ do_brt_leaf_put_cmd(BRT t, BRTNODE leafnode, BASEMENTNODE bn, BRTNODE ancestor, if (entry->msn.msn > bn->max_msn_applied.msn) { ITEMLEN keylen = entry->keylen; ITEMLEN vallen = entry->vallen; enum brt_msg_type type = (enum brt_msg_type)entry->type; enum brt_msg_type type = fifo_entry_get_msg_type(entry); MSN msn = entry->msn; const XIDS xids = (XIDS) &entry->xids_s; bytevec key = xids_get_end_of_array(xids); Loading
newbrt/fifo.c +5 −5 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ void toku_fifo_size_hint(FIFO fifo, size_t size) { } } int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *data, unsigned int datalen, int type, MSN msn, XIDS xids, bool is_fresh, long *dest) { int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *data, unsigned int datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest) { int need_space_here = sizeof(struct fifo_entry) + keylen + datalen + xids_get_size(xids) Loading Loading @@ -103,7 +103,7 @@ int toku_fifo_enq(FIFO fifo, const void *key, unsigned int keylen, const void *d } } struct fifo_entry *entry = (struct fifo_entry *)(fifo->memory + fifo->memory_start + fifo->memory_used); entry->type = (unsigned char)type; fifo_entry_set_msg_type(entry, type); entry->msn = msn; xids_cpy(&entry->xids_s, xids); entry->is_fresh = is_fresh; Loading @@ -126,7 +126,7 @@ int toku_fifo_enq_cmdstruct (FIFO fifo, const BRT_MSG cmd, bool is_fresh, long * } /* peek at the head (the oldest entry) of the fifo */ int toku_fifo_peek(FIFO fifo, bytevec *key, unsigned int *keylen, bytevec *data, unsigned int *datalen, u_int32_t *type, MSN *msn, XIDS *xids, bool *is_fresh) { int toku_fifo_peek(FIFO fifo, bytevec *key, unsigned int *keylen, bytevec *data, unsigned int *datalen, enum brt_msg_type *type, MSN *msn, XIDS *xids, bool *is_fresh) { struct fifo_entry *entry = fifo_peek(fifo); if (entry == 0) return -1; unsigned char *e_key = xids_get_end_of_array(&entry->xids_s); Loading @@ -134,7 +134,7 @@ int toku_fifo_peek(FIFO fifo, bytevec *key, unsigned int *keylen, bytevec *data, *keylen = entry->keylen; *data = e_key + entry->keylen; *datalen = entry->vallen; *type = entry->type; *type = fifo_entry_get_msg_type(entry); *msn = entry->msn; *xids = &entry->xids_s; *is_fresh = entry->is_fresh; Loading Loading @@ -186,7 +186,7 @@ struct fifo_entry * toku_fifo_iterate_internal_get_entry(FIFO fifo, int off) { return (struct fifo_entry *)(fifo->memory + off); } void toku_fifo_iterate (FIFO fifo, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen,int type, MSN msn, XIDS xids, bool is_fresh, void*), void *arg) { void toku_fifo_iterate (FIFO fifo, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void *arg) { FIFO_ITERATE(fifo, key, keylen, data, datalen, type, msn, xids, is_fresh, f(key,keylen,data,datalen,type,msn,xids,is_fresh, arg)); Loading
newbrt/fifo.h +21 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,24 @@ struct __attribute__((__packed__)) fifo_entry { XIDS_S xids_s; }; // get and set the brt message type for a fifo entry. // it is internally stored as a single unsigned char. static inline enum brt_msg_type fifo_entry_get_msg_type(const struct fifo_entry * entry) { enum brt_msg_type msg_type; msg_type = (enum brt_msg_type) entry->type; return msg_type; } static inline void fifo_entry_set_msg_type(struct fifo_entry * entry, enum brt_msg_type msg_type) { unsigned char type = (unsigned char) msg_type; entry->type = type; } #if TOKU_WINDOWS #pragma pack(pop) #endif Loading @@ -47,7 +65,7 @@ int toku_fifo_n_entries(FIFO); int toku_fifo_enq_cmdstruct (FIFO fifo, const BRT_MSG cmd, bool is_fresh, long *dest); int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, int type, MSN msn, XIDS xids, bool is_fresh, long *dest); int toku_fifo_enq (FIFO, const void *key, ITEMLEN keylen, const void *data, ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, long *dest); int toku_fifo_peek (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, u_int32_t *type, MSN *msn, XIDS *xids, bool *is_fresh); Loading @@ -65,7 +83,7 @@ unsigned long toku_fifo_memory_size(FIFO); // return how much memory fifo has al //These two are problematic, since I don't want to malloc() the bytevecs, but dequeueing the fifo frees the memory. //int toku_fifo_peek_deq (FIFO, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen, u_int32_t *type, TXNID *xid); //int toku_fifo_peek_deq_cmdstruct (FIFO, BRT_MSG, DBT*, DBT*); // fill in the BRT_MSG, using the two DBTs for the DBT part. void toku_fifo_iterate (FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen,int type, MSN msn, XIDS xids, bool is_fresh, void*), void*); void toku_fifo_iterate(FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,ITEMLEN datalen, enum brt_msg_type type, MSN msn, XIDS xids, bool is_fresh, void*), void*); #define FIFO_ITERATE(fifo,keyvar,keylenvar,datavar,datalenvar,typevar,msnvar,xidsvar,is_freshvar,body) ({ \ for (int fifo_iterate_off = toku_fifo_iterate_internal_start(fifo); \ Loading @@ -74,7 +92,7 @@ void toku_fifo_iterate (FIFO, void(*f)(bytevec key,ITEMLEN keylen,bytevec data,I struct fifo_entry *e = toku_fifo_iterate_internal_get_entry(fifo, fifo_iterate_off); \ ITEMLEN keylenvar = e->keylen; \ ITEMLEN datalenvar = e->vallen; \ enum brt_msg_type typevar = (enum brt_msg_type)e->type; \ enum brt_msg_type typevar = fifo_entry_get_msg_type(e); \ MSN msnvar = e->msn; \ XIDS xidsvar = &e->xids_s; \ bytevec keyvar = xids_get_end_of_array(xidsvar); \ Loading