~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-proposed

« back to all changes in this revision

Viewing changes to storage/innobase/buf/buf0buf.c

  • Committer: Package Import Robot
  • Author(s): Dave Chiluk, Eduardo Damato
  • Date: 2014-01-09 09:44:14 UTC
  • mfrom: (18.1.5 precise-security)
  • Revision ID: package-import@ubuntu.com-20140109094414-ght3gi7yvzsyvhm5
Tags: 5.5.34-0ubuntu0.12.04.2
[ Eduardo Damato ]
Fix upstart script to account for datadir disk shortage (LP: #1121874) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19
19
 
20
20
You should have received a copy of the GNU General Public License along with
21
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
21
this program; if not, write to the Free Software Foundation, Inc., 
 
22
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
23
 
24
24
*****************************************************************************/
25
25
 
2290
2290
                        buf_pool, space, offset, fold);
2291
2291
        }
2292
2292
 
2293
 
loop2:
2294
2293
        if (block && buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
2295
2294
                block = NULL;
2296
2295
        }
2407
2406
                        goto loop;
2408
2407
                }
2409
2408
 
 
2409
                /* Buffer-fix the block so that it cannot be evicted
 
2410
                or relocated while we are attempting to allocate an
 
2411
                uncompressed page. */
 
2412
                bpage->buf_fix_count++;
 
2413
 
2410
2414
                /* Allocate an uncompressed page. */
2411
2415
                buf_pool_mutex_exit(buf_pool);
2412
2416
                mutex_exit(&buf_pool->zip_mutex);
2416
2420
 
2417
2421
                buf_pool_mutex_enter(buf_pool);
2418
2422
                mutex_enter(&block->mutex);
2419
 
 
2420
 
                {
2421
 
                        buf_page_t*     hash_bpage;
2422
 
 
2423
 
                        hash_bpage = buf_page_hash_get_low(
2424
 
                                buf_pool, space, offset, fold);
2425
 
 
2426
 
                        if (UNIV_UNLIKELY(bpage != hash_bpage)) {
2427
 
                                /* The buf_pool->page_hash was modified
2428
 
                                while buf_pool->mutex was released.
2429
 
                                Free the block that was allocated. */
2430
 
 
2431
 
                                buf_LRU_block_free_non_file_page(block);
2432
 
                                mutex_exit(&block->mutex);
2433
 
 
2434
 
                                block = (buf_block_t*) hash_bpage;
2435
 
                                goto loop2;
2436
 
                        }
2437
 
                }
2438
 
 
2439
 
                if (UNIV_UNLIKELY
2440
 
                    (bpage->buf_fix_count
2441
 
                     || buf_page_get_io_fix(bpage) != BUF_IO_NONE)) {
2442
 
 
2443
 
                        /* The block was buffer-fixed or I/O-fixed
2444
 
                        while buf_pool->mutex was not held by this thread.
2445
 
                        Free the block that was allocated and try again.
2446
 
                        This should be extremely unlikely. */
 
2423
                mutex_enter(&buf_pool->zip_mutex);
 
2424
                /* Buffer-fixing prevents the page_hash from changing. */
 
2425
                ut_ad(bpage == buf_page_hash_get_low(buf_pool,
 
2426
                                                     space, offset, fold));
 
2427
 
 
2428
                if (--bpage->buf_fix_count
 
2429
                    || buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
 
2430
 
 
2431
                        mutex_exit(&buf_pool->zip_mutex);
 
2432
                        /* The block was buffer-fixed or I/O-fixed while
 
2433
                        buf_pool->mutex was not held by this thread.
 
2434
                        Free the block that was allocated and retry.
 
2435
                        This should be extremely unlikely, for example,
 
2436
                        if buf_page_get_zip() was invoked. */
2447
2437
 
2448
2438
                        buf_LRU_block_free_non_file_page(block);
2449
2439
                        mutex_exit(&block->mutex);
2454
2444
                /* Move the compressed page from bpage to block,
2455
2445
                and uncompress it. */
2456
2446
 
2457
 
                mutex_enter(&buf_pool->zip_mutex);
2458
 
 
2459
2447
                buf_relocate(bpage, &block->page);
2460
2448
                buf_block_init_low(block);
2461
2449
                block->lock_hash_val = lock_rec_hash(space, offset);