Skip to content

Commit d71df7e

Browse files
committed
5.6.35-80.0
1 parent d4f0686 commit d71df7e

20 files changed

+756
-83
lines changed

storage/tokudb/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SET(TOKUDB_VERSION 5.6.34-79.1)
1+
SET(TOKUDB_VERSION 5.6.35-80.0)
22
# PerconaFT only supports x86-64 and cmake-2.8.9+
33
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND
44
NOT CMAKE_VERSION VERSION_LESS "2.8.9")

storage/tokudb/PerconaFT/ft/ft-ops.cc

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,8 @@ void toku_ftnode_clone_callback(void *value_data,
651651
// set new pair attr if necessary
652652
if (node->height == 0) {
653653
*new_attr = make_ftnode_pair_attr(node);
654-
for (int i = 0; i < node->n_children; i++) {
655-
BLB(node, i)->logical_rows_delta = 0;
656-
BLB(cloned_node, i)->logical_rows_delta = 0;
657-
}
654+
node->logical_rows_delta = 0;
655+
cloned_node->logical_rows_delta = 0;
658656
} else {
659657
new_attr->is_valid = false;
660658
}
@@ -702,6 +700,10 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
702700
if (ftnode->height == 0) {
703701
FT_STATUS_INC(FT_FULL_EVICTIONS_LEAF, 1);
704702
FT_STATUS_INC(FT_FULL_EVICTIONS_LEAF_BYTES, node_size);
703+
if (!ftnode->dirty) {
704+
toku_ft_adjust_logical_row_count(
705+
ft, -ftnode->logical_rows_delta);
706+
}
705707
} else {
706708
FT_STATUS_INC(FT_FULL_EVICTIONS_NONLEAF, 1);
707709
FT_STATUS_INC(FT_FULL_EVICTIONS_NONLEAF_BYTES, node_size);
@@ -714,11 +716,12 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
714716
BASEMENTNODE bn = BLB(ftnode, i);
715717
toku_ft_decrease_stats(&ft->in_memory_stats,
716718
bn->stat64_delta);
717-
if (!ftnode->dirty)
718-
toku_ft_adjust_logical_row_count(
719-
ft, -bn->logical_rows_delta);
720719
}
721720
}
721+
if (!ftnode->dirty) {
722+
toku_ft_adjust_logical_row_count(
723+
ft, -ftnode->logical_rows_delta);
724+
}
722725
}
723726
}
724727
toku_ftnode_free(&ftnode);
@@ -944,8 +947,6 @@ int toku_ftnode_pe_callback(void *ftnode_pv,
944947
basements_to_destroy[num_basements_to_destroy++] = bn;
945948
toku_ft_decrease_stats(&ft->in_memory_stats,
946949
bn->stat64_delta);
947-
toku_ft_adjust_logical_row_count(ft,
948-
-bn->logical_rows_delta);
949950
set_BNULL(node, i);
950951
BP_STATE(node, i) = PT_ON_DISK;
951952
num_partial_evictions++;
@@ -2652,7 +2653,7 @@ static std::unique_ptr<char[], decltype(&toku_free)> toku_file_get_parent_dir(
26522653
return result;
26532654
}
26542655

2655-
static bool toku_create_subdirs_if_needed(const char *path) {
2656+
bool toku_create_subdirs_if_needed(const char *path) {
26562657
static const mode_t dir_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP |
26572658
S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH;
26582659

@@ -4563,6 +4564,8 @@ int toku_ft_rename_iname(DB_TXN *txn,
45634564
bs_new_name);
45644565
}
45654566

4567+
if (!toku_create_subdirs_if_needed(new_iname_full.get()))
4568+
return get_error_errno();
45664569
r = toku_os_rename(old_iname_full.get(), new_iname_full.get());
45674570
if (r != 0)
45684571
return r;

storage/tokudb/PerconaFT/ft/ft-ops.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,8 @@ void toku_ft_set_direct_io(bool direct_io_on);
288288
void toku_ft_set_compress_buffers_before_eviction(bool compress_buffers);
289289

290290
void toku_note_deserialized_basement_node(bool fixed_key_size);
291+
292+
// Creates all directories for the path if necessary,
293+
// returns true if all dirs are created successfully or
294+
// all dirs exist, false otherwise.
295+
bool toku_create_subdirs_if_needed(const char* path);

storage/tokudb/PerconaFT/ft/logger/recover.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,8 @@ static int toku_recover_frename(struct logtype_frename *l, RECOVER_ENV renv) {
987987
return 1;
988988

989989
if (old_exist && !new_exist &&
990-
(toku_os_rename(old_iname_full.get(), new_iname_full.get()) == -1 ||
990+
(!toku_create_subdirs_if_needed(new_iname_full.get()) ||
991+
toku_os_rename(old_iname_full.get(), new_iname_full.get()) == -1 ||
991992
toku_fsync_directory(old_iname_full.get()) == -1 ||
992993
toku_fsync_directory(new_iname_full.get()) == -1))
993994
return 1;

storage/tokudb/PerconaFT/ft/node.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,15 +386,15 @@ static void bnc_apply_messages_to_basement_node(
386386
const pivot_bounds &
387387
bounds, // contains pivot key bounds of this basement node
388388
txn_gc_info *gc_info,
389-
bool *msgs_applied) {
389+
bool *msgs_applied,
390+
int64_t* logical_rows_delta) {
390391
int r;
391392
NONLEAF_CHILDINFO bnc = BNC(ancestor, childnum);
392393

393394
// Determine the offsets in the message trees between which we need to
394395
// apply messages from this buffer
395396
STAT64INFO_S stats_delta = {0, 0};
396397
uint64_t workdone_this_ancestor = 0;
397-
int64_t logical_rows_delta = 0;
398398

399399
uint32_t stale_lbi, stale_ube;
400400
if (!bn->stale_ancestor_messages_applied) {
@@ -470,7 +470,7 @@ static void bnc_apply_messages_to_basement_node(
470470
gc_info,
471471
&workdone_this_ancestor,
472472
&stats_delta,
473-
&logical_rows_delta);
473+
logical_rows_delta);
474474
}
475475
} else if (stale_lbi == stale_ube) {
476476
// No stale messages to apply, we just apply fresh messages, and mark
@@ -482,7 +482,7 @@ static void bnc_apply_messages_to_basement_node(
482482
.gc_info = gc_info,
483483
.workdone = &workdone_this_ancestor,
484484
.stats_to_update = &stats_delta,
485-
.logical_rows_delta = &logical_rows_delta};
485+
.logical_rows_delta = logical_rows_delta};
486486
if (fresh_ube - fresh_lbi > 0)
487487
*msgs_applied = true;
488488
r = bnc->fresh_message_tree
@@ -503,7 +503,7 @@ static void bnc_apply_messages_to_basement_node(
503503
.gc_info = gc_info,
504504
.workdone = &workdone_this_ancestor,
505505
.stats_to_update = &stats_delta,
506-
.logical_rows_delta = &logical_rows_delta};
506+
.logical_rows_delta = logical_rows_delta};
507507

508508
r = bnc->stale_message_tree
509509
.iterate_on_range<struct iterate_do_bn_apply_msg_extra,
@@ -521,8 +521,6 @@ static void bnc_apply_messages_to_basement_node(
521521
if (stats_delta.numbytes || stats_delta.numrows) {
522522
toku_ft_update_stats(&t->ft->in_memory_stats, stats_delta);
523523
}
524-
toku_ft_adjust_logical_row_count(t->ft, logical_rows_delta);
525-
bn->logical_rows_delta += logical_rows_delta;
526524
}
527525

528526
static void
@@ -536,6 +534,7 @@ apply_ancestors_messages_to_bn(
536534
bool* msgs_applied
537535
)
538536
{
537+
int64_t logical_rows_delta = 0;
539538
BASEMENTNODE curr_bn = BLB(node, childnum);
540539
const pivot_bounds curr_bounds = bounds.next_bounds(node, childnum);
541540
for (ANCESTORS curr_ancestors = ancestors; curr_ancestors; curr_ancestors = curr_ancestors->next) {
@@ -548,13 +547,16 @@ apply_ancestors_messages_to_bn(
548547
curr_ancestors->childnum,
549548
curr_bounds,
550549
gc_info,
551-
msgs_applied
550+
msgs_applied,
551+
&logical_rows_delta
552552
);
553553
// We don't want to check this ancestor node again if the
554554
// next time we query it, the msn hasn't changed.
555555
curr_bn->max_msn_applied = curr_ancestors->node->max_msn_applied_to_node_on_disk;
556556
}
557557
}
558+
toku_ft_adjust_logical_row_count(t->ft, logical_rows_delta);
559+
node->logical_rows_delta += logical_rows_delta;
558560
// At this point, we know all the stale messages above this
559561
// basement node have been applied, and any new messages will be
560562
// fresh, so we don't need to look at stale messages for this

storage/tokudb/PerconaFT/ft/node.h

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,36 +157,49 @@ class ftnode_pivot_keys {
157157

158158
// TODO: class me up
159159
struct ftnode {
160-
MSN max_msn_applied_to_node_on_disk; // max_msn_applied that will be written to disk
160+
// max_msn_applied that will be written to disk
161+
MSN max_msn_applied_to_node_on_disk;
161162
unsigned int flags;
162-
BLOCKNUM blocknum; // Which block number is this node?
163-
int layout_version; // What version of the data structure?
164-
int layout_version_original; // different (<) from layout_version if upgraded from a previous version (useful for debugging)
165-
int layout_version_read_from_disk; // transient, not serialized to disk, (useful for debugging)
166-
uint32_t build_id; // build_id (svn rev number) of software that wrote this node to disk
167-
int height; /* height is always >= 0. 0 for leaf, >0 for nonleaf. */
168-
int dirty;
163+
// Which block number is this node?
164+
BLOCKNUM blocknum;
165+
// What version of the data structure?
166+
int layout_version;
167+
// different (<) from layout_version if upgraded from a previous version
168+
// (useful for debugging)
169+
int layout_version_original;
170+
// transient, not serialized to disk, (useful for debugging)
171+
int layout_version_read_from_disk;
172+
// build_id (svn rev number) of software that wrote this node to disk
173+
uint32_t build_id;
174+
// height is always >= 0. 0 for leaf, >0 for nonleaf.
175+
int height;
176+
int dirty;
169177
uint32_t fullhash;
178+
// current count of rows add or removed as a result of message application
179+
// to this node as a basement, irrelevant for internal nodes, gets reset
180+
// when node is undirtied. Used to back out tree scoped LRC id node is
181+
// evicted but not persisted
182+
int64_t logical_rows_delta;
170183

171-
// for internal nodes, if n_children==fanout+1 then the tree needs to be rebalanced.
172-
// for leaf nodes, represents number of basement nodes
184+
// for internal nodes, if n_children==fanout+1 then the tree needs to be
185+
// rebalanced. for leaf nodes, represents number of basement nodes
173186
int n_children;
174187
ftnode_pivot_keys pivotkeys;
175188

176-
// What's the oldest referenced xid that this node knows about? The real oldest
177-
// referenced xid might be younger, but this is our best estimate. We use it
178-
// as a heuristic to transition provisional mvcc entries from provisional to
179-
// committed (from implicity committed to really committed).
189+
// What's the oldest referenced xid that this node knows about? The real
190+
// oldest referenced xid might be younger, but this is our best estimate.
191+
// We use it as a heuristic to transition provisional mvcc entries from
192+
// provisional to committed (from implicity committed to really committed).
180193
//
181-
// A better heuristic would be the oldest live txnid, but we use this since it
182-
// still works well most of the time, and its readily available on the inject
183-
// code path.
194+
// A better heuristic would be the oldest live txnid, but we use this since
195+
// it still works well most of the time, and its readily available on the
196+
// inject code path.
184197
TXNID oldest_referenced_xid_known;
185198

186199
// array of size n_children, consisting of ftnode partitions
187-
// each one is associated with a child
188-
// for internal nodes, the ith partition corresponds to the ith message buffer
189-
// for leaf nodes, the ith partition corresponds to the ith basement node
200+
// each one is associated with a child for internal nodes, the ith
201+
// partition corresponds to the ith message buffer for leaf nodes, the ith
202+
// partition corresponds to the ith basement node
190203
struct ftnode_partition *bp;
191204
struct ctpair *ct_pair;
192205
};
@@ -199,7 +212,6 @@ struct ftnode_leaf_basement_node {
199212
MSN max_msn_applied; // max message sequence number applied
200213
bool stale_ancestor_messages_applied;
201214
STAT64INFO_S stat64_delta; // change in stat64 counters since basement was last written to disk
202-
int64_t logical_rows_delta;
203215
};
204216
typedef struct ftnode_leaf_basement_node *BASEMENTNODE;
205217

storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,6 @@ BASEMENTNODE toku_clone_bn(BASEMENTNODE orig_bn) {
996996
bn->seqinsert = orig_bn->seqinsert;
997997
bn->stale_ancestor_messages_applied = orig_bn->stale_ancestor_messages_applied;
998998
bn->stat64_delta = orig_bn->stat64_delta;
999-
bn->logical_rows_delta = orig_bn->logical_rows_delta;
1000999
bn->data_buffer.clone(&orig_bn->data_buffer);
10011000
return bn;
10021001
}
@@ -1007,7 +1006,6 @@ BASEMENTNODE toku_create_empty_bn_no_buffer(void) {
10071006
bn->seqinsert = 0;
10081007
bn->stale_ancestor_messages_applied = false;
10091008
bn->stat64_delta = ZEROSTATS;
1010-
bn->logical_rows_delta = 0;
10111009
bn->data_buffer.init_zero();
10121010
return bn;
10131011
}
@@ -1432,6 +1430,7 @@ static FTNODE alloc_ftnode_for_deserialize(uint32_t fullhash, BLOCKNUM blocknum)
14321430
node->fullhash = fullhash;
14331431
node->blocknum = blocknum;
14341432
node->dirty = 0;
1433+
node->logical_rows_delta = 0;
14351434
node->bp = nullptr;
14361435
node->oldest_referenced_xid_known = TXNID_NONE;
14371436
return node;

storage/tokudb/PerconaFT/ft/txn/roll.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ int toku_rollback_frename(BYTESTRING old_iname,
227227
return 1;
228228

229229
if (!old_exist && new_exist &&
230-
(toku_os_rename(new_iname_full.get(), old_iname_full.get()) == -1 ||
230+
(!toku_create_subdirs_if_needed(old_iname_full.get()) ||
231+
toku_os_rename(new_iname_full.get(), old_iname_full.get()) == -1 ||
231232
toku_fsync_directory(new_iname_full.get()) == -1 ||
232233
toku_fsync_directory(old_iname_full.get()) == -1))
233234
return 1;

storage/tokudb/PerconaFT/util/dmt.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,6 @@ class dmt {
589589

590590
void convert_from_tree_to_array(void);
591591

592-
__attribute__((nonnull(2,5)))
593592
void delete_internal(subtree *const subtreep, const uint32_t idx, subtree *const subtree_replace, subtree **const rebalance_subtree);
594593

595594
template<typename iterate_extra_t,
@@ -627,16 +626,12 @@ class dmt {
627626
__attribute__((nonnull))
628627
void rebalance(subtree *const subtree);
629628

630-
__attribute__((nonnull))
631629
static void copyout(uint32_t *const outlen, dmtdata_t *const out, const dmt_node *const n);
632630

633-
__attribute__((nonnull))
634631
static void copyout(uint32_t *const outlen, dmtdata_t **const out, dmt_node *const n);
635632

636-
__attribute__((nonnull))
637633
static void copyout(uint32_t *const outlen, dmtdata_t *const out, const uint32_t len, const dmtdata_t *const stored_value_ptr);
638634

639-
__attribute__((nonnull))
640635
static void copyout(uint32_t *const outlen, dmtdata_t **const out, const uint32_t len, dmtdata_t *const stored_value_ptr);
641636

642637
template<typename dmtcmp_t,

storage/tokudb/PerconaFT/util/omt.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ class omt {
284284
* By taking ownership of the array, we save a malloc and memcpy,
285285
* and possibly a free (if the caller is done with the array).
286286
*/
287-
__attribute__((nonnull))
288287
void create_steal_sorted_array(omtdata_t **const values, const uint32_t numvalues, const uint32_t new_capacity);
289288

290289
/**
@@ -667,7 +666,6 @@ class omt {
667666

668667
void set_at_internal(const subtree &subtree, const omtdata_t &value, const uint32_t idx);
669668

670-
__attribute__((nonnull(2,5)))
671669
void delete_internal(subtree *const subtreep, const uint32_t idx, omt_node *const copyn, subtree **const rebalance_subtree);
672670

673671
template<typename iterate_extra_t,

0 commit comments

Comments
 (0)