/******************************************************************//**
Try to free an uncompressed page of a compressed block from the unzip
LRU list.  The compressed page is preserved, and it need not be clean.
@return    TRUE if freed */
UNIV_INLINE
ibool
buf_LRU_free_from_unzip_LRU_list(
/*=============================*/
    buf_pool_t*    buf_pool,    /*!< in: buffer pool instance */
    ulint        n_iterations)    /*!< in: how many times this has
                    been called repeatedly without
                    result: a high value means that
                    we should search farther; we will
                    search n_iterations / 5 of the
                    unzip_LRU list, or nothing if
                    n_iterations >= 5 */
{
    buf_block_t*    block;
    ulint        distance;

    ut_ad(buf_pool_mutex_own(buf_pool));

    /* Theoratically it should be much easier to find a victim
    from unzip_LRU as we can choose even a dirty block (as we'll
    be evicting only the uncompressed frame).  In a very unlikely
    eventuality that we are unable to find a victim from
    unzip_LRU, we fall back to the regular LRU list.  We do this
    if we have done five iterations so far. */

    )
        || !buf_LRU_evict_from_unzip_LRU(buf_pool)) {

        return(FALSE);
    }

    distance =  +; //宏详见   for (block = UT_LIST_GET_LAST(buf_pool->unzip_LRU);
         UNIV_LIKELY(block != NULL) && UNIV_LIKELY(distance > );
         block = UT_LIST_GET_PREV(unzip_LRU, block), distance--) {

        ibool freed;

        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
        ut_ad(block->in_unzip_LRU_list);
        ut_ad(block->page.in_LRU_list);

        mutex_enter(&block->mutex);
        freed = buf_LRU_free_block(&block->page, FALSE); //这里
        mutex_exit(&block->mutex);

        if (freed) {
            return(TRUE);
        }
    }

    return(FALSE);
}

函数buf_LRU_free_from_unzip_LRU_list的更多相关文章

  1. Python 小而美的函数

    python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况   any any(iterable) ...

  2. 探究javascript对象和数组的异同,及函数变量缓存技巧

    javascript中最经典也最受非议的一句话就是:javascript中一切皆是对象.这篇重点要提到的,就是任何jser都不陌生的Object和Array. 有段时间曾经很诧异,到底两种数据类型用来 ...

  3. JavaScript权威指南 - 函数

    函数本身就是一段JavaScript代码,定义一次但可能被调用任意次.如果函数挂载在一个对象上,作为对象的一个属性,通常这种函数被称作对象的方法.用于初始化一个新创建的对象的函数被称作构造函数. 相对 ...

  4. C++对C的函数拓展

    一,内联函数 1.内联函数的概念 C++中的const常量可以用来代替宏常数的定义,例如:用const int a = 10来替换# define a 10.那么C++中是否有什么解决方案来替代宏代码 ...

  5. 菜鸟Python学习笔记第一天:关于一些函数库的使用

    2017年1月3日 星期二 大一学习一门新的计算机语言真的很难,有时候连函数拼写出错查错都能查半天,没办法,谁让我英语太渣. 关于计算机语言的学习我想还是从C语言学习开始为好,Python有很多语言的 ...

  6. javascript中的this与函数讲解

    前言 javascript中没有块级作用域(es6以前),javascript中作用域分为函数作用域和全局作用域.并且,大家可以认为全局作用域其实就是Window函数的函数作用域,我们编写的js代码, ...

  7. 复杂的 Hash 函数组合有意义吗?

    很久以前看到一篇文章,讲某个大网站储存用户口令时,会经过十分复杂的处理.怎么个复杂记不得了,大概就是先 Hash,结果加上一些特殊字符再 Hash,结果再加上些字符.再倒序.再怎么怎么的.再 Hash ...

  8. JS核心系列:浅谈函数的作用域

    一.作用域(scope) 所谓作用域就是:变量在声明它们的函数体以及这个函数体嵌套的任意函数体内都是有定义的. function scope(){ var foo = "global&quo ...

  9. C++中的时间函数

    C++获取时间函数众多,何时该用什么函数,拿到的是什么时间?该怎么用?很多人都会混淆. 本文是本人经历了几款游戏客户端和服务器开发后,对游戏中时间获取的一点总结. 最早学习游戏客户端时,为了获取最精确 ...

随机推荐

  1. 从零学起PHP

    数据库连接conn.php <?php //第一步:链接数据库 $conn=@mysql_connect("localhost:3306","root", ...

  2. sirius的python学习笔记(1)

    1.可以通过try...except语句来简单的判断字符串是否为整数值,如例程 x = raw_input('>') try: print int(x) except ValueError: r ...

  3. 在fedora 桌面上添加应用程序

    在网上下了个android studio,这个程序只是的压缩包,解压后程序也只能在SHELL下敲入studio.sh才能运行 能不能向其他程序一样,在fedora桌面上找到应用程序,点击执行呢.在网上 ...

  4. PL/SQL中如何执行DDL、SCL?

    PL/SQL程序中不能直接执行DDL语句.为什么? 假设我们在pl/sql程序中有这样的一条DDL语句—— drop table emp:在第一次解析pl/sql中的“drop table emp;” ...

  5. ASIHTTPRequest的使用(转)

    转载自:http://fushengfei.iteye.com/blog/1147112 博客分类: IOS   原文地址:http://wiki.magiche.net/pages/viewpage ...

  6. sharepoint 2010 masterpage中必须的Content PlaceHolder

    Professional SharePoint 2010 Branding and Use

  7. shell 实现word count

    awk '{arr[$2]+=$1}END{for (i in arr) print i,arr[i]}' sort_all.txt | sort -k2nr -g

  8. ORA-01034:oracle不可用 的解决方法

    晚上打开SQLPlus输入用户名和密码老是登不了,出现如上一行代码 "ORA-01034:ORACLE不可用"的错误 解决思路: 1.检查服务是否启动, 2.如果已经启动,说明数据 ...

  9. JS、C# 去除html标签

    JS去除html标签 var str = "<span style="display:none;" mce_style="display:none;&qu ...

  10. poj 2060 Taxi Cab Scheme (最小路径覆盖)

    http://poj.org/problem?id=2060 Taxi Cab Scheme Time Limit: 1000MS   Memory Limit: 30000K Total Submi ...