~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2011-03-07 00:00:30 UTC
  • mto: (2222.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2223.
  • Revision ID: mordred@inaugust.com-20110307000030-azwm7jr14o33arxw
Also trap the other one.

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"
44
43
#ifndef UNIV_HOTBACKUP
45
44
# include "buf0lru.h"
46
45
# include "ibuf0ibuf.h"
298
297
 
299
298
/** The tablespace memory cache. This variable is NULL before the module is
300
299
initialized. */
301
 
fil_system_t*   fil_system      = NULL;
 
300
static fil_system_t*    fil_system      = NULL;
302
301
 
303
302
 
304
303
/********************************************************************//**
641
640
        fil_system_t*   system, /*!< in: tablespace memory cache */
642
641
        fil_space_t*    space)  /*!< in: space */
643
642
{
644
 
        uint64_t        size_bytes;
 
643
        ib_int64_t      size_bytes;
645
644
        ulint           size_low;
646
645
        ulint           size_high;
647
646
        ibool           ret;
683
682
 
684
683
                os_file_get_size(node->handle, &size_low, &size_high);
685
684
 
686
 
                size_bytes = (((uint64_t)size_high) << 32) + size_low;
 
685
                size_bytes = (((ib_int64_t)size_high) << 32)
 
686
                        + (ib_int64_t)size_low;
687
687
#ifdef UNIV_HOTBACKUP
688
688
                if (space->id == 0) {
689
 
                        node->size = size_bytes / UNIV_PAGE_SIZE;
 
689
                        node->size = (ulint) (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
 
        uint64_t        size;
 
3188
        ib_int64_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
3451
3452
int
3452
3453
fil_file_readdir_next_file(
3453
3454
/*=======================*/
4304
4305
        ut_ad(ut_is_2pow(zip_size));
4305
4306
        ut_ad(buf);
4306
4307
        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
4307
4311
        ut_ad(fil_validate());
4308
4312
#ifndef UNIV_HOTBACKUP
4309
4313
# ifndef UNIV_LOG_DEBUG
4469
4473
        return(DB_SUCCESS);
4470
4474
}
4471
4475
 
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
 
 
4536
4476
#ifndef UNIV_HOTBACKUP
4537
4477
/**********************************************************************//**
4538
4478
Waits for an aio operation to complete. This function is used to write the