1500
1499
const module::option_map &vm= context.getOptions();
1502
if (vm.count("key-cache-block-size"))
1504
if (myisam_key_cache_block_size < 512 || myisam_key_cache_block_size > 16*1024)
1506
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for key-cache-block-size\n"));
1511
if (vm.count("key-cache-age-threshold"))
1513
if (myisam_key_cache_age_threshold < 100 || myisam_key_cache_age_threshold > UINT32_MAX)
1515
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for key-cache-age-threshold\n"));
1520
if (vm.count("key-cache-division-limit"))
1522
if (myisam_key_cache_division_limit < 1 || myisam_key_cache_division_limit > 100)
1524
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for key-cache-division-limit\n"));
1529
if (vm.count("key-cache-size"))
1531
if (myisam_key_cache_size < 1 * 1024 * 1024 || myisam_key_cache_size > UINT32_MAX)
1533
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for key-cache-size\n"));
1537
myisam_key_cache_size/= IO_SIZE;
1538
myisam_key_cache_size*= IO_SIZE;
1541
if (vm.count("repair-threads"))
1543
if (repair_threads < 1 || repair_threads > UINT32_MAX)
1545
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for repair-threads\n"));
1550
1501
if (vm.count("max-sort-file-size"))
1552
1503
if (max_sort_file_size > UINT64_MAX)
1575
static void sys_var_key_cache_size_update(Session *session, drizzle_sys_var *var, void *, const void *save)
1577
uint32_t tmp= *static_cast<const uint32_t *>(save);
1579
struct option option_limits;
1580
plugin_opt_set_limits(&option_limits, var);
1581
option_limits.name= "myisam_key_cache_size";
1583
myisam_key_cache_size= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
1587
static void sys_var_key_cache_block_size_update(Session *, drizzle_sys_var *var, void *, const void *)
1589
struct option option_limits;
1590
plugin_opt_set_limits(&option_limits, var);
1591
option_limits.name= "myisam_key_cache_block_size";
1595
static void sys_var_key_cache_division_limit_update(Session *, drizzle_sys_var *var, void *, const void *)
1597
struct option option_limits;
1598
plugin_opt_set_limits(&option_limits, var);
1599
option_limits.name= "myisam_key_cache_division_limit";
1603
static void sys_var_key_cache_age_threshold_update(Session *, drizzle_sys_var *var, void *, const void *)
1605
struct option option_limits;
1606
plugin_opt_set_limits(&option_limits, var);
1607
option_limits.name= "myisam_key_cache_age_threshold";
1610
static DRIZZLE_SYSVAR_UINT(key_cache_block_size,
1611
myisam_key_cache_block_size,
1612
PLUGIN_VAR_RQCMDARG,
1613
N_("Block size to be used for MyISAM index pages."),
1615
sys_var_key_cache_block_size_update,
1616
KEY_CACHE_BLOCK_SIZE,
1621
static DRIZZLE_SYSVAR_UINT(key_cache_age_threshold, myisam_key_cache_age_threshold,
1622
PLUGIN_VAR_RQCMDARG,
1623
N_("This characterizes the number of hits a hot block has to be untouched "
1624
"until it is considered aged enough to be downgraded to a warm block. "
1625
"This specifies the percentage ratio of that number of hits to the "
1626
"total number of blocks in key cache"),
1628
sys_var_key_cache_age_threshold_update,
1634
static DRIZZLE_SYSVAR_UINT(key_cache_division_limit, myisam_key_cache_division_limit,
1635
PLUGIN_VAR_RQCMDARG,
1636
N_("The minimum percentage of warm blocks in key cache"),
1638
sys_var_key_cache_division_limit_update,
1644
static DRIZZLE_SYSVAR_UINT(key_cache_size,
1645
myisam_key_cache_size,
1646
PLUGIN_VAR_RQCMDARG,
1647
N_("The size of the buffer used for index blocks for MyISAM tables. "
1648
"Increase this to get better index handling (for all reads and multiple "
1649
"writes) to as much as you can afford;"),
1651
sys_var_key_cache_size_update,
1657
static DRIZZLE_SYSVAR_UINT(repair_threads, repair_threads,
1658
PLUGIN_VAR_RQCMDARG,
1659
N_("Number of threads to use when repairing MyISAM tables. The value of "
1660
"1 disables parallel repair."),
1661
NULL, NULL, 1, 1, UINT32_MAX, 0);
1663
1526
static DRIZZLE_SYSVAR_ULONGLONG(max_sort_file_size, max_sort_file_size,
1664
1527
PLUGIN_VAR_RQCMDARG,
1665
1528
N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."),
1679
1542
static void init_options(drizzled::module::option_context &context)
1681
context("key-cache-block-size",
1682
po::value<uint32_t>(&myisam_key_cache_block_size)->default_value(KEY_CACHE_BLOCK_SIZE),
1683
N_("Block size to be used for MyISAM index pages."));
1684
context("key-cache-age-threshold",
1685
po::value<uint32_t>(&myisam_key_cache_age_threshold)->default_value(300),
1686
N_("This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache"));
1687
context("key-cache-division-limit",
1688
po::value<uint32_t>(&myisam_key_cache_division_limit)->default_value(100),
1689
N_("The minimum percentage of warm blocks in key cache"));
1690
context("key-cache-size",
1691
po::value<uint32_t>(&myisam_key_cache_size)->default_value(KEY_CACHE_SIZE),
1692
N_("The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford;"));
1693
context("repair-threads",
1694
po::value<uint32_t>(&repair_threads)->default_value(1),
1695
N_("Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair."));
1696
1544
context("max-sort-file-size",
1697
1545
po::value<uint64_t>(&max_sort_file_size)->default_value(INT32_MAX),
1698
1546
N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
1707
1555
static drizzle_sys_var* sys_variables[]= {
1708
DRIZZLE_SYSVAR(key_cache_block_size),
1709
DRIZZLE_SYSVAR(key_cache_size),
1710
DRIZZLE_SYSVAR(key_cache_division_limit),
1711
DRIZZLE_SYSVAR(key_cache_age_threshold),
1712
DRIZZLE_SYSVAR(repair_threads),
1713
1556
DRIZZLE_SYSVAR(max_sort_file_size),
1714
1557
DRIZZLE_SYSVAR(sort_buffer_size),
1715
1558
DRIZZLE_SYSVAR(data_pointer_size),