~ubuntu-branches/ubuntu/utopic/mariadb-5.5/utopic-security

« back to all changes in this revision

Viewing changes to storage/tokudb/ft-index/ft/txn_manager.cc

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2014-04-17 20:55:22 UTC
  • mfrom: (2.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140417205522-wof4l36nxhlkn89m
* New upstream release, fixing the following security issues:
  * Corresponding MariaDB CVEs for Oracle SPU April 2014 (Closes: #745330)
    - CVE-2014-0384 
    - CVE-2014-2419 
    - CVE-2014-2430 
    - CVE-2014-2431 
    - CVE-2014-2432 
    - CVE-2014-2436 
    - CVE-2014-2438 
    - CVE-2014-2440
* Re-enabled TokuDB with "if arch amd64" in d/rules
* Applied patch to log init output better
  (Closes https://mariadb.atlassian.net/browse/MDEV-5957)

Show diffs side-by-side

added added

removed removed

Lines of Context:
291
291
    txn_manager->last_xid = 0;
292
292
 
293
293
    txn_manager->last_xid_seen_for_recover = TXNID_NONE;
 
294
    txn_manager->last_calculated_oldest_referenced_xid = TXNID_NONE;
294
295
    
295
296
    *txn_managerp = txn_manager;
296
297
}
324
325
    return rval;
325
326
}
326
327
 
 
328
TXNID toku_txn_manager_get_oldest_referenced_xid_estimate(TXN_MANAGER txn_manager) {
 
329
    return txn_manager->last_calculated_oldest_referenced_xid;
 
330
}
 
331
 
327
332
int live_root_txn_list_iter(const TOKUTXN &live_xid, const uint32_t UU(index), TXNID **const referenced_xids);
328
333
int live_root_txn_list_iter(const TOKUTXN &live_xid, const uint32_t UU(index), TXNID **const referenced_xids){
329
334
    (*referenced_xids)[index] = live_xid->txnid.parent_id64;
371
376
    return a < b ? b : a;
372
377
}
373
378
 
374
 
static TXNID get_oldest_referenced_xid_unlocked(TXN_MANAGER txn_manager) {
 
379
static void set_oldest_referenced_xid(TXN_MANAGER txn_manager) {
375
380
    TXNID oldest_referenced_xid = TXNID_MAX;
376
381
    int r;
377
382
    if (txn_manager->live_root_ids.size() > 0) {
397
402
    if (txn_manager->last_xid < oldest_referenced_xid) {
398
403
        oldest_referenced_xid = txn_manager->last_xid;
399
404
    }
400
 
    paranoid_invariant(oldest_referenced_xid != TXNID_MAX);
401
 
    return oldest_referenced_xid;
 
405
    invariant(oldest_referenced_xid != TXNID_MAX);
 
406
    txn_manager->last_calculated_oldest_referenced_xid = oldest_referenced_xid;
402
407
}
403
408
 
404
409
//Heaviside function to find a TOKUTXN by TOKUTXN (used to find the index)
610
615
    // using xid that is passed in
611
616
    txn_manager->last_xid = max_xid(txn_manager->last_xid, xid);
612
617
    toku_txn_update_xids_in_txn(txn, xid);
613
 
    txn->oldest_referenced_xid = TXNID_NONE;
614
618
 
615
619
    uint32_t idx;
616
620
    int r = txn_manager->live_root_txns.find_zero<TOKUTXN, find_xid>(txn, nullptr, &idx);
672
676
        r = txn_manager->live_root_ids.insert_at(txn->txnid.parent_id64, idx);
673
677
        invariant_zero(r);
674
678
    }
675
 
    txn->oldest_referenced_xid = get_oldest_referenced_xid_unlocked(txn_manager);
 
679
    set_oldest_referenced_xid(txn_manager);
676
680
    
677
681
    if (needs_snapshot) {
678
682
        txn_manager_create_snapshot_unlocked(
825
829
    txn_manager_unlock(txn_manager);
826
830
}
827
831
 
828
 
 
 
832
void txn_manager_state::init() {
 
833
    invariant(!initialized);
 
834
    invariant_notnull(txn_manager);
 
835
    toku_txn_manager_clone_state_for_gc(
 
836
        txn_manager,
 
837
        &snapshot_xids,
 
838
        &referenced_xids,
 
839
        &live_root_txns
 
840
        );
 
841
    initialized = true;
 
842
}
829
843
 
830
844
void toku_txn_manager_id2txn_unlocked(TXN_MANAGER txn_manager, TXNID_PAIR txnid, TOKUTXN *result) {
831
845
    TOKUTXN txn;