~clint-fewbar/drizzle/regex-policy-cache-limiter

« back to all changes in this revision

Viewing changes to plugin/innobase/fil/fil0fil.cc

  • Committer: Clint Byrum
  • Date: 2012-03-15 18:05:43 UTC
  • mfrom: (2224.1.302 workspace)
  • Revision ID: clint@ubuntu.com-20120315180543-9jxxm4q10k3np2ws
merging with latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "dict0dict.h"
41
41
#include "page0page.h"
42
42
#include "page0zip.h"
 
43
#include "xtrabackup_api.h"
43
44
#ifndef UNIV_HOTBACKUP
44
45
# include "buf0lru.h"
45
46
# include "ibuf0ibuf.h"
297
298
 
298
299
/** The tablespace memory cache. This variable is NULL before the module is
299
300
initialized. */
300
 
static fil_system_t*    fil_system      = NULL;
 
301
fil_system_t*   fil_system      = NULL;
301
302
 
302
303
 
303
304
/********************************************************************//**
640
641
        fil_system_t*   system, /*!< in: tablespace memory cache */
641
642
        fil_space_t*    space)  /*!< in: space */
642
643
{
643
 
        ib_int64_t      size_bytes;
 
644
        uint64_t        size_bytes;
644
645
        ulint           size_low;
645
646
        ulint           size_high;
646
647
        ibool           ret;
682
683
 
683
684
                os_file_get_size(node->handle, &size_low, &size_high);
684
685
 
685
 
                size_bytes = (((ib_int64_t)size_high) << 32)
686
 
                        + (ib_int64_t)size_low;
 
686
                size_bytes = (((uint64_t)size_high) << 32) + size_low;
687
687
#ifdef UNIV_HOTBACKUP
688
688
                if (space->id == 0) {
689
 
                        node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
 
689
                        node->size = size_bytes / UNIV_PAGE_SIZE;
690
690
                        os_file_close(node->handle);
691
691
                        goto add_size;
692
692
                }
763
763
                }
764
764
 
765
765
                if (!(flags & DICT_TF_ZSSIZE_MASK)) {
766
 
                        node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
 
766
                        node->size = (ulint)size_bytes / UNIV_PAGE_SIZE;
767
767
                } else {
768
768
                        node->size = (ulint)
769
769
                                (size_bytes
3185
3185
        ulint           flags;
3186
3186
        ulint           size_low;
3187
3187
        ulint           size_high;
3188
 
        ib_int64_t      size;
 
3188
        uint64_t        size;
3189
3189
#ifdef UNIV_HOTBACKUP
3190
3190
        fil_space_t*    space;
3191
3191
#endif
3448
3448
idea is to read as much good data as we can and jump over bad data.
3449
3449
@return 0 if ok, -1 if error even after the retries, 1 if at the end
3450
3450
of the directory */
3451
 
static
3452
3451
int
3453
3452
fil_file_readdir_next_file(
3454
3453
/*=======================*/
4305
4304
        ut_ad(ut_is_2pow(zip_size));
4306
4305
        ut_ad(buf);
4307
4306
        ut_ad(len > 0);
4308
 
#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE
4309
 
# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE"
4310
 
#endif
4311
4307
        ut_ad(fil_validate());
4312
4308
#ifndef UNIV_HOTBACKUP
4313
4309
# ifndef UNIV_LOG_DEBUG
4473
4469
        return(DB_SUCCESS);
4474
4470
}
4475
4471
 
 
4472
/********************************************************************//**
 
4473
Confirm whether the parameters are valid or not */
 
4474
UNIV_INTERN
 
4475
bool
 
4476
fil_is_exist(
 
4477
/*=========*/
 
4478
        ulint   space_id,       /*!< in: space id */
 
4479
        ulint   block_offset)   /*!< in: offset in number of blocks */
 
4480
{
 
4481
        fil_space_t*    space;
 
4482
        fil_node_t*     node;
 
4483
 
 
4484
        /* Reserve the fil_system mutex and make sure that we can open at
 
4485
        least one file while holding it, if the file is not already open */
 
4486
 
 
4487
        fil_mutex_enter_and_prepare_for_io(space_id);
 
4488
 
 
4489
        space = fil_space_get_by_id(space_id);
 
4490
 
 
4491
        if (!space) {
 
4492
                mutex_exit(&fil_system->mutex);
 
4493
                return(false);
 
4494
        }
 
4495
 
 
4496
        node = UT_LIST_GET_FIRST(space->chain);
 
4497
 
 
4498
        for (;;) {
 
4499
                if (UNIV_UNLIKELY(node == NULL)) {
 
4500
                        mutex_exit(&fil_system->mutex);
 
4501
                        return(false);
 
4502
                }
 
4503
 
 
4504
                if (space->id != 0 && node->size == 0) {
 
4505
                        /* We do not know the size of a single-table tablespace
 
4506
                        before we open the file */
 
4507
 
 
4508
                        break;
 
4509
                }
 
4510
 
 
4511
                if (node->size > block_offset) {
 
4512
                        /* Found! */
 
4513
                        break;
 
4514
                } else {
 
4515
                        block_offset -= node->size;
 
4516
                        node = UT_LIST_GET_NEXT(chain, node);
 
4517
                }
 
4518
        }
 
4519
 
 
4520
        /* Open file if closed */
 
4521
        fil_node_prepare_for_io(node, fil_system, space);
 
4522
        fil_node_complete_io(node, fil_system, OS_FILE_READ);
 
4523
 
 
4524
        /* Check that at least the start offset is within the bounds of a
 
4525
        single-table tablespace */
 
4526
        if (UNIV_UNLIKELY(node->size <= block_offset)
 
4527
            && space->id != 0 && space->purpose == FIL_TABLESPACE) {
 
4528
                mutex_exit(&fil_system->mutex);
 
4529
                return(false);
 
4530
        }
 
4531
 
 
4532
        mutex_exit(&fil_system->mutex);
 
4533
        return(true);
 
4534
}
 
4535
 
4476
4536
#ifndef UNIV_HOTBACKUP
4477
4537
/**********************************************************************//**
4478
4538
Waits for an aio operation to complete. This function is used to write the