~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

mergeĀ lp:~linuxjedi/drizzle/trunk-remove-drizzleadmin

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
/********************************************************************//**
3448
3449
idea is to read as much good data as we can and jump over bad data.
3449
3450
@return 0 if ok, -1 if error even after the retries, 1 if at the end
3450
3451
of the directory */
3451
 
static
3452
3452
int
3453
3453
fil_file_readdir_next_file(
3454
3454
/*=======================*/
4473
4473
        return(DB_SUCCESS);
4474
4474
}
4475
4475
 
 
4476
/********************************************************************//**
 
4477
Confirm whether the parameters are valid or not */
 
4478
UNIV_INTERN
 
4479
bool
 
4480
fil_is_exist(
 
4481
/*=========*/
 
4482
        ulint   space_id,       /*!< in: space id */
 
4483
        ulint   block_offset)   /*!< in: offset in number of blocks */
 
4484
{
 
4485
        fil_space_t*    space;
 
4486
        fil_node_t*     node;
 
4487
 
 
4488
        /* Reserve the fil_system mutex and make sure that we can open at
 
4489
        least one file while holding it, if the file is not already open */
 
4490
 
 
4491
        fil_mutex_enter_and_prepare_for_io(space_id);
 
4492
 
 
4493
        space = fil_space_get_by_id(space_id);
 
4494
 
 
4495
        if (!space) {
 
4496
                mutex_exit(&fil_system->mutex);
 
4497
                return(false);
 
4498
        }
 
4499
 
 
4500
        node = UT_LIST_GET_FIRST(space->chain);
 
4501
 
 
4502
        for (;;) {
 
4503
                if (UNIV_UNLIKELY(node == NULL)) {
 
4504
                        mutex_exit(&fil_system->mutex);
 
4505
                        return(false);
 
4506
                }
 
4507
 
 
4508
                if (space->id != 0 && node->size == 0) {
 
4509
                        /* We do not know the size of a single-table tablespace
 
4510
                        before we open the file */
 
4511
 
 
4512
                        break;
 
4513
                }
 
4514
 
 
4515
                if (node->size > block_offset) {
 
4516
                        /* Found! */
 
4517
                        break;
 
4518
                } else {
 
4519
                        block_offset -= node->size;
 
4520
                        node = UT_LIST_GET_NEXT(chain, node);
 
4521
                }
 
4522
        }
 
4523
 
 
4524
        /* Open file if closed */
 
4525
        fil_node_prepare_for_io(node, fil_system, space);
 
4526
        fil_node_complete_io(node, fil_system, OS_FILE_READ);
 
4527
 
 
4528
        /* Check that at least the start offset is within the bounds of a
 
4529
        single-table tablespace */
 
4530
        if (UNIV_UNLIKELY(node->size <= block_offset)
 
4531
            && space->id != 0 && space->purpose == FIL_TABLESPACE) {
 
4532
                mutex_exit(&fil_system->mutex);
 
4533
                return(false);
 
4534
        }
 
4535
 
 
4536
        mutex_exit(&fil_system->mutex);
 
4537
        return(true);
 
4538
}
 
4539
 
4476
4540
#ifndef UNIV_HOTBACKUP
4477
4541
/**********************************************************************//**
4478
4542
Waits for an aio operation to complete. This function is used to write the