~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/buf/buf0buddy.c

Merge Revision revid:marko.makela@oracle.com-20100601140355-u3kxl0yl0ljl5tx9 from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100601140355-u3kxl0yl0ljl5tx9

Original Authors: Marko Mäkelä <marko.makela@oracle.com>
Original commit message:
Merge a change from mysql-5.1-innodb:

  ------------------------------------------------------------
  revno: 3491
  revision-id: marko.makela@oracle.com-20100601134335-ccthwwru23kn09qw
  parent: marko.makela@oracle.com-20100601120751-1uq7bbta5n7ts0qr
  committer: Marko Mäkelä <marko.makela@oracle.com>
  branch nick: 5.1-innodb
  timestamp: Tue 2010-06-01 16:43:35 +0300
  message:
    Bug#48197: Concurrent rw_lock_free may cause assertion failure

    rw_lock_t: Remove magic_n unless UNIV_DEBUG is defined.
    rw_lock_free(): Invalidate magic_n only after removing from rw_lock_list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 2006, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved.
4
4
 
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
146
146
                buf_buddy_remove_from_free(buf_pool, bpage, i);
147
147
        } else if (i + 1 < BUF_BUDDY_SIZES) {
148
148
                /* Attempt to split. */
149
 
                bpage = (buf_page_t *)buf_buddy_alloc_zip(buf_pool, i + 1);
 
149
                bpage = buf_buddy_alloc_zip(buf_pool, i + 1);
150
150
 
151
151
                if (bpage) {
152
152
                        buf_page_t*     buddy = (buf_page_t*)
281
281
 
282
282
/**********************************************************************//**
283
283
Allocate a block.  The thread calling this function must hold
284
 
buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
 
284
buf_pool->mutex and must not hold buf_pool_zip_mutex or any block->mutex.
285
285
The buf_pool->mutex may only be released and reacquired if lru != NULL.
286
286
@return allocated block, possibly NULL if lru==NULL */
287
287
UNIV_INTERN
305
305
 
306
306
        if (i < BUF_BUDDY_SIZES) {
307
307
                /* Try to allocate from the buddy system. */
308
 
                block = (buf_block_t *)buf_buddy_alloc_zip(buf_pool, i);
 
308
                block = buf_buddy_alloc_zip(buf_pool, i);
309
309
 
310
310
                if (block) {
311
311
                        goto func_exit;
334
334
alloc_big:
335
335
        buf_buddy_block_register(block);
336
336
 
337
 
        block = (buf_block_t *)buf_buddy_alloc_from(buf_pool, block->frame,
338
 
                                                    i, BUF_BUDDY_SIZES);
 
337
        block = buf_buddy_alloc_from(
 
338
                buf_pool, block->frame, i, BUF_BUDDY_SIZES);
339
339
 
340
340
func_exit:
341
341
        buf_pool->buddy_stat[i].used++;
413
413
                                        buf_pool->zip_free[] */
414
414
{
415
415
        buf_page_t*     bpage;
416
 
        ulint           space= 0;
417
 
        ulint           page_no= 0;
418
416
        const ulint     size    = BUF_BUDDY_LOW << i;
419
417
        ullint          usec    = ut_time_us(NULL);
420
418
 
448
446
                pool), so there is nothing wrong about this.  The
449
447
                mach_read_from_4() calls here will only trigger bogus
450
448
                Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
451
 
                space   = mach_read_from_4(
 
449
                ulint           space   = mach_read_from_4(
452
450
                        (const byte*) src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
453
 
                page_no = mach_read_from_4(
 
451
                ulint           page_no = mach_read_from_4(
454
452
                        (const byte*) src + FIL_PAGE_OFFSET);
455
453
                /* Suppress Valgrind warnings about conditional jump
456
454
                on uninitialized value. */
490
488
                        /* Relocate the compressed page. */
491
489
                        ut_a(bpage->zip.data == src);
492
490
                        memcpy(dst, src, size);
493
 
                        bpage->zip.data = (page_zip_t *)dst;
 
491
                        bpage->zip.data = dst;
494
492
                        mutex_exit(mutex);
495
493
success:
496
494
                        UNIV_MEM_INVALID(src, size);
513
511
                about uninitialized pad bytes. */
514
512
                UNIV_MEM_ASSERT_RW(src, size);
515
513
#endif
516
 
                if (buf_buddy_relocate_block((buf_page_t *)src, (buf_page_t *)dst)) {
 
514
                if (buf_buddy_relocate_block(src, dst)) {
517
515
 
518
516
                        goto success;
519
517
                }
655
653
        }
656
654
 
657
655
        /* Free the block to the buddy list. */
658
 
        bpage = (buf_page_t *)buf;
 
656
        bpage = buf;
659
657
#ifdef UNIV_DEBUG
660
658
        if (i < buf_buddy_get_slot(PAGE_ZIP_MIN_SIZE)) {
661
659
                /* This area has most likely been allocated for at