kcplantdb.h   kcplantdb.h 
skipping to change at line 537 skipping to change at line 537
rit++; rit++;
if (rit != ritend) { if (rit != ritend) {
clear_position(); clear_position();
set_position(*rit, node->id); set_position(*rit, node->id);
step = false; step = false;
} }
} }
} }
} }
} }
bool atran = db_->autotran_ && node->dirty; bool atran = db_->autotran_ && !db_->tran_ && node->dirty;
bool async = db_->autosync_ && !db_->autotran_ && node->dirty; bool async = db_->autosync_ && !db_->autotran_ && !db_->tran_ && no
de->dirty;
node->lock.unlock(); node->lock.unlock();
if (hit && step) { if (hit && step) {
clear_position(); clear_position();
set_position(node->next); set_position(node->next);
} }
if (hit) { if (hit) {
bool flush = db_->cusage_ > db_->pccap_; bool flush = db_->cusage_ > db_->pccap_;
if (link || flush || async) { if (link || flush || async) {
int64_t id = node->id; int64_t id = node->id;
if (atran && !link && !db_->tran_ && !db_->fix_auto_transaction _leaf(node)) if (atran && !link && !db_->fix_auto_transaction_leaf(node))
err = true; err = true;
if (!db_->mlock_.promote()) { if (!db_->mlock_.promote()) {
db_->mlock_.unlock(); db_->mlock_.unlock();
db_->mlock_.lock_writer(); db_->mlock_.lock_writer();
} }
if (link) { if (link) {
node = db_->search_tree(link, true, hist, &hnum); node = db_->search_tree(link, true, hist, &hnum);
if (node) { if (node) {
if (!db_->reorganize_tree(node, hist, hnum)) err = true; if (!db_->reorganize_tree(node, hist, hnum)) err = true;
if (atran && !db_->tran_ && !db_->fix_auto_transaction_tree ()) err = true; if (atran && !db_->tran_ && !db_->fix_auto_transaction_tree ()) err = true;
skipping to change at line 697 skipping to change at line 697
if (step) { if (step) {
rit++; rit++;
if (rit != ritend) { if (rit != ritend) {
clear_position(); clear_position();
set_position(*rit, node->id); set_position(*rit, node->id);
} else { } else {
clear_position(); clear_position();
set_position(node->next); set_position(node->next);
} }
} }
bool atran = db_->autotran_ && node->dirty; bool atran = db_->autotran_ && !db_->tran_ && node->dirty;
bool async = db_->autosync_ && !db_->autotran_ && node->dirty; bool async = db_->autosync_ && !db_->autotran_ && !db_->tran_ && no
if (atran && !reorg && !db_->tran_ && !db_->fix_auto_transaction_le de->dirty;
af(node)) err = true; if (atran && !reorg && !db_->fix_auto_transaction_leaf(node)) err =
true;
if (reorg) { if (reorg) {
if (!db_->reorganize_tree(node, hist, hnum)) err = true; if (!db_->reorganize_tree(node, hist, hnum)) err = true;
if (atran && !db_->tran_ && !db_->fix_auto_transaction_tree()) er r = true; if (atran && !db_->fix_auto_transaction_tree()) err = true;
} else if (db_->cusage_ > db_->pccap_) { } else if (db_->cusage_ > db_->pccap_) {
int32_t idx = node->id % PDBSLOTNUM; int32_t idx = node->id % PDBSLOTNUM;
LeafSlot* lslot = db_->lslots_ + idx; LeafSlot* lslot = db_->lslots_ + idx;
if (!db_->flush_leaf_cache_part(lslot)) err = true; if (!db_->flush_leaf_cache_part(lslot)) err = true;
InnerSlot* islot = db_->islots_ + idx; InnerSlot* islot = db_->islots_ + idx;
if (islot->warm->count() > lslot->warm->count() + lslot->hot->cou nt() + 1 && if (islot->warm->count() > lslot->warm->count() + lslot->hot->cou nt() + 1 &&
!db_->flush_inner_cache_part(islot)) err = true; !db_->flush_inner_cache_part(islot)) err = true;
} }
if (async && !db_->fix_auto_synchronization()) err = true; if (async && !db_->fix_auto_synchronization()) err = true;
} else { } else {
skipping to change at line 995 skipping to change at line 995
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz; rec->ksiz = ksiz;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz); std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz);
if (writable) { if (writable) {
node->lock.lock_writer(); node->lock.lock_writer();
} else { } else {
node->lock.lock_reader(); node->lock.lock_reader();
} }
bool reorg = accept_impl(node, rec, visitor); bool reorg = accept_impl(node, rec, visitor);
bool atran = autotran_ && node->dirty; bool atran = autotran_ && !tran_ && node->dirty;
bool async = autosync_ && !autotran_ && node->dirty; bool async = autosync_ && !autotran_ && !tran_ && node->dirty;
node->lock.unlock(); node->lock.unlock();
bool flush = false; bool flush = false;
bool err = false; bool err = false;
if (atran && !reorg && !tran_ && !fix_auto_transaction_leaf(node)) err = true; if (atran && !reorg && !fix_auto_transaction_leaf(node)) err = true;
if (reorg && mlock_.promote()) { if (reorg && mlock_.promote()) {
if (!reorganize_tree(node, hist, hnum)) err = true; if (!reorganize_tree(node, hist, hnum)) err = true;
if (atran && !tran_ && !fix_auto_transaction_tree()) err = true; if (atran && !fix_auto_transaction_tree()) err = true;
reorg = false; reorg = false;
} else if (cusage_ > pccap_) { } else if (cusage_ > pccap_) {
int32_t idx = node->id % PDBSLOTNUM; int32_t idx = node->id % PDBSLOTNUM;
LeafSlot* lslot = lslots_ + idx; LeafSlot* lslot = lslots_ + idx;
if (!clean_leaf_cache_part(lslot)) err = true; if (!clean_leaf_cache_part(lslot)) err = true;
if (mlock_.promote()) { if (mlock_.promote()) {
if (!flush_leaf_cache_part(lslot)) err = true; if (!flush_leaf_cache_part(lslot)) err = true;
InnerSlot* islot = islots_ + idx; InnerSlot* islot = islots_ + idx;
if (islot->warm->count() > lslot->warm->count() + lslot->hot->count () + 1 && if (islot->warm->count() > lslot->warm->count() + lslot->hot->count () + 1 &&
!flush_inner_cache_part(islot)) err = true; !flush_inner_cache_part(islot)) err = true;
skipping to change at line 1101 skipping to change at line 1101
break; break;
} }
char rstack[PDBRECBUFSIZ]; char rstack[PDBRECBUFSIZ];
size_t rsiz = sizeof(Record) + ksiz; size_t rsiz = sizeof(Record) + ksiz;
char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack; char* rbuf = rsiz > sizeof(rstack) ? new char[rsiz] : rstack;
Record* rec = (Record*)rbuf; Record* rec = (Record*)rbuf;
rec->ksiz = ksiz; rec->ksiz = ksiz;
rec->vsiz = 0; rec->vsiz = 0;
std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz); std::memcpy(rbuf + sizeof(*rec), kbuf, ksiz);
bool reorg = accept_impl(node, rec, visitor); bool reorg = accept_impl(node, rec, visitor);
bool atran = autotran_ && node->dirty; bool atran = autotran_ && !tran_ && node->dirty;
bool async = autosync_ && !autotran_ && node->dirty; bool async = autosync_ && !autotran_ && !tran_ && node->dirty;
if (atran && !reorg && !tran_ && !fix_auto_transaction_leaf(node)) er if (atran && !reorg && !fix_auto_transaction_leaf(node)) err = true;
r = true;
if (reorg) { if (reorg) {
if (!reorganize_tree(node, hist, hnum)) err = true; if (!reorganize_tree(node, hist, hnum)) err = true;
if (atran && !tran_ && !fix_auto_transaction_tree()) err = true; if (atran && !fix_auto_transaction_tree()) err = true;
} else if (cusage_ > pccap_) { } else if (cusage_ > pccap_) {
int32_t idx = node->id % PDBSLOTNUM; int32_t idx = node->id % PDBSLOTNUM;
LeafSlot* lslot = lslots_ + idx; LeafSlot* lslot = lslots_ + idx;
if (!clean_leaf_cache_part(lslot)) err = true; if (!clean_leaf_cache_part(lslot)) err = true;
if (!flush_leaf_cache_part(lslot)) err = true; if (!flush_leaf_cache_part(lslot)) err = true;
InnerSlot* islot = islots_ + idx; InnerSlot* islot = islots_ + idx;
if (islot->warm->count() > lslot->warm->count() + lslot->hot->count () + 1 && if (islot->warm->count() > lslot->warm->count() + lslot->hot->count () + 1 &&
!flush_inner_cache_part(islot)) err = true; !flush_inner_cache_part(islot)) err = true;
} }
if (rbuf != rstack) delete[] rbuf; if (rbuf != rstack) delete[] rbuf;
 End of changes. 9 change blocks. 
17 lines changed or deleted 18 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/