~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/srv/srv0srv.cc

Merge in Percona's innodb_lru_dump_restore.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
355
355
reading of a disk page */
356
356
UNIV_INTERN ulint srv_buf_pool_reads = 0;
357
357
 
 
358
/** Time in seconds between automatic buffer pool dumps */
 
359
UNIV_INTERN uint srv_auto_lru_dump = 0;
 
360
 
358
361
/* structure to pass status variables to MySQL */
359
362
UNIV_INTERN export_struc export_vars;
360
363
 
2471
2474
        OS_THREAD_DUMMY_RETURN;
2472
2475
}
2473
2476
 
 
2477
/*********************************************************************//**
 
2478
A thread which restores the buffer pool from a dump file on startup and does
 
2479
periodic buffer pool dumps.
 
2480
@return a dummy parameter */
 
2481
UNIV_INTERN
 
2482
os_thread_ret_t
 
2483
srv_LRU_dump_restore_thread(
 
2484
/*====================*/
 
2485
        void*   /*arg __attribute__((unused))*/)
 
2486
/*!< in: a dummy parameter required by
 
2487
os_thread_create */
 
2488
{
 
2489
        uint    auto_lru_dump;
 
2490
        time_t  last_dump_time;
 
2491
        time_t  time_elapsed;
 
2492
 
 
2493
#ifdef UNIV_DEBUG_THREAD_CREATION
 
2494
        fprintf(stderr, "The LRU dump/restore thread has started, id %lu\n",
 
2495
                os_thread_pf(os_thread_get_curr_id()));
 
2496
#endif
 
2497
 
 
2498
        if (srv_auto_lru_dump)
 
2499
                buf_LRU_file_restore();
 
2500
 
 
2501
        last_dump_time = time(NULL);
 
2502
 
 
2503
loop:
 
2504
        os_thread_sleep(5000000);
 
2505
 
 
2506
        if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) {
 
2507
                goto exit_func;
 
2508
        }
 
2509
 
 
2510
        time_elapsed = time(NULL) - last_dump_time;
 
2511
        auto_lru_dump = srv_auto_lru_dump;
 
2512
        if (auto_lru_dump > 0 && (time_t) auto_lru_dump < time_elapsed) {
 
2513
                last_dump_time = time(NULL);
 
2514
                buf_LRU_file_dump();
 
2515
        }
 
2516
 
 
2517
        goto loop;
 
2518
exit_func:
 
2519
        /* We count the number of threads in os_thread_exit(). A created
 
2520
        thread should always use that to exit and not use return() to exit. */
 
2521
 
 
2522
        os_thread_exit(NULL);
 
2523
 
 
2524
        OS_THREAD_DUMMY_RETURN;
 
2525
}
 
2526
 
2474
2527
/**********************************************************************//**
2475
2528
Check whether any background thread is active.
2476
2529
@return FALSE if all are are suspended or have exited. */