~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.cc

  • Committer: Brian Aker
  • Date: 2010-08-09 16:50:51 UTC
  • mto: (1698.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 1699.
  • Revision ID: brian@gaz-20100809165051-wd7cjrnjn65b3zdc
Use local key_Cache, global now goes away.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
  virtual ~MyisamEngine()
105
105
  { 
106
106
    pthread_mutex_destroy(&THR_LOCK_myisam);
107
 
    end_key_cache(dflt_key_cache, 1);           // Can never fail
108
107
 
109
108
    mi_panic(HA_PANIC_CLOSE);
110
109
  }
1569
1568
  engine= new MyisamEngine(engine_name);
1570
1569
  context.add(engine);
1571
1570
 
1572
 
  /* call ha_init_key_cache() on all key caches to init them */
1573
 
  int error= init_key_cache(dflt_key_cache,
1574
 
                            myisam_key_cache_block_size,
1575
 
                            myisam_key_cache_size,
1576
 
                            myisam_key_cache_division_limit, 
1577
 
                            myisam_key_cache_age_threshold);
1578
 
 
1579
 
  if (error == 0)
1580
 
    exit(1); /* Memory Allocation Failure */
1581
 
 
1582
1571
  return 0;
1583
1572
}
1584
1573
 
1586
1575
static void sys_var_key_cache_size_update(Session *session, drizzle_sys_var *var, void *, const void *save)
1587
1576
{
1588
1577
  uint32_t tmp= *static_cast<const uint32_t *>(save);
1589
 
  bool error= 0;
1590
1578
 
1591
1579
        struct option option_limits;
1592
1580
  plugin_opt_set_limits(&option_limits, var);
1593
1581
        option_limits.name= "myisam_key_cache_size";
1594
1582
 
1595
 
  if (dflt_key_cache->in_init)
1596
 
    return;
1597
 
 
1598
1583
  myisam_key_cache_size= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
1599
1584
 
1600
 
  /* If key cache didn't existed initialize it, else resize it */
1601
 
  dflt_key_cache->in_init= 1;
1602
 
 
1603
 
  error= ! resize_key_cache(dflt_key_cache,
1604
 
                                                                                                                myisam_key_cache_block_size,
1605
 
                            myisam_key_cache_size,
1606
 
                            myisam_key_cache_division_limit,
1607
 
                                                                                                          myisam_key_cache_age_threshold);
1608
 
  dflt_key_cache->in_init= 0;
1609
1585
}
1610
1586
 
1611
 
static void sys_var_key_cache_block_size_update(Session *session, drizzle_sys_var *var, void *, const void *save)
 
1587
static void sys_var_key_cache_block_size_update(Session *, drizzle_sys_var *var, void *, const void *)
1612
1588
{
1613
 
  uint32_t tmp= *static_cast<const uint32_t *>(save);
1614
 
  bool error= 0;
1615
 
 
1616
1589
        struct option option_limits;
1617
1590
  plugin_opt_set_limits(&option_limits, var);
1618
1591
        option_limits.name= "myisam_key_cache_block_size";
1619
1592
 
1620
 
  if (dflt_key_cache->in_init)
1621
 
    return;
1622
 
 
1623
 
  myisam_key_cache_block_size= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
1624
 
 
1625
 
  dflt_key_cache->in_init= 1;
1626
 
 
1627
 
  error= ! resize_key_cache(dflt_key_cache,
1628
 
                                                                                                                myisam_key_cache_block_size,
1629
 
                            myisam_key_cache_size,
1630
 
                            myisam_key_cache_division_limit,
1631
 
                                                                                                          myisam_key_cache_age_threshold);
1632
 
 
1633
 
  dflt_key_cache->in_init= 0;
1634
1593
}
1635
1594
 
1636
 
static void sys_var_key_cache_division_limit_update(Session *session, drizzle_sys_var *var, void *, const void *save)
 
1595
static void sys_var_key_cache_division_limit_update(Session *, drizzle_sys_var *var, void *, const void *)
1637
1596
{
1638
 
  uint32_t tmp= *static_cast<const uint32_t *>(save);
1639
 
  bool error= 0;
1640
 
 
1641
1597
        struct option option_limits;
1642
1598
  plugin_opt_set_limits(&option_limits, var);
1643
1599
        option_limits.name= "myisam_key_cache_division_limit";
1644
1600
 
1645
 
  if (dflt_key_cache->in_init)
1646
 
    return;
1647
 
 
1648
 
  myisam_key_cache_division_limit= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
1649
 
 
1650
 
  dflt_key_cache->in_init= 1;
1651
 
 
1652
 
  error= ! resize_key_cache(dflt_key_cache,
1653
 
                                                                                                                myisam_key_cache_block_size,
1654
 
                            myisam_key_cache_size,
1655
 
                            myisam_key_cache_division_limit,
1656
 
                                                                                                          myisam_key_cache_age_threshold);
1657
 
 
1658
 
  dflt_key_cache->in_init= 0;
1659
1601
}
1660
1602
 
1661
 
static void sys_var_key_cache_age_threshold_update(Session *session, drizzle_sys_var *var, void *, const void *save)
 
1603
static void sys_var_key_cache_age_threshold_update(Session *, drizzle_sys_var *var, void *, const void *)
1662
1604
{
1663
 
  uint32_t tmp= *static_cast<const uint32_t *>(save);
1664
 
  bool error= 0;
1665
 
 
1666
 
        struct option option_limits;
 
1605
  struct option option_limits;
1667
1606
  plugin_opt_set_limits(&option_limits, var);
1668
 
        option_limits.name= "myisam_key_cache_age_threshold";
1669
 
 
1670
 
  if (dflt_key_cache->in_init)
1671
 
    return;
1672
 
 
1673
 
  myisam_key_cache_age_threshold= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
1674
 
 
1675
 
  dflt_key_cache->in_init= 1;
1676
 
 
1677
 
  error= ! resize_key_cache(dflt_key_cache,
1678
 
                                                                                                                myisam_key_cache_block_size,
1679
 
                            myisam_key_cache_size,
1680
 
                            myisam_key_cache_division_limit,
1681
 
                                                                                                          myisam_key_cache_age_threshold);
1682
 
 
1683
 
  dflt_key_cache->in_init= 0;
 
1607
  option_limits.name= "myisam_key_cache_age_threshold";
1684
1608
}
1685
1609
 
1686
1610
static DRIZZLE_SYSVAR_UINT(key_cache_block_size,