1
1
/*****************************************************************************
3
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
326
326
ulint space, /*!< in: space */
327
327
ulint zip_size,/*!< in: compressed page size in bytes
328
328
or 0 for uncompressed pages */
329
fseg_inode_t* seg_inode, /*!< in: segment inode */
329
fseg_inode_t* seg_inode, /*!< in/out: segment inode */
330
330
ulint hint, /*!< in: hint of which page would be desirable */
331
331
byte direction, /*!< in: if the new page is needed because
332
332
of an index page split, and records are
333
333
inserted there in order, into which
334
334
direction they go alphabetically: FSP_DOWN,
335
335
FSP_UP, FSP_NO_DIR */
336
mtr_t* mtr); /*!< in: mtr handle */
336
mtr_t* mtr); /*!< in/out: mini-transaction */
337
337
#endif /* !UNIV_HOTBACKUP */
339
339
/**********************************************************************//**
1548
1548
ulint zip_size,/*!< in: compressed page size in bytes
1549
1549
or 0 for uncompressed pages */
1550
1550
ulint hint, /*!< in: hint of which page would be desirable */
1551
mtr_t* mtr) /*!< in: mtr handle */
1551
mtr_t* mtr) /*!< in/out: mini-transaction */
1553
1553
fsp_header_t* header;
1554
1554
fil_addr_t first;
2572
2572
ulint space, /*!< in: space */
2573
2573
ulint zip_size,/*!< in: compressed page size in bytes
2574
2574
or 0 for uncompressed pages */
2575
fseg_inode_t* seg_inode, /*!< in: segment inode */
2575
fseg_inode_t* seg_inode, /*!< in/out: segment inode */
2576
2576
ulint hint, /*!< in: hint of which page would be desirable */
2577
2577
byte direction, /*!< in: if the new page is needed because
2578
2578
of an index page split, and records are
2579
2579
inserted there in order, into which
2580
2580
direction they go alphabetically: FSP_DOWN,
2581
2581
FSP_UP, FSP_NO_DIR */
2582
mtr_t* mtr) /*!< in: mtr handle */
2582
mtr_t* mtr) /*!< in/out: mini-transaction */
2584
2584
fsp_header_t* space_header;
2585
2585
ulint space_size;
2818
2816
fseg_alloc_free_page_general(
2819
2817
/*=========================*/
2820
fseg_header_t* seg_header,/*!< in: segment header */
2818
fseg_header_t* seg_header,/*!< in/out: segment header */
2821
2819
ulint hint, /*!< in: hint of which page would be desirable */
2822
2820
byte direction,/*!< in: if the new page is needed because
2823
2821
of an index page split, and records are
3103
3101
ut_ad(!mutex_own(&kernel_mutex));
3103
/* The convoluted mutex acquire is to overcome latching order
3104
issues: The problem is that the fil_mutex is at a lower level
3105
than the tablespace latch and the buffer pool mutex. We have to
3106
first prevent any operations on the file system by acquiring the
3107
dictionary mutex. Then acquire the tablespace latch to obey the
3108
latching order and then release the dictionary mutex. That way we
3109
ensure that the tablespace instance can't be freed while we are
3110
examining its contents (see fil_space_free()).
3112
However, there is one further complication, we release the fil_mutex
3113
when we need to invalidate the the pages in the buffer pool and we
3114
reacquire the fil_mutex when deleting and freeing the tablespace
3115
instance in fil0fil.c. Here we need to account for that situation
3118
mutex_enter(&dict_sys->mutex);
3120
/* At this stage there is no guarantee that the tablespace even
3121
exists in the cache. */
3123
if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) {
3125
mutex_exit(&dict_sys->mutex);
3127
return(ULLINT_UNDEFINED);
3105
3130
mtr_start(&mtr);
3107
3132
latch = fil_space_get_latch(space, &flags);
3134
/* This should ensure that the tablespace instance can't be freed
3135
by another thread. However, the tablespace pages can still be freed
3136
from the buffer pool. We need to check for that again. */
3108
3138
zip_size = dict_table_flags_to_zip_size(flags);
3110
3140
mtr_x_lock(latch, &mtr);
3142
mutex_exit(&dict_sys->mutex);
3144
/* At this point it is possible for the tablespace to be deleted and
3145
its pages removed from the buffer pool. We need to check for that
3146
situation. However, the tablespace instance can't be deleted because
3147
our latching above should ensure that. */
3149
if (fil_tablespace_is_being_deleted(space)) {
3153
return(ULLINT_UNDEFINED);
3156
/* From here on even if the user has dropped the tablespace, the
3157
pages _must_ still exist in the buffer pool and the tablespace
3158
instance _must_ be in the file system hash table. */
3112
3160
space_header = fsp_get_space_header(space, zip_size, &mtr);
3114
3162
size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, &mtr);
3276
3324
"InnoDB: database!\n", (ulong) page);
3278
3326
fputs("InnoDB: Please refer to\n"
3279
"InnoDB: " REFMAN "forcing-recovery.html\n"
3327
"InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
3280
3328
"InnoDB: about forcing recovery.\n", stderr);
3395
3443
fseg_free_page_low(seg_inode, space, zip_size, page, mtr);
3397
#ifdef UNIV_DEBUG_FILE_ACCESSES
3445
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
3398
3446
buf_page_set_file_page_was_freed(space, page);
3447
#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
3402
3450
/**********************************************************************//**
3464
3512
fsp_free_extent(space, zip_size, page, mtr);
3466
#ifdef UNIV_DEBUG_FILE_ACCESSES
3514
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
3467
3515
for (i = 0; i < FSP_EXTENT_SIZE; i++) {
3469
3517
buf_page_set_file_page_was_freed(space,
3470
3518
first_page_in_extent + i);
3520
#endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
3475
3523
/**********************************************************************//**