~ubuntu-branches/ubuntu/vivid/mariadb-5.5/vivid-proposed

« back to all changes in this revision

Viewing changes to storage/tokudb/ft-index/locktree/locktree.h

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2014-11-14 21:04:24 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20141114210424-xlyna0ozl11647o5
Tags: 5.5.40-0ubuntu0.14.10.1
* SECURITY UPDATE: Update to 5.5.40 to fix security issues (LP: #1391676)
  - CVE-2014-6507
  - CVE-2014-6491
  - CVE-2014-6500
  - CVE-2014-6469
  - CVE-2014-6555
  - CVE-2014-6559
  - CVE-2014-6494
  - CVE-2014-6496
  - CVE-2014-6464
* Add bsdutils as mariadb-server dependency like upstream does in 5.5.40.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
COPYRIGHT NOTICE:
31
31
 
32
 
  TokuDB, Tokutek Fractal Tree Indexing Library.
 
32
  TokuFT, Tokutek Fractal Tree Indexing Library.
33
33
  Copyright (C) 2007-2013 Tokutek, Inc.
34
34
 
35
35
DISCLAIMER:
95
95
#include <toku_time.h>
96
96
#include <toku_pthread.h>
97
97
 
98
 
#include <ft/fttypes.h>
 
98
#include <ft/ft-ops.h> // just for DICTIONARY_ID..
99
99
#include <ft/comparator.h>
100
100
 
101
101
#include <util/omt.h>
137
137
    class locktree;
138
138
    class locktree_manager;
139
139
    class lock_request;
140
 
    class memory_tracker;
141
140
    class concurrent_tree;
142
141
 
143
142
    typedef int  (*lt_create_cb)(locktree *lt, void *extra);
184
183
 
185
184
        // effect: Get a locktree from the manager. If a locktree exists with the given
186
185
        //         dict_id, it is referenced and then returned. If one did not exist, it
187
 
        //         is created. It will use the given descriptor and comparison function
188
 
        //         for comparing keys, and the on_create callback passed to locktree_manager::create()
189
 
        //         will be called with the given extra parameter.
190
 
        locktree *get_lt(DICTIONARY_ID dict_id, DESCRIPTOR desc, ft_compare_func cmp, void *on_create_extra);
 
186
        //         is created. It will use the comparator for comparing keys. The on_create
 
187
        //         callback (passed to locktree_manager::create()) will be called with the
 
188
        //         given extra parameter.
 
189
        locktree *get_lt(DICTIONARY_ID dict_id, const comparator &cmp, void *on_create_extra);
191
190
 
192
191
        void reference_lt(locktree *lt);
193
192
 
246
245
        // tracks the current number of locks and lock memory
247
246
        uint64_t m_max_lock_memory;
248
247
        uint64_t m_current_lock_memory;
249
 
        memory_tracker *m_mem_tracker;
250
248
 
251
249
        struct lt_counters m_lt_counters;
252
250
 
309
307
 
310
308
    // A locktree represents the set of row locks owned by all transactions
311
309
    // over an open dictionary. Read and write ranges are represented as
312
 
    // a left and right key which are compared with the given descriptor
313
 
    // and comparison fn.
 
310
    // a left and right key which are compared with the given comparator
314
311
    //
315
312
    // Locktrees are not created and destroyed by the user. Instead, they are
316
313
    // referenced and released using the locktree manager.
325
322
    // - Destroy the manager.
326
323
    class locktree {
327
324
    public:
328
 
        // effect: Creates a locktree that uses the given memory tracker
329
 
        //         to report memory usage and honor memory constraints.
330
 
        void create(locktree_manager *mgr, DICTIONARY_ID dict_id,
331
 
                    DESCRIPTOR desc, ft_compare_func cmp);
 
325
        // effect: Creates a locktree
 
326
        void create(locktree_manager *mgr, DICTIONARY_ID dict_id, const comparator &cmp);
332
327
 
333
328
        void destroy(void);
334
329
 
374
369
 
375
370
        locktree_manager *get_manager(void) const;
376
371
 
377
 
        void set_descriptor(DESCRIPTOR desc);
 
372
        void set_comparator(const comparator &cmp);
378
373
 
379
374
        int compare(const locktree *lt) const;
380
375
 
392
387
        DICTIONARY_ID m_dict_id;
393
388
        uint32_t m_reference_count;
394
389
 
395
 
        // use a comparator object that encapsulates an ft compare
396
 
        // function and a descriptor in a fake db. this way we can
397
 
        // pass it around for easy key comparisons.
 
390
        // Since the memory referenced by this comparator is not owned by the
 
391
        // locktree, the user must guarantee it will outlive the locktree.
398
392
        //
399
 
        // since this comparator will store a pointer to a descriptor,
400
 
        // the user of the locktree needs to make sure that the descriptor
401
 
        // is valid for as long as the locktree. this is currently
402
 
        // implemented by opening an ft_handle for this locktree and
403
 
        // storing it as userdata below.
404
 
        comparator *m_cmp;
 
393
        // The ydb API accomplishes this by opening an ft_handle in the on_create
 
394
        // callback, which will keep the underlying FT (and its descriptor) in memory
 
395
        // for as long as the handle is open. The ft_handle is stored opaquely in the
 
396
        // userdata pointer below. see locktree_manager::get_lt w/ on_create_extra
 
397
        comparator m_cmp;
405
398
 
406
399
        concurrent_tree *m_rangetree;
407
400