• marko's avatar
    branches/innodb+: Implement the buf_pool_watch for DeleteBuffering in · 3d9f3eed
    marko authored
    the page hash table. This serves two purposes. It allows multiple
    watches to be set at the same time (by multiple purge threads) and it
    removes a race condition when the read of a block completes about the
    time the buffer pool watch is being set.
    
    buf_pool_watch_clear(): Rename to buf_pool_watch_unset(). Add
    parameters space, offset.
    
    buf_pool_watch_remove(): A helper function for removing the watch.
    
    buf_pool_watch_is(): A predicate for testing if a block descriptor is
    a sentinel for the buffer pool watch.
    
    buf_pool_watch[BUF_POOL_WATCH_SIZE]: An array of sentinel block descriptors.
    
    buf_pool_watch_set(): Add a parameter for the fold value, and return
    the block if the block is in the buffer pool. Allocate the sentinel
    from buf_pool_watch[] if needed. Use buf_fix_count for
    reference-counting.
    
    enum buf_block_state: Add BUF_BLOCK_POOL_WATCH as a state alias that
    is shared with BUF_BLOCK_ZIP_FREE.
    
    buf_page_hash_get_low(): A low-level variant of buf_page_hash_get()
    that takes the fold value as a parameter and may return a watch
    sentinel block. In callers, test the return value for
    buf_pool_watch_is() [impossible cases with ut_ad(), possible ones with if].
    When needed, invoke buf_pool_watch_remove() but preserve the buf_fix_count.
    
    buf_page_hash_get(), buf_block_hash_get(): Return NULL for watch
    sentinel blocks, to keep existing behaviour.
    
    buf_page_init(): Add a parameter for the fold value.
    
    ibuf_insert(): If a buffer pool watch exists for the block, refuse to
    buffer subsequent operations, so that the purge that is being buffered
    will not "overtake" later requests. Previously, we would notify the
    watch in this case. Either way, the block would be read to the buffer
    pool. In the current design, we can only notify the watch by actually
    setting up a real block in buf_pool->page_hash.
    
    rb://263 approved by Inaam Rana
    3d9f3eed
buf0buf.ic 28.3 KB