~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/ha_innodb.cc

  • Committer: Brian Aker
  • Date: 2010-12-07 09:12:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1985.
  • Revision ID: brian@tangent.org-20101207091212-1m0w20tck6z7632m
This is a fix for bug lp:686197

Show diffs side-by-side

added added

removed removed

Lines of Context:
179
179
static plugin::TableFunction* innodb_sys_foreign_tool= NULL;
180
180
static plugin::TableFunction* innodb_sys_foreign_cols_tool= NULL;
181
181
 
182
 
static ReplicationLog *replication_logger= NULL;
183
 
typedef constrained_check<uint32_t, UINT32_MAX, 10> open_files_constraint;
184
 
static open_files_constraint innobase_open_files;
185
 
typedef constrained_check<uint32_t, 10, 1> mirrored_log_groups_constraint;
186
 
static mirrored_log_groups_constraint innobase_mirrored_log_groups;
187
 
typedef constrained_check<uint32_t, 100, 2> log_files_in_group_constraint;
188
 
static log_files_in_group_constraint innobase_log_files_in_group;
189
 
typedef constrained_check<uint32_t, 6, 0> force_recovery_constraint;
190
 
force_recovery_constraint innobase_force_recovery;
191
 
typedef constrained_check<size_t, SIZE_MAX, 256*1024, 1024> log_buffer_constraint;
192
 
static log_buffer_constraint innobase_log_buffer_size;
193
 
typedef constrained_check<size_t, SIZE_MAX, 512*1024, 1024> additional_mem_pool_constraint;
194
 
static additional_mem_pool_constraint innobase_additional_mem_pool_size;
195
 
typedef constrained_check<unsigned int, 1000, 1> autoextend_constraint;
196
 
static autoextend_constraint innodb_auto_extend_increment;
197
 
typedef constrained_check<size_t, SIZE_MAX, 5242880, 1048576> buffer_pool_constraint;
198
 
static buffer_pool_constraint innobase_buffer_pool_size;
199
 
typedef constrained_check<uint32_t, MAX_BUFFER_POOLS, 1> buffer_pool_instances_constraint;
200
 
static buffer_pool_instances_constraint innobase_buffer_pool_instances;
201
 
typedef constrained_check<uint32_t, UINT32_MAX, 100> io_capacity_constraint;
202
 
static io_capacity_constraint innodb_io_capacity;
203
 
typedef constrained_check<uint32_t, 5000, 1> purge_batch_constraint;
204
 
static purge_batch_constraint innodb_purge_batch_size;
205
 
typedef constrained_check<uint32_t, 1, 0> purge_threads_constraint;
206
 
static purge_threads_constraint innodb_n_purge_threads;
207
 
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
208
 
static trinary_constraint innodb_flush_log_at_trx_commit;
209
 
typedef constrained_check<unsigned int, 99, 0> max_dirty_pages_constraint;
210
 
static max_dirty_pages_constraint innodb_max_dirty_pages_pct;
211
 
static uint64_constraint innodb_max_purge_lag;
212
 
static uint64_nonzero_constraint innodb_stats_sample_pages;
213
 
typedef constrained_check<uint32_t, 64, 1> io_threads_constraint;
214
 
static io_threads_constraint innobase_read_io_threads;
215
 
static io_threads_constraint innobase_write_io_threads;
216
 
 
217
 
typedef constrained_check<uint32_t, 1000, 0> concurrency_constraint;
218
 
static concurrency_constraint innobase_commit_concurrency;
219
 
static concurrency_constraint innobase_thread_concurrency;
220
 
static uint32_nonzero_constraint innodb_concurrency_tickets;
221
 
 
222
 
typedef constrained_check<int64_t, INT64_MAX, 1024*1024, 1024*1024> log_file_constraint;
223
 
static log_file_constraint innobase_log_file_size;
224
 
 
225
 
static uint64_constraint innodb_replication_delay;
 
182
static plugin::TransactionApplier *replication_logger= NULL;
 
183
 
 
184
static long innobase_mirrored_log_groups, innobase_log_files_in_group,
 
185
  innobase_log_buffer_size,
 
186
  innobase_force_recovery, innobase_open_files;
 
187
static long innobase_additional_mem_pool_size= 8*1024*1024L;
 
188
static ulong innobase_commit_concurrency = 0;
 
189
static ulong innobase_read_io_threads;
 
190
static ulong innobase_write_io_threads;
 
191
static int64_t innobase_buffer_pool_instances = 1;
 
192
 
 
193
/**
 
194
 * @TODO: Turn this into size_t as soon as we have a Variable<size_t>
 
195
 */
 
196
static int64_t innobase_buffer_pool_size= 128*1024*1024;
 
197
static int64_t innobase_log_file_size;
226
198
 
227
199
/** Percentage of the buffer pool to reserve for 'old' blocks.
228
200
Connected to buf_LRU_old_ratio. */
229
 
typedef constrained_check<uint32_t, 95, 5> old_blocks_constraint;
230
 
static old_blocks_constraint innobase_old_blocks_pct;
231
 
 
232
 
static uint32_constraint innodb_sync_spin_loops;
233
 
static uint32_constraint innodb_spin_wait_delay;
234
 
static uint32_constraint innodb_thread_sleep_delay;
235
 
 
236
 
typedef constrained_check<uint32_t, 64, 0> read_ahead_threshold_constraint;
237
 
static read_ahead_threshold_constraint innodb_read_ahead_threshold;
 
201
static uint innobase_old_blocks_pct;
238
202
 
239
203
/* The default values for the following char* start-up parameters
240
204
are determined in innobase_init below: */
242
206
std::string innobase_data_home_dir;
243
207
std::string innobase_data_file_path;
244
208
std::string innobase_log_group_home_dir;
245
 
static string innobase_file_format_name;
246
 
static string innobase_change_buffering;
 
209
static char* innobase_file_format_name= NULL;
 
210
static char* innobase_change_buffering= NULL;
247
211
 
248
212
/* The highest file format being used in the database. The value can be
249
213
set by user, however, it will be adjusted to the newer file format if
250
214
a table of such format is created/opened. */
251
 
static string innobase_file_format_max;
 
215
static char* innobase_file_format_max= NULL;
 
216
 
 
217
std::string  innobase_log_arch_dir;
252
218
 
253
219
/* Below we have boolean-valued start-up parameters, and their default
254
220
values */
255
221
 
256
 
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
257
 
static trinary_constraint innobase_fast_shutdown;
258
 
 
259
 
/* "innobase_file_format_check" decides whether we would continue
260
 
booting the server if the file format stamped on the system
261
 
table space exceeds the maximum file format supported
262
 
by the server. Can be set during server startup at command
263
 
line or configure file, and a read only variable after
264
 
server startup */
265
 
 
266
 
/* If a new file format is introduced, the file format
267
 
name needs to be updated accordingly. Please refer to
268
 
file_format_name_map[] defined in trx0sys.c for the next
269
 
file format name. */
270
 
 
 
222
static ulong  innobase_fast_shutdown      = 1;
271
223
static my_bool  innobase_file_format_check = TRUE;
 
224
#ifdef UNIV_LOG_ARCHIVE
 
225
static my_bool  innobase_log_archive= FALSE;
 
226
#endif /* UNIV_LOG_ARCHIVE */
272
227
static my_bool  innobase_use_doublewrite    = TRUE;
273
228
static my_bool  innobase_use_checksums      = TRUE;
274
229
static my_bool  innobase_rollback_on_timeout    = FALSE;
275
230
static my_bool  innobase_create_status_file   = FALSE;
276
 
static bool innobase_use_replication_log;
277
231
static bool support_xa;
278
232
static bool strict_mode;
279
233
typedef constrained_check<uint32_t, 1024*1024*1024, 1> lock_wait_constraint;
619
573
  return ENOENT;
620
574
}
621
575
 
 
576
/** @brief Initialize the default value of innodb_commit_concurrency.
 
577
 
 
578
Once InnoDB is running, the innodb_commit_concurrency must not change
 
579
from zero to nonzero. (Bug #42101)
 
580
 
 
581
The initial default value is 0, and without this extra initialization,
 
582
SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
 
583
to 0, even if it was initially set to nonzero at the command line
 
584
or configuration file. */
 
585
static
 
586
void
 
587
innobase_commit_concurrency_init_default(void);
 
588
/*==========================================*/
622
589
 
623
590
/************************************************************//**
624
591
Validate the file format name and return its corresponding id.
641
608
 
642
609
static const char innobase_engine_name[]= "InnoDB";
643
610
 
 
611
/*************************************************************//**
 
612
Check for a valid value of innobase_commit_concurrency.
 
613
@return 0 for valid innodb_commit_concurrency */
 
614
static
 
615
int
 
616
innobase_commit_concurrency_validate(
 
617
/*=================================*/
 
618
  Session*      , /*!< in: thread handle */
 
619
  drizzle_sys_var*  , /*!< in: pointer to system
 
620
            variable */
 
621
  void*       save, /*!< out: immediate result
 
622
            for update function */
 
623
  drizzle_value*    value)  /*!< in: incoming string */
 
624
{
 
625
  int64_t   intbuf;
 
626
  ulong   commit_concurrency;
 
627
 
 
628
  if (value->val_int(value, &intbuf)) {
 
629
    /* The value is NULL. That is invalid. */
 
630
    return(1);
 
631
  }
 
632
 
 
633
  *reinterpret_cast<ulong*>(save) = commit_concurrency
 
634
    = static_cast<ulong>(intbuf);
 
635
 
 
636
  /* Allow the value to be updated, as long as it remains zero
 
637
  or nonzero. */
 
638
  return(!(!commit_concurrency == !innobase_commit_concurrency));
 
639
}
 
640
 
644
641
 
645
642
/*****************************************************************//**
646
643
Commits a transaction in an InnoDB database. */
1039
1036
  case DB_INTERRUPTED:
1040
1037
    my_error(ER_QUERY_INTERRUPTED, MYF(0));
1041
1038
    /* fall through */
1042
 
 
1043
 
  case DB_FOREIGN_EXCEED_MAX_CASCADE:
1044
 
    push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
1045
 
                        HA_ERR_ROW_IS_REFERENCED,
1046
 
                        "InnoDB: Cannot delete/update "
1047
 
                        "rows with cascading foreign key "
1048
 
                        "constraints that exceed max "
1049
 
                        "depth of %d. Please "
1050
 
                        "drop extra constraints and try "
1051
 
                        "again", DICT_FK_MAX_RECURSIVE_LOAD);
1052
 
    /* fall through */
1053
 
 
1054
1039
  case DB_ERROR:
1055
1040
  default:
1056
1041
    return(-1); /* unspecified error */
1839
1824
  value= value - (value % align_val);
1840
1825
}
1841
1826
 
1842
 
static void auto_extend_update(Session *, sql_var_t)
1843
 
{
1844
 
  srv_auto_extend_increment= innodb_auto_extend_increment.get();
1845
 
}
1846
 
 
1847
 
static void io_capacity_update(Session *, sql_var_t)
1848
 
{
1849
 
  srv_io_capacity= innodb_io_capacity.get();
1850
 
}
1851
 
 
1852
 
static void purge_batch_update(Session *, sql_var_t)
1853
 
{
1854
 
  srv_purge_batch_size= innodb_purge_batch_size.get();
1855
 
}
1856
 
 
1857
 
static void purge_threads_update(Session *, sql_var_t)
1858
 
{
1859
 
  srv_n_purge_threads= innodb_n_purge_threads.get();
1860
 
}
1861
 
 
1862
 
static void innodb_adaptive_hash_index_update(Session *, sql_var_t)
1863
 
{
1864
 
  if (btr_search_enabled)
1865
 
  {
1866
 
    btr_search_enable();
1867
 
  } else {
1868
 
    btr_search_disable();
1869
 
  }
1870
 
}
1871
 
 
1872
 
static void innodb_old_blocks_pct_update(Session *, sql_var_t)
1873
 
{
1874
 
  innobase_old_blocks_pct= buf_LRU_old_ratio_update(innobase_old_blocks_pct.get(), TRUE);
1875
 
}
1876
 
 
1877
 
static void innodb_thread_concurrency_update(Session *, sql_var_t)
1878
 
{
1879
 
  srv_thread_concurrency= innobase_thread_concurrency.get();
1880
 
}
1881
 
 
1882
 
static void innodb_sync_spin_loops_update(Session *, sql_var_t)
1883
 
{
1884
 
  srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
1885
 
}
1886
 
 
1887
 
static void innodb_spin_wait_delay_update(Session *, sql_var_t)
1888
 
{
1889
 
  srv_spin_wait_delay= innodb_spin_wait_delay.get();
1890
 
}
1891
 
 
1892
 
static void innodb_thread_sleep_delay_update(Session *, sql_var_t)
1893
 
{
1894
 
  srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
1895
 
}
1896
 
 
1897
 
static void innodb_read_ahead_threshold_update(Session *, sql_var_t)
1898
 
{
1899
 
  srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
1900
 
}
1901
 
 
1902
 
 
1903
 
static int innodb_commit_concurrency_validate(Session *session, set_var *var)
1904
 
{
1905
 
   uint32_t new_value= var->save_result.uint32_t_value;
1906
 
 
1907
 
   if ((innobase_commit_concurrency.get() == 0 && new_value != 0) ||
1908
 
       (innobase_commit_concurrency.get() != 0 && new_value == 0))
1909
 
   {
1910
 
     push_warning_printf(session,
1911
 
                         DRIZZLE_ERROR::WARN_LEVEL_WARN,
1912
 
                         ER_WRONG_ARGUMENTS,
1913
 
                         _("Once InnoDB is running, innodb_commit_concurrency "
1914
 
                           "must not change between zero and nonzero."));
1915
 
     return 1;
1916
 
   }
1917
 
   return 0;
1918
 
}
1919
 
 
1920
 
/*************************************************************//**
1921
 
Check if it is a valid file format. This function is registered as
1922
 
a callback with MySQL.
1923
 
@return 0 for valid file format */
1924
 
static
1925
 
int
1926
 
innodb_file_format_name_validate(
1927
 
/*=============================*/
1928
 
  Session*      , /*!< in: thread handle */
1929
 
  set_var *var)
1930
 
{
1931
 
  const char *file_format_input = var->value->str_value.ptr();
1932
 
  if (file_format_input == NULL)
1933
 
    return 1;
1934
 
 
1935
 
  if (file_format_input != NULL) {
1936
 
    uint  format_id;
1937
 
 
1938
 
    format_id = innobase_file_format_name_lookup(
1939
 
      file_format_input);
1940
 
 
1941
 
    if (format_id <= DICT_TF_FORMAT_MAX) {
1942
 
      innobase_file_format_name =
1943
 
        trx_sys_file_format_id_to_name(format_id);
1944
 
 
1945
 
      return(0);
1946
 
    }
1947
 
  }
1948
 
 
1949
 
  return(1);
1950
 
}
1951
 
 
1952
 
/*************************************************************//**
1953
 
Check if it is a valid value of innodb_change_buffering. This function is
1954
 
registered as a callback with MySQL.
1955
 
@return 0 for valid innodb_change_buffering */
1956
 
static
1957
 
int
1958
 
innodb_change_buffering_validate(
1959
 
/*=============================*/
1960
 
  Session*      , /*!< in: thread handle */
1961
 
  set_var *var)
1962
 
{
1963
 
  const char *change_buffering_input = var->value->str_value.ptr();
1964
 
 
1965
 
  if (change_buffering_input == NULL)
1966
 
    return 1;
1967
 
 
1968
 
  ulint use;
1969
 
 
1970
 
  for (use = 0;
1971
 
       use < UT_ARR_SIZE(innobase_change_buffering_values);
1972
 
       ++use) {
1973
 
    if (!innobase_strcasecmp(change_buffering_input,
1974
 
                             innobase_change_buffering_values[use]))
1975
 
    {
1976
 
      ibuf_use= static_cast<ibuf_use_t>(use); 
1977
 
      return 0;
1978
 
    }
1979
 
  }
1980
 
 
1981
 
  return 1;
1982
 
}
1983
 
 
1984
 
 
1985
 
/*************************************************************//**
1986
 
Check if valid argument to innodb_file_format_max. This function
1987
 
is registered as a callback with MySQL.
1988
 
@return 0 for valid file format */
1989
 
static
1990
 
int
1991
 
innodb_file_format_max_validate(
1992
 
/*==============================*/
1993
 
  Session*   session, /*!< in: thread handle */
1994
 
  set_var *var)
1995
 
{
1996
 
  const char *file_format_input = var->value->str_value.ptr();
1997
 
  if (file_format_input == NULL)
1998
 
    return 1;
1999
 
 
2000
 
  if (file_format_input != NULL) {
2001
 
    int format_id = innobase_file_format_validate_and_set(file_format_input);
2002
 
 
2003
 
    if (format_id > DICT_TF_FORMAT_MAX) {
2004
 
      /* DEFAULT is "on", which is invalid at runtime. */
2005
 
      return 1;
2006
 
    }
2007
 
 
2008
 
    if (format_id >= 0) {
2009
 
      innobase_file_format_max= 
2010
 
        trx_sys_file_format_id_to_name((uint)format_id);
2011
 
 
2012
 
      /* Update the max format id in the system tablespace. */
2013
 
      char name_buff[100];
2014
 
      strcpy(name_buff, innobase_file_format_max.c_str());
2015
 
      if (trx_sys_file_format_max_set(format_id, (const char **)&name_buff))
2016
 
      {
2017
 
        errmsg_printf(ERRMSG_LVL_WARN,
2018
 
                      " [Info] InnoDB: the file format in the system "
2019
 
                      "tablespace is now set to %s.\n", name_buff);
2020
 
        innobase_file_format_max= name_buff;
2021
 
      }
2022
 
      return(0);
2023
 
 
2024
 
    } else {
2025
 
      push_warning_printf(session,
2026
 
                          DRIZZLE_ERROR::WARN_LEVEL_WARN,
2027
 
                          ER_WRONG_ARGUMENTS,
2028
 
                          "InnoDB: invalid innodb_file_format_max "
2029
 
                          "value; can be any format up to %s "
2030
 
                          "or equivalent id of %d",
2031
 
                          trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
2032
 
                          DICT_TF_FORMAT_MAX);
2033
 
    }
2034
 
  }
2035
 
 
2036
 
  return(1);
2037
 
}
2038
 
 
2039
 
 
2040
1827
/*********************************************************************//**
2041
1828
Opens an InnoDB database.
2042
1829
@return 0 on success, error code on failure */
2052
1839
  InnobaseEngine *actuall_engine_ptr;
2053
1840
  const module::option_map &vm= context.getOptions();
2054
1841
 
2055
 
  srv_auto_extend_increment= innodb_auto_extend_increment.get();
2056
 
  srv_io_capacity= innodb_io_capacity.get();
2057
 
  srv_purge_batch_size= innodb_purge_batch_size.get();
2058
 
  srv_n_purge_threads= innodb_n_purge_threads.get();
2059
 
  srv_flush_log_at_trx_commit= innodb_flush_log_at_trx_commit.get();
2060
 
  srv_max_buf_pool_modified_pct= innodb_max_dirty_pages_pct.get();
2061
 
  srv_max_purge_lag= innodb_max_purge_lag.get();
2062
 
  srv_stats_sample_pages= innodb_stats_sample_pages.get();
2063
 
  srv_n_free_tickets_to_enter= innodb_concurrency_tickets.get();
2064
 
  srv_replication_delay= innodb_replication_delay.get();
2065
 
  srv_thread_concurrency= innobase_thread_concurrency.get();
2066
 
  srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
2067
 
  srv_spin_wait_delay= innodb_spin_wait_delay.get();
2068
 
  srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
2069
 
  srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
2070
 
 
2071
1842
  /* Inverted Booleans */
2072
1843
 
2073
1844
  innobase_use_checksums= (vm.count("disable-checksums")) ? false : true;
2075
1846
  srv_adaptive_flushing= (vm.count("disable-adaptive-flushing")) ? false : true;
2076
1847
  srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
2077
1848
  support_xa= (vm.count("disable-xa")) ? false : true;
2078
 
  btr_search_enabled= (vm.count("disable-adaptive-hash-index")) ? false : true;
2079
 
 
2080
 
 
2081
 
  /* Hafta do this here because we need to late-bind the default value */
 
1849
 
 
1850
  if (vm.count("io-capacity"))
 
1851
  {
 
1852
    if (srv_io_capacity < 100)
 
1853
    {
 
1854
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for io-capacity\n"));
 
1855
      exit(-1);
 
1856
    }
 
1857
  }
 
1858
 
2082
1859
  if (vm.count("data-home-dir"))
2083
1860
  {
2084
1861
    innobase_data_home_dir= vm["data-home-dir"].as<string>();
2088
1865
    innobase_data_home_dir= getDataHome().file_string();
2089
1866
  }
2090
1867
 
 
1868
  if (vm.count("fast-shutdown"))
 
1869
  {
 
1870
    if (innobase_fast_shutdown > 2)
 
1871
    {
 
1872
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for fast-shutdown\n"));
 
1873
      exit(-1);
 
1874
    }
 
1875
  }
 
1876
 
 
1877
  if (vm.count("file-format-max"))
 
1878
  {
 
1879
    innobase_file_format_max= const_cast<char *>(vm["file-format-max"].as<string>().c_str());
 
1880
  }
 
1881
 
 
1882
  if (vm.count("file-format-check"))
 
1883
  {
 
1884
    innobase_file_format_check= vm["file-format-check"].as<bool>();
 
1885
  }
 
1886
 
 
1887
  if (vm.count("flush-log-at-trx-commit"))
 
1888
  {
 
1889
    if (srv_flush_log_at_trx_commit > 2)
 
1890
    {
 
1891
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for flush-log-at-trx-commit\n"));
 
1892
      exit(-1);
 
1893
    }
 
1894
  }
 
1895
 
 
1896
 
 
1897
#ifdef UNIV_LOG_ARCHIVE
 
1898
  if (vm.count("log-arch-dir"))
 
1899
  {
 
1900
    innobase_log_arch_dir= vm["log-arch-dir"].as<string>());
 
1901
  }
 
1902
 
 
1903
#endif /* UNIV_LOG_ARCHIVE */
 
1904
 
 
1905
  if (vm.count("max-dirty-pages-pct"))
 
1906
  {
 
1907
    if (srv_max_buf_pool_modified_pct > 99)
 
1908
    {
 
1909
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for max-dirty-pages-pct\n"));
 
1910
      exit(-1);
 
1911
    }
 
1912
  }
 
1913
 
 
1914
  if (vm.count("stats-sample-pages"))
 
1915
  {
 
1916
    if (srv_stats_sample_pages < 8)
 
1917
    {
 
1918
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for stats-sample-pages\n"));
 
1919
      exit(-1);
 
1920
    }
 
1921
  }
 
1922
 
 
1923
  if (vm.count("additional-mem-pool-size"))
 
1924
  {
 
1925
    align_value(innobase_additional_mem_pool_size);
 
1926
 
 
1927
    if (innobase_additional_mem_pool_size < 512*1024L)
 
1928
    {
 
1929
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for additional-mem-pool-size\n"));
 
1930
      exit(-1);
 
1931
    }
 
1932
 
 
1933
  }
 
1934
 
 
1935
  if (vm.count("autoextend-increment"))
 
1936
  {
 
1937
    if (srv_auto_extend_increment < 1 || srv_auto_extend_increment > 1000)
 
1938
    {
 
1939
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for autoextend-increment\n"));
 
1940
      exit(-1);
 
1941
    }
 
1942
  }
 
1943
 
 
1944
  if (vm.count("buffer-pool-size"))
 
1945
  {
 
1946
    align_value(innobase_buffer_pool_size, 1024*1024);
 
1947
    if (innobase_buffer_pool_size < 5*1024*1024)
 
1948
    {
 
1949
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer-pool-size\n"));
 
1950
      exit(-1);
 
1951
    }
 
1952
    
 
1953
  }
 
1954
 
 
1955
  if (vm.count("buffer-pool-instances"))
 
1956
  {
 
1957
    if (innobase_buffer_pool_instances > MAX_BUFFER_POOLS)
 
1958
    {
 
1959
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer-pool-instances\n"));
 
1960
      exit(-1);
 
1961
    }
 
1962
    
 
1963
  }
 
1964
 
 
1965
  if (vm.count("commit-concurrency"))
 
1966
  {
 
1967
    if (srv_replication_delay > 1000)
 
1968
    {
 
1969
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for commit-concurrency\n"));
 
1970
      exit(-1);
 
1971
    }
 
1972
  }
 
1973
 
 
1974
  if (vm.count("concurrency-tickets"))
 
1975
  {
 
1976
    if (srv_n_free_tickets_to_enter < 1)
 
1977
    {
 
1978
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for concurrency-tickets\n"));
 
1979
      exit(-1);
 
1980
    }
 
1981
  }
 
1982
 
 
1983
  if (vm.count("read-io-threads"))
 
1984
  {
 
1985
    if (innobase_read_io_threads < 1 || innobase_read_io_threads > 64)
 
1986
    {
 
1987
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-io-threads\n"));
 
1988
      exit(-1);
 
1989
    }
 
1990
  }
 
1991
 
 
1992
  if (vm.count("write-io-threads"))
 
1993
  {
 
1994
    if (innobase_write_io_threads < 1 || innobase_write_io_threads > 64)
 
1995
    {
 
1996
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for write-io-threads\n"));
 
1997
      exit(-1);
 
1998
    }
 
1999
  }
 
2000
 
 
2001
  if (vm.count("force-recovery"))
 
2002
  {
 
2003
    if (innobase_force_recovery > 6)
 
2004
    {
 
2005
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for force-recovery\n"));
 
2006
      exit(-1);
 
2007
    }
 
2008
  }
 
2009
 
 
2010
  if (vm.count("log-buffer-size"))
 
2011
  {
 
2012
    align_value(innobase_log_buffer_size);
 
2013
    if (innobase_log_buffer_size < 256*1024L)
 
2014
    {
 
2015
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
 
2016
      exit(-1);
 
2017
    }
 
2018
  }
 
2019
 
 
2020
  if (vm.count("log-file-size"))
 
2021
  {
 
2022
    align_value(innobase_log_file_size, 1024*1024);
 
2023
    if (innobase_log_file_size < 1*1024*1024L)
 
2024
    {
 
2025
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
 
2026
      exit(-1);
 
2027
    }
 
2028
  }
 
2029
 
 
2030
  if (vm.count("log-files-in-group"))
 
2031
  {
 
2032
    if (innobase_log_files_in_group < 2 || innobase_log_files_in_group > 100)
 
2033
    {
 
2034
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-files-in-group\n"));
 
2035
      exit(-1);
 
2036
    }
 
2037
  }
 
2038
 
 
2039
  if (vm.count("mirrored-log-groups"))
 
2040
  {
 
2041
    if (innobase_mirrored_log_groups < 1 || innobase_mirrored_log_groups > 10)
 
2042
    {
 
2043
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for mirrored-log-groups\n"));
 
2044
      exit(-1);
 
2045
    }
 
2046
  }
 
2047
 
 
2048
  if (vm.count("open-files"))
 
2049
  {
 
2050
    if (innobase_open_files < 10)
 
2051
    {
 
2052
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for open-files\n"));
 
2053
      exit(-1);
 
2054
    }
 
2055
  }
 
2056
 
 
2057
  if (vm.count("thread-concurrency"))
 
2058
  {
 
2059
    if (srv_thread_concurrency > 1000)
 
2060
    {
 
2061
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for thread-concurrency\n"));
 
2062
      exit(-1);
 
2063
    }
 
2064
  }
2091
2065
 
2092
2066
  if (vm.count("data-file-path"))
2093
2067
  {
2094
2068
    innobase_data_file_path= vm["data-file-path"].as<string>();
2095
2069
  }
2096
2070
 
 
2071
  if (vm.count("read-ahead-threshold"))
 
2072
  {
 
2073
    if (srv_read_ahead_threshold > 64)
 
2074
    {
 
2075
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-ahead-threshold\n"));
 
2076
      exit(-1);
 
2077
    }
 
2078
  }
 
2079
 
 
2080
 
2097
2081
 
2098
2082
  innodb_engine_ptr= actuall_engine_ptr= new InnobaseEngine(innobase_engine_name);
2099
2083
 
2117
2101
  }
2118
2102
#endif /* UNIV_DEBUG */
2119
2103
 
 
2104
  /* Check that values don't overflow on 32-bit systems. */
 
2105
  if (sizeof(ulint) == 4) {
 
2106
    if (innobase_buffer_pool_size > UINT32_MAX) {
 
2107
      errmsg_printf(ERRMSG_LVL_ERROR, 
 
2108
                    "innobase_buffer_pool_size can't be over 4GB"
 
2109
                    " on 32-bit systems");
 
2110
 
 
2111
      goto error;
 
2112
    }
 
2113
 
 
2114
    if (innobase_log_file_size > UINT32_MAX) {
 
2115
      errmsg_printf(ERRMSG_LVL_ERROR, 
 
2116
                    "innobase_log_file_size can't be over 4GB"
 
2117
                    " on 32-bit systems");
 
2118
 
 
2119
      goto error;
 
2120
    }
 
2121
  }
 
2122
 
2120
2123
  os_innodb_umask = (ulint)internal::my_umask;
2121
2124
 
2122
2125
 
2168
2171
    innobase_log_group_home_dir= getDataHome().file_string();
2169
2172
  }
2170
2173
 
 
2174
#ifdef UNIV_LOG_ARCHIVE
 
2175
  /* Since innodb_log_arch_dir has no relevance under MySQL,
 
2176
    starting from 4.0.6 we always set it the same as
 
2177
innodb_log_group_home_dir: */
 
2178
 
 
2179
  innobase_log_arch_dir = (char *)innobase_log_group_home_dir.c_str();
 
2180
 
 
2181
  srv_arch_dir = (char *)innobase_log_arch_dir.c_str();
 
2182
#endif /* UNIG_LOG_ARCHIVE */
 
2183
 
2171
2184
  ret = (bool)
2172
2185
    srv_parse_log_group_home_dirs((char *)innobase_log_group_home_dir.c_str());
2173
2186
 
2174
 
  if (ret == FALSE || innobase_mirrored_log_groups.get() != 1) {
2175
 
    errmsg_printf(ERRMSG_LVL_ERROR,
2176
 
                  _("syntax error in innodb_log_group_home_dir, or a "
2177
 
                  "wrong number of mirrored log groups"));
 
2187
  if (ret == FALSE || innobase_mirrored_log_groups != 1) {
 
2188
    errmsg_printf(ERRMSG_LVL_ERROR, "syntax error in innodb_log_group_home_dir, or a "
 
2189
                  "wrong number of mirrored log groups");
2178
2190
 
2179
2191
    goto mem_free_and_error;
2180
2192
  }
2197
2209
    format_id = 0;
2198
2210
  }
2199
2211
 
 
2212
  if (vm.count("purge-batch-size"))
 
2213
  {
 
2214
    srv_purge_batch_size= vm["purge-batch-size"].as<unsigned long>();
 
2215
    if (srv_purge_batch_size < 1 || srv_purge_batch_size > 5000)
 
2216
    {
 
2217
      errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: wrong purge-batch_size.");
 
2218
      goto mem_free_and_error;
 
2219
    }
 
2220
  }
 
2221
 
 
2222
  if (vm.count("n-purge-threads"))
 
2223
  {
 
2224
    srv_n_purge_threads= vm["n-purge-threads"].as<unsigned long>();
 
2225
    if (srv_n_purge_threads > 1)
 
2226
    {
 
2227
      errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: wrong n-purge-threads.");
 
2228
      goto mem_free_and_error;
 
2229
    }
 
2230
  }
 
2231
 
2200
2232
  srv_file_format = format_id;
2201
2233
 
 
2234
  /* Given the type of innobase_file_format_name we have little
 
2235
    choice but to cast away the constness from the returned name.
 
2236
    innobase_file_format_name is used in the MySQL set variable
 
2237
    interface and so can't be const. */
 
2238
 
2202
2239
  innobase_file_format_name =
2203
 
    trx_sys_file_format_id_to_name(format_id);
 
2240
    (char*) trx_sys_file_format_id_to_name(format_id);
2204
2241
 
2205
2242
  /* Check innobase_file_format_check variable */
2206
2243
  if (!innobase_file_format_check)
2215
2252
  /* Did the user specify a format name that we support?
2216
2253
     As a side effect it will update the variable
2217
2254
     srv_max_file_format_at_startup */
2218
 
  if (innobase_file_format_validate_and_set(innobase_file_format_max.c_str()) < 0)
 
2255
  if (innobase_file_format_validate_and_set(innobase_file_format_max) < 0)
2219
2256
  {
2220
 
    errmsg_printf(ERRMSG_LVL_ERROR, _("InnoDB: invalid "
 
2257
    errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: invalid "
2221
2258
                    "innodb_file_format_max value: "
2222
2259
                    "should be any value up to %s or its "
2223
 
                    "equivalent numeric id"),
 
2260
                    "equivalent numeric id",
2224
2261
                    trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX));
2225
2262
    goto mem_free_and_error;
2226
2263
  }
2233
2270
         use < UT_ARR_SIZE(innobase_change_buffering_values);
2234
2271
         use++) {
2235
2272
      if (!innobase_strcasecmp(
2236
 
                               innobase_change_buffering.c_str(),
 
2273
                               vm["change-buffering"].as<string>().c_str(),
2237
2274
                               innobase_change_buffering_values[use])) {
2238
 
        ibuf_use = static_cast<ibuf_use_t>(use);
 
2275
        ibuf_use = (ibuf_use_t) use;
2239
2276
        goto innobase_change_buffering_inited_ok;
2240
2277
      }
2241
2278
    }
2249
2286
 
2250
2287
innobase_change_buffering_inited_ok:
2251
2288
  ut_a((ulint) ibuf_use < UT_ARR_SIZE(innobase_change_buffering_values));
2252
 
  innobase_change_buffering = innobase_change_buffering_values[ibuf_use];
 
2289
  innobase_change_buffering = (char*)
 
2290
    innobase_change_buffering_values[ibuf_use];
2253
2291
 
2254
2292
  /* --------------------------------------------------*/
2255
2293
 
2262
2300
  srv_n_log_files = (ulint) innobase_log_files_in_group;
2263
2301
  srv_log_file_size = (ulint) innobase_log_file_size;
2264
2302
 
 
2303
#ifdef UNIV_LOG_ARCHIVE
 
2304
  srv_log_archive_on = (ulint) innobase_log_archive;
 
2305
#endif /* UNIV_LOG_ARCHIVE */
2265
2306
  srv_log_buffer_size = (ulint) innobase_log_buffer_size;
2266
2307
 
2267
2308
  srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
2296
2337
 
2297
2338
  data_mysql_default_charset_coll = (ulint)default_charset_info->number;
2298
2339
 
 
2340
  innobase_commit_concurrency_init_default();
 
2341
 
2299
2342
  /* Since we in this module access directly the fields of a trx
2300
2343
    struct, and due to different headers and flags it might happen that
2301
2344
    mutex_t has a different size in this module and in InnoDB
2315
2358
    goto mem_free_and_error;
2316
2359
  }
2317
2360
 
2318
 
 
2319
 
  innobase_old_blocks_pct = buf_LRU_old_ratio_update(innobase_old_blocks_pct.get(),
 
2361
  innobase_old_blocks_pct = buf_LRU_old_ratio_update(innobase_old_blocks_pct,
2320
2362
                                                     TRUE);
2321
2363
 
2322
2364
  innobase_open_tables = hash_create(200);
2378
2420
  context.add(innodb_sys_foreign_cols_tool);
2379
2421
 
2380
2422
  context.add(new(std::nothrow)InnodbInternalTables());
2381
 
  context.add(new(std::nothrow)InnodbReplicationTable());
2382
 
 
2383
 
  if (innobase_use_replication_log)
2384
 
  {
2385
 
    replication_logger= new(std::nothrow)ReplicationLog();
2386
 
    context.add(replication_logger);
2387
 
    ReplicationLog::setup(replication_logger);
2388
 
  }
2389
 
 
2390
2423
  context.registerVariable(new sys_var_const_string_val("data-home-dir", innobase_data_home_dir));
2391
2424
  context.registerVariable(new sys_var_const_string_val("flush-method", 
2392
2425
                                                        vm.count("flush-method") ?  vm["flush-method"].as<string>() : ""));
2394
2427
  context.registerVariable(new sys_var_const_string_val("data-file-path", innobase_data_file_path));
2395
2428
  context.registerVariable(new sys_var_const_string_val("version", vm["version"].as<string>()));
2396
2429
 
2397
 
 
2398
 
  context.registerVariable(new sys_var_bool_ptr_readonly("replication_log", &innobase_use_replication_log));
 
2430
  #ifdef UNIV_LOG_ARCHIVE
 
2431
  context.registerVariable(new sys_var_const_string_val("log-arch-dir", innobase_log_arch_dir));
 
2432
  context.registerVariable(new sys_var_bool_ptr_readonly("log-archive", &innobase_log_archive));
 
2433
  #endif /* UNIV_LOG_ARCHIVE */  
 
2434
 
 
2435
  context.add(new(std::nothrow)InnodbReplicationTable());
 
2436
 
 
2437
  replication_logger= new(std::nothrow)ReplicationLog();
 
2438
  context.add(replication_logger);
 
2439
 
 
2440
  if (vm.count("replication-log") and vm["replication-log"].as<bool>())
 
2441
  {
 
2442
    ReplicationLog::setup(static_cast<ReplicationLog *>(replication_logger));
 
2443
  }
 
2444
 
2399
2445
  context.registerVariable(new sys_var_bool_ptr_readonly("checksums", &innobase_use_checksums));
2400
2446
  context.registerVariable(new sys_var_bool_ptr_readonly("doublewrite", &innobase_use_doublewrite));
2401
2447
  context.registerVariable(new sys_var_bool_ptr("file-per-table", &srv_file_per_table));
2405
2451
  context.registerVariable(new sys_var_bool_ptr_readonly("use-sys-malloc", &srv_use_sys_malloc));
2406
2452
  context.registerVariable(new sys_var_bool_ptr_readonly("use-native-aio", &srv_use_native_aio));
2407
2453
 
 
2454
#ifdef UNIV_LOG_ARCHIVE
 
2455
 context.registerVariable(new sys_var_bool_ptr_readonly("log_archive", &innobase_log_archive));
 
2456
#endif /* UNIV_LOG_ARCHIVE */
2408
2457
  context.registerVariable(new sys_var_bool_ptr("support-xa", &support_xa));
2409
2458
  context.registerVariable(new sys_var_bool_ptr("strict_mode", &strict_mode));
2410
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("lock_wait_timeout", lock_wait_timeout));
2411
 
 
2412
 
  context.registerVariable(new sys_var_constrained_value_readonly<size_t>("additional_mem_pool_size",innobase_additional_mem_pool_size));
2413
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("autoextend_increment",
2414
 
                                                                   innodb_auto_extend_increment,
2415
 
                                                                   auto_extend_update));
2416
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("io_capacity",
2417
 
                                                                   innodb_io_capacity,
2418
 
                                                                   io_capacity_update));
2419
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_batch_size",
2420
 
                                                                   innodb_purge_batch_size,
2421
 
                                                                   purge_batch_update));
2422
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_threads",
2423
 
                                                                   innodb_n_purge_threads,
2424
 
                                                                   purge_threads_update));
2425
 
  context.registerVariable(new sys_var_constrained_value<uint16_t>("fast_shutdown", innobase_fast_shutdown));
2426
 
  context.registerVariable(new sys_var_std_string("file_format",
2427
 
                                                  innobase_file_format_name,
2428
 
                                                  innodb_file_format_name_validate));
2429
 
  context.registerVariable(new sys_var_std_string("change_buffering",
2430
 
                                                  innobase_change_buffering,
2431
 
                                                  innodb_change_buffering_validate));
2432
 
  context.registerVariable(new sys_var_std_string("file_format_max",
2433
 
                                                  innobase_file_format_max,
2434
 
                                                  innodb_file_format_max_validate));
2435
 
  context.registerVariable(new sys_var_constrained_value_readonly<size_t>("buffer_pool_size", innobase_buffer_pool_size));
2436
 
  context.registerVariable(new sys_var_constrained_value_readonly<int64_t>("log_file_size", innobase_log_file_size));
2437
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("flush_log_at_trx_commit",
2438
 
                                                  innodb_flush_log_at_trx_commit));
2439
 
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct",
2440
 
                                                  innodb_max_dirty_pages_pct));
2441
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("max_purge_lag", innodb_max_purge_lag));
2442
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("stats_sample_pages", innodb_stats_sample_pages));
2443
 
  context.registerVariable(new sys_var_bool_ptr("adaptive_hash_index", &btr_search_enabled, innodb_adaptive_hash_index_update));
2444
 
 
2445
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("commit_concurrency",
2446
 
                                                                   innobase_commit_concurrency,
2447
 
                                                                   innodb_commit_concurrency_validate));
2448
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("concurrency_tickets",
2449
 
                                                                   innodb_concurrency_tickets));
2450
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("read_io_threads", innobase_read_io_threads));
2451
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("write_io_threads", innobase_write_io_threads));
2452
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("replication_delay", innodb_replication_delay));
2453
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("force_recovery", innobase_force_recovery));
2454
 
  context.registerVariable(new sys_var_constrained_value_readonly<size_t>("log_buffer_size", innobase_log_buffer_size));
2455
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("log_files_in_group", innobase_log_files_in_group));
2456
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("mirrored_log_groups", innobase_mirrored_log_groups));
2457
 
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("open_files", innobase_open_files));
2458
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("old_blocks_pct",
2459
 
                                                                   innobase_old_blocks_pct,
2460
 
                                                                   innodb_old_blocks_pct_update));
2461
 
  context.registerVariable(new sys_var_uint32_t_ptr("old_blocks_time", &buf_LRU_old_threshold_ms));
2462
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("sync_spin_loops", innodb_sync_spin_loops, innodb_sync_spin_loops_update));
2463
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("spin_wait_delay", innodb_spin_wait_delay, innodb_spin_wait_delay_update));
2464
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_sleep_delay", innodb_thread_sleep_delay, innodb_thread_sleep_delay_update));
2465
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_concurrency",
2466
 
                                                                   innobase_thread_concurrency,
2467
 
                                                                   innodb_thread_concurrency_update));
2468
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("read_ahead_threshold",
2469
 
                                                                   innodb_read_ahead_threshold,
2470
 
                                                                   innodb_read_ahead_threshold_update));
 
2459
  context.registerVariable(new sys_var_constrained_value<uint32_t>("lock-wait-timeout", lock_wait_timeout));
 
2460
 
2471
2461
  /* Get the current high water mark format. */
2472
 
  innobase_file_format_max = trx_sys_file_format_max_get();
 
2462
  innobase_file_format_max = (char*) trx_sys_file_format_max_get();
2473
2463
  btr_search_fully_disabled = (!btr_search_enabled);
2474
2464
 
2475
2465
  return(FALSE);
2579
2569
    Note, the position is current because of
2580
2570
    prepare_commit_mutex */
2581
2571
retry:
2582
 
    if (innobase_commit_concurrency.get() > 0) {
 
2572
    if (innobase_commit_concurrency > 0) {
2583
2573
      pthread_mutex_lock(&commit_cond_m);
2584
2574
      commit_threads++;
2585
2575
 
2586
 
      if (commit_threads > innobase_commit_concurrency.get()) {
 
2576
      if (commit_threads > innobase_commit_concurrency) {
2587
2577
        commit_threads--;
2588
2578
        pthread_cond_wait(&commit_cond,
2589
2579
          &commit_cond_m);
2608
2598
    innobase_commit_low(trx);
2609
2599
    trx->flush_log_later = FALSE;
2610
2600
 
2611
 
    if (innobase_commit_concurrency.get() > 0) {
 
2601
    if (innobase_commit_concurrency > 0) {
2612
2602
      pthread_mutex_lock(&commit_cond_m);
2613
2603
      commit_threads--;
2614
2604
      pthread_cond_signal(&commit_cond);
3296
3286
    err = row_search_max_autoinc(index, col_name, &read_auto_inc);
3297
3287
 
3298
3288
    switch (err) {
3299
 
    case DB_SUCCESS: {
3300
 
      uint64_t col_max_value;
3301
 
 
3302
 
      col_max_value = innobase_get_int_col_max_value(field);
3303
 
 
 
3289
    case DB_SUCCESS:
3304
3290
      /* At the this stage we do not know the increment
3305
 
         nor the offset, so use a default increment of 1. */
3306
 
 
3307
 
      auto_inc = innobase_next_autoinc(read_auto_inc, 1, 1, col_max_value);
3308
 
 
 
3291
         or the offset, so use a default increment of 1. */
 
3292
      auto_inc = read_auto_inc + 1;
3309
3293
      break;
3310
 
    }
 
3294
 
3311
3295
    case DB_RECORD_NOT_FOUND:
3312
3296
      ut_print_timestamp(stderr);
3313
3297
      fprintf(stderr, "  InnoDB: MySQL and InnoDB data "
3580
3564
    /* We update the highest file format in the system table
3581
3565
    space, if this table has higher file format setting. */
3582
3566
 
3583
 
    char changed_file_format_max[100];
3584
 
    strcpy(changed_file_format_max, innobase_file_format_max.c_str());
3585
 
    trx_sys_file_format_max_upgrade((const char **)&changed_file_format_max,
 
3567
    trx_sys_file_format_max_upgrade(
 
3568
      (const char**) &innobase_file_format_max,
3586
3569
      dict_table_get_format(prebuilt->table));
3587
 
    innobase_file_format_max= changed_file_format_max;
3588
3570
  }
3589
3571
 
 
3572
  info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
 
3573
 
3590
3574
  /* Only if the table has an AUTOINC column. */
3591
3575
  if (prebuilt->table != NULL && getTable()->found_next_number_field != NULL) {
3592
3576
 
3604
3588
    dict_table_autoinc_unlock(prebuilt->table);
3605
3589
  }
3606
3590
 
3607
 
  info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
3608
 
 
3609
3591
  return(0);
3610
3592
}
3611
3593
 
3853
3835
  case DRIZZLE_TYPE_DATETIME:
3854
3836
  case DRIZZLE_TYPE_DATE:
3855
3837
  case DRIZZLE_TYPE_TIMESTAMP:
3856
 
  case DRIZZLE_TYPE_ENUM:
3857
3838
    return(DATA_INT);
3858
3839
  case DRIZZLE_TYPE_DOUBLE:
3859
3840
    return(DATA_DOUBLE);
3860
3841
  case DRIZZLE_TYPE_BLOB:
3861
3842
    return(DATA_BLOB);
3862
 
  case DRIZZLE_TYPE_UUID:
3863
 
    return(DATA_FIXBINARY);
3864
 
  case DRIZZLE_TYPE_NULL:
 
3843
  default:
3865
3844
    ut_error;
3866
3845
  }
3867
3846
 
6360
6339
    /* We update the highest file format in the system table
6361
6340
      space, if this table has higher file format setting. */
6362
6341
 
6363
 
    char changed_file_format_max[100];
6364
 
    strcpy(changed_file_format_max, innobase_file_format_max.c_str());
6365
 
    trx_sys_file_format_max_upgrade((const char **)&changed_file_format_max,
6366
 
      dict_table_get_format(innobase_table));
6367
 
    innobase_file_format_max= changed_file_format_max;
 
6342
    trx_sys_file_format_max_upgrade((const char**) &innobase_file_format_max,
 
6343
                                    dict_table_get_format(innobase_table));
6368
6344
  }
6369
6345
 
6370
6346
  /* Note: We can't call update_session() as prebuilt will not be
7130
7106
  dict_index_t* index;
7131
7107
  ha_rows   rec_per_key;
7132
7108
  ib_int64_t  n_rows;
 
7109
  ulong   j;
 
7110
  ulong   i;
7133
7111
  os_file_stat_t  stat_info;
7134
7112
 
7135
7113
  /* If we are forcing recovery at a high level, we will suppress
7136
7114
  statistics calculation on tables, because that may crash the
7137
7115
  server if an index is badly corrupted. */
7138
7116
 
 
7117
  if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
 
7118
 
 
7119
    /* We return success (0) instead of HA_ERR_CRASHED,
 
7120
    because we want MySQL to process this query and not
 
7121
    stop, like it would do if it received the error code
 
7122
    HA_ERR_CRASHED. */
 
7123
 
 
7124
    return(0);
 
7125
  }
 
7126
 
7139
7127
  /* We do not know if MySQL can call this function before calling
7140
7128
  external_lock(). To be safe, update the session of the current table
7141
7129
  handle. */
7227
7215
    acquiring latches inside InnoDB, we do not call it if we
7228
7216
    are asked by MySQL to avoid locking. Another reason to
7229
7217
    avoid the call is that it uses quite a lot of CPU.
7230
 
    See Bug#38185. */
7231
 
    if (flag & HA_STATUS_NO_LOCK) {
7232
 
      /* We do not update delete_length if no
7233
 
         locking is requested so the "old" value can
7234
 
         remain. delete_length is initialized to 0 in
7235
 
         the ha_statistics' constructor. */
7236
 
    } else if (UNIV_UNLIKELY
7237
 
               (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE)) {
7238
 
      /* Avoid accessing the tablespace if
7239
 
         innodb_crash_recovery is set to a high value. */
7240
 
      stats.delete_length = 0;
7241
 
    } else {
 
7218
    See Bug#38185.
 
7219
    We do not update delete_length if no locking is requested
 
7220
    so the "old" value can remain. delete_length is initialized
 
7221
    to 0 in the ha_statistics' constructor. */
 
7222
    if (!(flag & HA_STATUS_NO_LOCK)) {
 
7223
 
7242
7224
      /* lock the data dictionary to avoid races with
7243
7225
      ibd_file_missing and tablespace_discarded */
7244
7226
      row_mysql_lock_data_dictionary(prebuilt->trx);
7284
7266
  }
7285
7267
 
7286
7268
  if (flag & HA_STATUS_CONST) {
7287
 
    ulong i;
7288
7269
    /* Verify the number of index in InnoDB and MySQL
7289
7270
       matches up. If prebuilt->clust_index_was_generated
7290
7271
       holds, InnoDB defines GEN_CLUST_INDEX internally */
7300
7281
    }
7301
7282
 
7302
7283
    for (i = 0; i < getTable()->getShare()->sizeKeys(); i++) {
7303
 
      ulong j;
7304
7284
      /* We could get index quickly through internal
7305
7285
         index mapping with the index translation table.
7306
7286
         The identity of index (match up index name with
7366
7346
    }
7367
7347
  }
7368
7348
 
7369
 
  if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
7370
 
    goto func_exit;
7371
 
  }
7372
 
 
7373
7349
  if (flag & HA_STATUS_ERRKEY) {
7374
7350
    const dict_index_t* err_index;
7375
7351
 
7391
7367
    stats.auto_increment_value = innobase_peek_autoinc();
7392
7368
  }
7393
7369
 
7394
 
func_exit:
7395
7370
  prebuilt->trx->op_info = (char*)"";
7396
7371
 
7397
7372
  return(0);
8092
8067
{
8093
8068
  trx_t*      trx;
8094
8069
  static const char truncated_msg[] = "... truncated...\n";
8095
 
  const long    MAX_STATUS_SIZE = 1048576;
 
8070
  const long    MAX_STATUS_SIZE = 64000;
8096
8071
  ulint     trx_list_start = ULINT_UNDEFINED;
8097
8072
  ulint     trx_list_end = ULINT_UNDEFINED;
8098
8073
 
8121
8096
 
8122
8097
  if (flen > MAX_STATUS_SIZE) {
8123
8098
    usable_len = MAX_STATUS_SIZE;
8124
 
    srv_truncated_status_writes++;
8125
8099
  } else {
8126
8100
    usable_len = flen;
8127
8101
  }
8157
8131
 
8158
8132
  mutex_exit(&srv_monitor_file_mutex);
8159
8133
 
8160
 
  stat_print(session, innobase_engine_name, strlen(innobase_engine_name),
8161
 
             STRING_WITH_LEN(""), str, flen);
 
8134
  bool result = FALSE;
8162
8135
 
 
8136
  if (stat_print(session, innobase_engine_name, strlen(innobase_engine_name),
 
8137
      STRING_WITH_LEN(""), str, flen)) {
 
8138
    result= TRUE;
 
8139
  }
8163
8140
  free(str);
8164
8141
 
8165
8142
  return(FALSE);
8508
8485
        && (sql_command == SQLCOM_INSERT_SELECT
8509
8486
            || sql_command == SQLCOM_REPLACE_SELECT
8510
8487
            || sql_command == SQLCOM_UPDATE
8511
 
            || sql_command == SQLCOM_CREATE_TABLE
8512
 
            || sql_command == SQLCOM_SET_OPTION)) {
 
8488
            || sql_command == SQLCOM_CREATE_TABLE)) {
8513
8489
 
8514
8490
      /* If we either have innobase_locks_unsafe_for_binlog
8515
8491
      option set or this session is using READ COMMITTED
8517
8493
      is not set to serializable and MySQL is doing
8518
8494
      INSERT INTO...SELECT or REPLACE INTO...SELECT
8519
8495
      or UPDATE ... = (SELECT ...) or CREATE  ...
8520
 
      SELECT... or SET ... = (SELECT ...) without
8521
 
      FOR UPDATE or IN SHARE MODE in select,
8522
 
      then we use consistent read for select. */
 
8496
      SELECT... without FOR UPDATE or IN SHARE
 
8497
      MODE in select, then we use consistent read
 
8498
      for select. */
8523
8499
 
8524
8500
      prebuilt->select_lock_type = LOCK_NONE;
8525
8501
      prebuilt->stored_select_lock_type = LOCK_NONE;
8607
8583
}
8608
8584
 
8609
8585
/*******************************************************************//**
8610
 
This function reads the global auto-inc counter. It doesn't use the
 
8586
This function reads the global auto-inc counter. It doesn't use the 
8611
8587
AUTOINC lock even if the lock mode is set to TRADITIONAL.
8612
8588
@return the autoinc value */
8613
8589
UNIV_INTERN
8627
8603
 
8628
8604
  auto_inc = dict_table_autoinc_read(innodb_table);
8629
8605
 
8630
 
  if (auto_inc == 0) {
8631
 
    ut_print_timestamp(stderr);
8632
 
    fprintf(stderr, "  InnoDB: AUTOINC next value generation "
8633
 
            "is disabled for '%s'\n", innodb_table->name);
8634
 
  }
 
8606
  ut_a(auto_inc > 0);
8635
8607
 
8636
8608
  dict_table_autoinc_unlock(innodb_table);
8637
8609
 
9204
9176
  }
9205
9177
}
9206
9178
 
9207
 
 
 
9179
/*************************************************************//**
 
9180
Check if it is a valid file format. This function is registered as
 
9181
a callback with MySQL.
 
9182
@return 0 for valid file format */
 
9183
static
 
9184
int
 
9185
innodb_file_format_name_validate(
 
9186
/*=============================*/
 
9187
  Session*      , /*!< in: thread handle */
 
9188
  drizzle_sys_var*  , /*!< in: pointer to system
 
9189
            variable */
 
9190
  void*       save, /*!< out: immediate result
 
9191
            for update function */
 
9192
  drizzle_value*    value)  /*!< in: incoming string */
 
9193
{
 
9194
  const char* file_format_input;
 
9195
  char    buff[STRING_BUFFER_USUAL_SIZE];
 
9196
  int   len = sizeof(buff);
 
9197
 
 
9198
  ut_a(save != NULL);
 
9199
  ut_a(value != NULL);
 
9200
 
 
9201
  file_format_input = value->val_str(value, buff, &len);
 
9202
 
 
9203
  if (file_format_input != NULL) {
 
9204
    uint  format_id;
 
9205
 
 
9206
    format_id = innobase_file_format_name_lookup(
 
9207
      file_format_input);
 
9208
 
 
9209
    if (format_id <= DICT_TF_FORMAT_MAX) {
 
9210
      /* Save a pointer to the name in the
 
9211
         'file_format_name_map' constant array. */
 
9212
      *static_cast<const char**>(save) =
 
9213
        trx_sys_file_format_id_to_name(format_id);
 
9214
 
 
9215
      return(0);
 
9216
    }
 
9217
  }
 
9218
 
 
9219
  *static_cast<const char**>(save) = NULL;
 
9220
  return(1);
 
9221
}
 
9222
 
 
9223
/****************************************************************//**
 
9224
Update the system variable innodb_file_format using the "saved"
 
9225
value. This function is registered as a callback with MySQL. */
 
9226
static
 
9227
void
 
9228
innodb_file_format_name_update(
 
9229
/*===========================*/
 
9230
  Session*      ,   /*!< in: thread handle */
 
9231
  drizzle_sys_var*  ,   /*!< in: pointer to
 
9232
              system variable */
 
9233
  void*       var_ptr,  /*!< out: where the
 
9234
              formal string goes */
 
9235
  const void*     save)   /*!< in: immediate result
 
9236
              from check function */
 
9237
{
 
9238
  const char* format_name;
 
9239
 
 
9240
  ut_a(var_ptr != NULL);
 
9241
  ut_a(save != NULL);
 
9242
 
 
9243
  format_name = *static_cast<const char*const*>(save);
 
9244
 
 
9245
  if (format_name) {
 
9246
    uint  format_id;
 
9247
 
 
9248
    format_id = innobase_file_format_name_lookup(format_name);
 
9249
 
 
9250
    if (format_id <= DICT_TF_FORMAT_MAX) {
 
9251
      srv_file_format = format_id;
 
9252
    }
 
9253
  }
 
9254
 
 
9255
  *static_cast<const char**>(var_ptr)
 
9256
    = trx_sys_file_format_id_to_name(srv_file_format);
 
9257
}
 
9258
 
 
9259
/*************************************************************//**
 
9260
Check if valid argument to innodb_file_format_max. This function
 
9261
is registered as a callback with MySQL.
 
9262
@return 0 for valid file format */
 
9263
static
 
9264
int
 
9265
innodb_file_format_max_validate(
 
9266
/*==============================*/
 
9267
  Session*      session, /*!< in: thread handle */
 
9268
  drizzle_sys_var*  , /*!< in: pointer to system
 
9269
            variable */
 
9270
  void*       save, /*!< out: immediate result
 
9271
            for update function */
 
9272
  drizzle_value*    value)  /*!< in: incoming string */
 
9273
{
 
9274
  const char* file_format_input;
 
9275
  char    buff[STRING_BUFFER_USUAL_SIZE];
 
9276
  int   len = sizeof(buff);
 
9277
  int   format_id;
 
9278
 
 
9279
  ut_a(save != NULL);
 
9280
  ut_a(value != NULL);
 
9281
 
 
9282
  file_format_input = value->val_str(value, buff, &len);
 
9283
 
 
9284
  if (file_format_input != NULL) {
 
9285
    format_id = innobase_file_format_validate_and_set(file_format_input);
 
9286
 
 
9287
    if (format_id >= 0) {
 
9288
      /* Save a pointer to the name in the
 
9289
         'file_format_name_map' constant array. */
 
9290
      *static_cast<const char**>(save) =
 
9291
        trx_sys_file_format_id_to_name((uint)format_id);
 
9292
 
 
9293
      return(0);
 
9294
 
 
9295
    } else {
 
9296
      push_warning_printf(session,
 
9297
                          DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
9298
                          ER_WRONG_ARGUMENTS,
 
9299
                          "InnoDB: invalid innodb_file_format_max "
 
9300
                          "value; can be any format up to %s "
 
9301
                          "or equivalent id of %d",
 
9302
                          trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
 
9303
                          DICT_TF_FORMAT_MAX);
 
9304
    }
 
9305
  }
 
9306
 
 
9307
  *static_cast<const char**>(save) = NULL;
 
9308
  return(1);
 
9309
}
 
9310
 
 
9311
/****************************************************************//**
 
9312
Update the system variable innodb_file_format_max using the "saved"
 
9313
value. This function is registered as a callback with MySQL. */
 
9314
static
 
9315
void
 
9316
innodb_file_format_max_update(
 
9317
/*============================*/
 
9318
  Session*      session,  /*!< in: thread handle */
 
9319
  drizzle_sys_var*  ,   /*!< in: pointer to
 
9320
              system variable */
 
9321
  void*       var_ptr,  /*!< out: where the
 
9322
              formal string goes */
 
9323
  const void*     save)   /*!< in: immediate result
 
9324
              from check function */
 
9325
{
 
9326
  const char* format_name_in;
 
9327
  const char**  format_name_out;
 
9328
  uint    format_id;
 
9329
 
 
9330
  ut_a(save != NULL);
 
9331
  ut_a(var_ptr != NULL);
 
9332
 
 
9333
  format_name_in = *static_cast<const char*const*>(save);
 
9334
 
 
9335
  if (!format_name_in) {
 
9336
 
 
9337
    return;
 
9338
  }
 
9339
 
 
9340
  format_id = innobase_file_format_name_lookup(format_name_in);
 
9341
 
 
9342
  if (format_id > DICT_TF_FORMAT_MAX) {
 
9343
    /* DEFAULT is "on", which is invalid at runtime. */
 
9344
    push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
9345
            ER_WRONG_ARGUMENTS,
 
9346
            "Ignoring SET innodb_file_format=%s",
 
9347
            format_name_in);
 
9348
    return;
 
9349
  }
 
9350
 
 
9351
  format_name_out = static_cast<const char**>(var_ptr);
 
9352
 
 
9353
  /* Update the max format id in the system tablespace. */
 
9354
  if (trx_sys_file_format_max_set(format_id, format_name_out)) {
 
9355
    ut_print_timestamp(stderr);
 
9356
    fprintf(stderr,
 
9357
      " [Info] InnoDB: the file format in the system "
 
9358
      "tablespace is now set to %s.\n", *format_name_out);
 
9359
  }
 
9360
}
 
9361
 
 
9362
/****************************************************************//**
 
9363
Update the system variable innodb_adaptive_hash_index using the "saved"
 
9364
value. This function is registered as a callback with MySQL. */
 
9365
static
 
9366
void
 
9367
innodb_adaptive_hash_index_update(
 
9368
/*==============================*/
 
9369
  Session*      ,   /*!< in: thread handle */
 
9370
  drizzle_sys_var*  ,   /*!< in: pointer to
 
9371
              system variable */
 
9372
  void*       , /*!< out: where the
 
9373
              formal string goes */
 
9374
  const void*     save)   /*!< in: immediate result
 
9375
              from check function */
 
9376
{
 
9377
  if (*(bool*) save) {
 
9378
    btr_search_enable();
 
9379
  } else {
 
9380
    btr_search_disable();
 
9381
  }
 
9382
}
 
9383
 
 
9384
/****************************************************************//**
 
9385
Update the system variable innodb_old_blocks_pct using the "saved"
 
9386
value. This function is registered as a callback with MySQL. */
 
9387
static
 
9388
void
 
9389
innodb_old_blocks_pct_update(
 
9390
/*=========================*/
 
9391
        Session*                        ,       /*!< in: thread handle */
 
9392
        drizzle_sys_var*        ,       /*!< in: pointer to
 
9393
                                                system variable */
 
9394
        void*                           ,/*!< out: where the
 
9395
                                                formal string goes */
 
9396
        const void*                     save)   /*!< in: immediate result
 
9397
                                                from check function */
 
9398
{
 
9399
        innobase_old_blocks_pct = buf_LRU_old_ratio_update(
 
9400
                *static_cast<const uint*>(save), TRUE);
 
9401
}
 
9402
 
 
9403
/*************************************************************//**
 
9404
Check if it is a valid value of innodb_change_buffering. This function is
 
9405
registered as a callback with MySQL.
 
9406
@return 0 for valid innodb_change_buffering */
 
9407
static
 
9408
int
 
9409
innodb_change_buffering_validate(
 
9410
/*=============================*/
 
9411
  Session*      , /*!< in: thread handle */
 
9412
  drizzle_sys_var*  , /*!< in: pointer to system
 
9413
            variable */
 
9414
  void*       save, /*!< out: immediate result
 
9415
            for update function */
 
9416
  drizzle_value*    value)  /*!< in: incoming string */
 
9417
{
 
9418
  const char* change_buffering_input;
 
9419
  char    buff[STRING_BUFFER_USUAL_SIZE];
 
9420
  int   len = sizeof(buff);
 
9421
 
 
9422
  ut_a(save != NULL);
 
9423
  ut_a(value != NULL);
 
9424
 
 
9425
  change_buffering_input = value->val_str(value, buff, &len);
 
9426
 
 
9427
  if (change_buffering_input != NULL) {
 
9428
    ulint use;
 
9429
 
 
9430
    for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
 
9431
         use++) {
 
9432
      if (!innobase_strcasecmp(
 
9433
            change_buffering_input,
 
9434
            innobase_change_buffering_values[use])) {
 
9435
        *(ibuf_use_t*) save = (ibuf_use_t) use;
 
9436
        return(0);
 
9437
      }
 
9438
    }
 
9439
  }
 
9440
 
 
9441
  return(1);
 
9442
}
 
9443
 
 
9444
/****************************************************************//**
 
9445
Update the system variable innodb_change_buffering using the "saved"
 
9446
value. This function is registered as a callback with MySQL. */
 
9447
static
 
9448
void
 
9449
innodb_change_buffering_update(
 
9450
/*===========================*/
 
9451
  Session*      ,   /*!< in: thread handle */
 
9452
  drizzle_sys_var*  ,   /*!< in: pointer to
 
9453
              system variable */
 
9454
  void*       var_ptr,  /*!< out: where the
 
9455
              formal string goes */
 
9456
  const void*     save)   /*!< in: immediate result
 
9457
              from check function */
 
9458
{
 
9459
  ut_a(var_ptr != NULL);
 
9460
  ut_a(save != NULL);
 
9461
  ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
 
9462
 
 
9463
  ibuf_use = *(const ibuf_use_t*) save;
 
9464
 
 
9465
  *(const char**) var_ptr = innobase_change_buffering_values[ibuf_use];
 
9466
}
 
9467
 
 
9468
/* plugin options */
 
9469
 
 
9470
static DRIZZLE_SYSVAR_ULONG(io_capacity, srv_io_capacity,
 
9471
  PLUGIN_VAR_RQCMDARG,
 
9472
  "Number of IOPs the server can do. Tunes the background IO rate",
 
9473
  NULL, NULL, 200, 100, ~0L, 0);
 
9474
 
 
9475
static DRIZZLE_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
 
9476
  PLUGIN_VAR_OPCMDARG,
 
9477
  "Number of UNDO logs to purge in one batch from the history list. "
 
9478
  "Default is 20",
 
9479
  NULL, NULL,
 
9480
  20,                   /* Default setting */
 
9481
  1,                    /* Minimum value */
 
9482
  5000, 0);             /* Maximum value */
 
9483
 
 
9484
static DRIZZLE_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
 
9485
  PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
 
9486
  "Purge threads can be either 0 or 1. Default is 0.",
 
9487
  NULL, NULL,
 
9488
  0,                    /* Default setting */
 
9489
  0,                    /* Minimum value */
 
9490
  1, 0);                /* Maximum value */
 
9491
 
 
9492
static DRIZZLE_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown,
 
9493
  PLUGIN_VAR_OPCMDARG,
 
9494
  "Speeds up the shutdown process of the InnoDB storage engine. Possible "
 
9495
  "values are 0, 1 (faster)"
 
9496
  " or 2 (fastest - crash-like)"
 
9497
  ".",
 
9498
  NULL, NULL, 1, 0, 2, 0);
 
9499
 
 
9500
static DRIZZLE_SYSVAR_STR(file_format, innobase_file_format_name,
 
9501
  PLUGIN_VAR_RQCMDARG,
 
9502
  "File format to use for new tables in .ibd files.",
 
9503
  innodb_file_format_name_validate,
 
9504
  innodb_file_format_name_update, "Barracuda");
 
9505
 
 
9506
/* "innobase_file_format_check" decides whether we would continue
 
9507
booting the server if the file format stamped on the system
 
9508
table space exceeds the maximum file format supported
 
9509
by the server. Can be set during server startup at command
 
9510
line or configure file, and a read only variable after
 
9511
server startup */
 
9512
 
 
9513
/* If a new file format is introduced, the file format
 
9514
name needs to be updated accordingly. Please refer to
 
9515
file_format_name_map[] defined in trx0sys.c for the next
 
9516
file format name. */
 
9517
static DRIZZLE_SYSVAR_STR(file_format_max, innobase_file_format_max,
 
9518
  PLUGIN_VAR_OPCMDARG,
 
9519
  "The highest file format in the tablespace.",
 
9520
  innodb_file_format_max_validate,
 
9521
  innodb_file_format_max_update,
 
9522
  "Antelope");
 
9523
 
 
9524
static DRIZZLE_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
 
9525
  PLUGIN_VAR_OPCMDARG,
 
9526
  "Set to 0 (write and flush once per second),"
 
9527
  " 1 (write and flush at each commit)"
 
9528
  " or 2 (write at commit, flush once per second).",
 
9529
  NULL, NULL, 1, 0, 2, 0);
 
9530
 
 
9531
static DRIZZLE_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
 
9532
  PLUGIN_VAR_RQCMDARG,
 
9533
  "Percentage of dirty pages allowed in bufferpool.",
 
9534
  NULL, NULL, 75, 0, 99, 0);
 
9535
 
 
9536
static DRIZZLE_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
 
9537
  PLUGIN_VAR_RQCMDARG,
 
9538
  "Desired maximum length of the purge queue (0 = no limit)",
 
9539
  NULL, NULL, 0, 0, ~0L, 0);
 
9540
 
 
9541
static DRIZZLE_SYSVAR_ULONGLONG(stats_sample_pages, srv_stats_sample_pages,
 
9542
  PLUGIN_VAR_RQCMDARG,
 
9543
  "The number of index pages to sample when calculating statistics (default 8)",
 
9544
  NULL, NULL, 8, 1, ~0ULL, 0);
 
9545
 
 
9546
static DRIZZLE_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
 
9547
  PLUGIN_VAR_OPCMDARG,
 
9548
  "Enable InnoDB adaptive hash index (enabled by default).",
 
9549
  NULL, innodb_adaptive_hash_index_update, TRUE);
 
9550
 
 
9551
static DRIZZLE_SYSVAR_ULONG(replication_delay, srv_replication_delay,
 
9552
  PLUGIN_VAR_RQCMDARG,
 
9553
  "Replication thread delay (ms) on the slave server if "
 
9554
  "innodb_thread_concurrency is reached (0 by default)",
 
9555
  NULL, NULL, 0, 0, ~0UL, 0);
 
9556
 
 
9557
static DRIZZLE_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size,
 
9558
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9559
  "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
 
9560
  NULL, NULL, 8*1024*1024L, 512*1024L, LONG_MAX, 1024);
 
9561
 
 
9562
static DRIZZLE_SYSVAR_UINT(autoextend_increment, srv_auto_extend_increment,
 
9563
  PLUGIN_VAR_RQCMDARG,
 
9564
  "Data file autoextend increment in megabytes",
 
9565
  NULL, NULL, 8L, 1L, 1000L, 0);
 
9566
 
 
9567
static DRIZZLE_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
 
9568
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9569
  "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
 
9570
  NULL, NULL, 128*1024*1024L, 5*1024*1024L, INT64_MAX, 1024*1024L);
 
9571
 
 
9572
static DRIZZLE_SYSVAR_LONGLONG(buffer_pool_instances, innobase_buffer_pool_instances,
 
9573
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9574
  "Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
 
9575
  NULL, NULL, 1L, 1L, MAX_BUFFER_POOLS, 1L);
 
9576
 
 
9577
static DRIZZLE_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
 
9578
  PLUGIN_VAR_RQCMDARG,
 
9579
  "Helps in performance tuning in heavily concurrent environments.",
 
9580
  innobase_commit_concurrency_validate, NULL, 0, 0, 1000, 0);
 
9581
 
 
9582
static DRIZZLE_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
 
9583
  PLUGIN_VAR_RQCMDARG,
 
9584
  "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
 
9585
  NULL, NULL, 500L, 1L, ~0L, 0);
 
9586
 
 
9587
static DRIZZLE_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
 
9588
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9589
  "Number of background read I/O threads in InnoDB.",
 
9590
  NULL, NULL, 4, 1, 64, 0);
 
9591
 
 
9592
static DRIZZLE_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
 
9593
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9594
  "Number of background write I/O threads in InnoDB.",
 
9595
  NULL, NULL, 4, 1, 64, 0);
 
9596
 
 
9597
static DRIZZLE_SYSVAR_LONG(force_recovery, innobase_force_recovery,
 
9598
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9599
  "Helps to save your data in case the disk image of the database becomes corrupt.",
 
9600
  NULL, NULL, 0, 0, 6, 0);
 
9601
 
 
9602
static DRIZZLE_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size,
 
9603
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9604
  "The size of the buffer which InnoDB uses to write log to the log files on disk.",
 
9605
  NULL, NULL, 8*1024*1024L, 256*1024L, LONG_MAX, 1024);
 
9606
 
 
9607
static DRIZZLE_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size,
 
9608
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9609
  "Size of each log file in a log group.",
 
9610
  NULL, NULL, 20*1024*1024L, 1*1024*1024L, INT64_MAX, 1024*1024L);
 
9611
 
 
9612
static DRIZZLE_SYSVAR_LONG(log_files_in_group, innobase_log_files_in_group,
 
9613
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9614
  "Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
 
9615
  NULL, NULL, 2, 2, 100, 0);
 
9616
 
 
9617
static DRIZZLE_SYSVAR_LONG(mirrored_log_groups, innobase_mirrored_log_groups,
 
9618
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9619
  "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
 
9620
  NULL, NULL, 1, 1, 10, 0);
 
9621
 
 
9622
static DRIZZLE_SYSVAR_UINT(old_blocks_pct, innobase_old_blocks_pct,
 
9623
  PLUGIN_VAR_RQCMDARG,
 
9624
  "Percentage of the buffer pool to reserve for 'old' blocks.",
 
9625
  NULL, innodb_old_blocks_pct_update, 100 * 3 / 8, 5, 95, 0);
 
9626
 
 
9627
static DRIZZLE_SYSVAR_UINT(old_blocks_time, buf_LRU_old_threshold_ms,
 
9628
  PLUGIN_VAR_RQCMDARG,
 
9629
  "Move blocks to the 'new' end of the buffer pool if the first access"
 
9630
  " was at least this many milliseconds ago."
 
9631
  " The timeout is disabled if 0 (the default).",
 
9632
  NULL, NULL, 0, 0, UINT32_MAX, 0);
 
9633
 
 
9634
static DRIZZLE_SYSVAR_LONG(open_files, innobase_open_files,
 
9635
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
9636
  "How many files at the maximum InnoDB keeps open at the same time.",
 
9637
  NULL, NULL, 300L, 10L, LONG_MAX, 0);
 
9638
 
 
9639
static DRIZZLE_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
 
9640
  PLUGIN_VAR_RQCMDARG,
 
9641
  "Count of spin-loop rounds in InnoDB mutexes (30 by default)",
 
9642
  NULL, NULL, 30L, 0L, ~0L, 0);
 
9643
 
 
9644
static DRIZZLE_SYSVAR_ULONG(spin_wait_delay, srv_spin_wait_delay,
 
9645
  PLUGIN_VAR_OPCMDARG,
 
9646
  "Maximum delay between polling for a spin lock (6 by default)",
 
9647
  NULL, NULL, 6L, 0L, ~0L, 0);
 
9648
 
 
9649
static DRIZZLE_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
 
9650
  PLUGIN_VAR_RQCMDARG,
 
9651
  "Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
 
9652
  NULL, NULL, 0, 0, 1000, 0);
 
9653
 
 
9654
static DRIZZLE_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay,
 
9655
  PLUGIN_VAR_RQCMDARG,
 
9656
  "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
 
9657
  NULL, NULL, 10000L, 0L, ~0L, 0);
 
9658
 
 
9659
static DRIZZLE_SYSVAR_STR(change_buffering, innobase_change_buffering,
 
9660
  PLUGIN_VAR_RQCMDARG,
 
9661
  "Buffer changes to reduce random access: "
 
9662
  "OFF, ON, inserting, deleting, changing or purging..",
 
9663
  innodb_change_buffering_validate,
 
9664
  innodb_change_buffering_update, "all");
 
9665
 
 
9666
static DRIZZLE_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
 
9667
  PLUGIN_VAR_RQCMDARG,
 
9668
  "Number of pages that must be accessed sequentially for InnoDB to "
 
9669
  "trigger a readahead.",
 
9670
  NULL, NULL, 56, 0, 64, 0);
9208
9671
 
9209
9672
static void init_options(drizzled::module::option_context &context)
9210
9673
{
9216
9679
  context("disable-doublewrite",
9217
9680
          "Disable InnoDB doublewrite buffer.");
9218
9681
  context("io-capacity",
9219
 
          po::value<io_capacity_constraint>(&innodb_io_capacity)->default_value(200),
 
9682
          po::value<unsigned long>(&srv_io_capacity)->default_value(200),
9220
9683
          "Number of IOPs the server can do. Tunes the background IO rate");
9221
9684
  context("fast-shutdown",
9222
 
          po::value<trinary_constraint>(&innobase_fast_shutdown)->default_value(1), 
 
9685
          po::value<unsigned long>(&innobase_fast_shutdown)->default_value(1), 
9223
9686
          "Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).");
9224
9687
  context("purge-batch-size",
9225
 
          po::value<purge_batch_constraint>(&innodb_purge_batch_size)->default_value(20),
 
9688
          po::value<unsigned long>(&srv_purge_batch_size)->default_value(20),
9226
9689
          "Number of UNDO logs to purge in one batch from the history list. "
9227
9690
          "Default is 20.");
9228
9691
  context("purge-threads",
9229
 
          po::value<purge_threads_constraint>(&innodb_n_purge_threads)->default_value(0),
 
9692
          po::value<unsigned long>(&srv_n_purge_threads)->default_value(0),
9230
9693
          "Purge threads can be either 0 or 1. Defalut is 0.");
9231
9694
  context("file-per-table",
9232
9695
          po::value<bool>(&srv_file_per_table)->default_value(false)->zero_tokens(),
9233
9696
          "Stores each InnoDB table to an .ibd file in the database dir.");
9234
9697
  context("file-format",
9235
 
          po::value<string>(&innobase_file_format_name)->default_value("Antelope"),
 
9698
          po::value<string>()->default_value("Antelope"),
9236
9699
          "File format to use for new tables in .ibd files.");
9237
9700
  context("file-format-max",
9238
 
          po::value<string>(&innobase_file_format_max)->default_value("Antelope"),
 
9701
          po::value<string>()->default_value("Antelope"),
9239
9702
          "The highest file format in the tablespace.");
9240
9703
  context("file-format-check",
9241
9704
          po::value<bool>(&innobase_file_format_check)->default_value(true)->zero_tokens(),
9242
9705
          "Whether to perform system file format check.");
9243
9706
  context("flush-log-at-trx-commit",
9244
 
          po::value<trinary_constraint>(&innodb_flush_log_at_trx_commit)->default_value(1),
 
9707
          po::value<unsigned long>(&srv_flush_log_at_trx_commit)->default_value(1),
9245
9708
          "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).");
9246
9709
  context("flush-method",
9247
9710
          po::value<string>(),
9248
9711
          "With which method to flush data.");
 
9712
#ifdef UNIV_LOG_ARCHIVE
 
9713
  context("log-arch-dir",
 
9714
          po::value<string>(),
 
9715
          "Where full logs should be archived.");
 
9716
  context("log-archive",
 
9717
          po::value<bool>(&innobase_log_archive)->default_value(false)->zero_tokens(),
 
9718
          "Set to 1 if you want to have logs archived.");
 
9719
#endif /* UNIV_LOG_ARCHIVE */
9249
9720
  context("log-group-home-dir",
9250
9721
          po::value<string>(),
9251
9722
          "Path to InnoDB log files.");
9252
9723
  context("max-dirty-pages-pct",
9253
 
          po::value<max_dirty_pages_constraint>(&innodb_max_dirty_pages_pct)->default_value(75),
 
9724
          po::value<unsigned long>(&srv_max_buf_pool_modified_pct)->default_value(75),
9254
9725
          "Percentage of dirty pages allowed in bufferpool.");
9255
9726
  context("disable-adaptive-flushing",
9256
9727
          "Do not attempt flushing dirty pages to avoid IO bursts at checkpoints.");
9257
9728
  context("max-purge-lag",
9258
 
          po::value<uint64_constraint>(&innodb_max_purge_lag)->default_value(0),
 
9729
          po::value<unsigned long>(&srv_max_purge_lag)->default_value(0),
9259
9730
          "Desired maximum length of the purge queue (0 = no limit)");
9260
9731
  context("status-file",
9261
9732
          po::value<bool>(&innobase_create_status_file)->default_value(false)->zero_tokens(),
9263
9734
  context("disable-stats-on-metadata",
9264
9735
          "Disable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)");
9265
9736
  context("stats-sample-pages",
9266
 
          po::value<uint64_nonzero_constraint>(&innodb_stats_sample_pages)->default_value(8),
 
9737
          po::value<uint64_t>(&srv_stats_sample_pages)->default_value(8),
9267
9738
          "The number of index pages to sample when calculating statistics (default 8)");
9268
9739
  context("disable-adaptive-hash-index",
9269
9740
          "Enable InnoDB adaptive hash index (enabled by default)");
9270
9741
  context("replication-delay",
9271
 
          po::value<uint64_constraint>(&innodb_replication_delay)->default_value(0),
 
9742
          po::value<unsigned long>(&srv_replication_delay)->default_value(0),
9272
9743
          "Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)");
9273
9744
  context("additional-mem-pool-size",
9274
 
          po::value<additional_mem_pool_constraint>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
 
9745
          po::value<long>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9275
9746
          "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.");
9276
9747
  context("autoextend-increment",
9277
 
          po::value<autoextend_constraint>(&innodb_auto_extend_increment)->default_value(8L),
 
9748
          po::value<uint32_t>(&srv_auto_extend_increment)->default_value(8L),
9278
9749
          "Data file autoextend increment in megabytes");
9279
9750
  context("buffer-pool-size",
9280
 
          po::value<buffer_pool_constraint>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
 
9751
          po::value<int64_t>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9281
9752
          "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.");
9282
9753
  context("buffer-pool-instances",
9283
 
          po::value<buffer_pool_instances_constraint>(&innobase_buffer_pool_instances)->default_value(1),
 
9754
          po::value<int64_t>(&innobase_buffer_pool_instances)->default_value(1),
9284
9755
          "Number of buffer pool instances, set to higher value on high-end machines to increase scalability");
9285
9756
 
9286
9757
  context("commit-concurrency",
9287
 
          po::value<concurrency_constraint>(&innobase_commit_concurrency)->default_value(0),
 
9758
          po::value<unsigned long>(&innobase_commit_concurrency)->default_value(0),
9288
9759
          "Helps in performance tuning in heavily concurrent environments.");
9289
9760
  context("concurrency-tickets",
9290
 
          po::value<uint32_nonzero_constraint>(&innodb_concurrency_tickets)->default_value(500L),
 
9761
          po::value<unsigned long>(&srv_n_free_tickets_to_enter)->default_value(500L),
9291
9762
          "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket");
9292
9763
  context("read-io-threads",
9293
 
          po::value<io_threads_constraint>(&innobase_read_io_threads)->default_value(4),
 
9764
          po::value<unsigned long>(&innobase_read_io_threads)->default_value(4),
9294
9765
          "Number of background read I/O threads in InnoDB.");
9295
9766
  context("write-io-threads",
9296
 
          po::value<io_threads_constraint>(&innobase_write_io_threads)->default_value(4),
 
9767
          po::value<unsigned long>(&innobase_write_io_threads)->default_value(4),
9297
9768
          "Number of background write I/O threads in InnoDB.");
9298
9769
  context("force-recovery",
9299
 
          po::value<force_recovery_constraint>(&innobase_force_recovery)->default_value(0),
 
9770
          po::value<long>(&innobase_force_recovery)->default_value(0),
9300
9771
          "Helps to save your data in case the disk image of the database becomes corrupt.");
9301
9772
  context("log-buffer-size",
9302
 
          po::value<log_buffer_constraint>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
 
9773
          po::value<long>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
9303
9774
          "The size of the buffer which InnoDB uses to write log to the log files on disk.");
9304
9775
  context("log-file-size",
9305
 
          po::value<log_file_constraint>(&innobase_log_file_size)->default_value(20*1024*1024L),
 
9776
          po::value<int64_t>(&innobase_log_file_size)->default_value(20*1024*1024L),
9306
9777
          "The size of the buffer which InnoDB uses to write log to the log files on disk.");
9307
9778
  context("log-files-in-group",
9308
 
          po::value<log_files_in_group_constraint>(&innobase_log_files_in_group)->default_value(2),
 
9779
          po::value<long>(&innobase_log_files_in_group)->default_value(2),
9309
9780
          "Number of log files in the log group. InnoDB writes to the files in a circular fashion.");
9310
9781
  context("mirrored-log-groups",
9311
 
          po::value<mirrored_log_groups_constraint>(&innobase_mirrored_log_groups)->default_value(1),
 
9782
          po::value<long>(&innobase_mirrored_log_groups)->default_value(1),
9312
9783
          "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.");
9313
9784
  context("open-files",
9314
 
          po::value<open_files_constraint>(&innobase_open_files)->default_value(300L),
 
9785
          po::value<long>(&innobase_open_files)->default_value(300L),
9315
9786
          "How many files at the maximum InnoDB keeps open at the same time.");
9316
9787
  context("sync-spin-loops",
9317
 
          po::value<uint32_constraint>(&innodb_sync_spin_loops)->default_value(30L),
 
9788
          po::value<unsigned long>(&srv_n_spin_wait_rounds)->default_value(30L),
9318
9789
          "Count of spin-loop rounds in InnoDB mutexes (30 by default)");
9319
9790
  context("spin-wait-delay",
9320
 
          po::value<uint32_constraint>(&innodb_spin_wait_delay)->default_value(6L),
 
9791
          po::value<unsigned long>(&srv_spin_wait_delay)->default_value(6L),
9321
9792
          "Maximum delay between polling for a spin lock (6 by default)");
9322
9793
  context("thread-concurrency",
9323
 
          po::value<concurrency_constraint>(&innobase_thread_concurrency)->default_value(0),
 
9794
          po::value<unsigned long>(&srv_thread_concurrency)->default_value(0),
9324
9795
          "Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.");
9325
9796
  context("thread-sleep-delay",
9326
 
          po::value<uint32_constraint>(&innodb_thread_sleep_delay)->default_value(10000L),
 
9797
          po::value<unsigned long>(&srv_thread_sleep_delay)->default_value(10000L),
9327
9798
          "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep");
9328
9799
  context("data-file-path",
9329
9800
          po::value<string>(),
9334
9805
  context("use-internal-malloc",
9335
9806
          "Use InnoDB's internal memory allocator instal of the OS memory allocator.");
9336
9807
  context("change-buffering",
9337
 
          po::value<string>(&innobase_change_buffering),
 
9808
          po::value<string>(),
9338
9809
          "Buffer changes to reduce random access: OFF, ON, inserting, deleting, changing, or purging.");
9339
9810
  context("read-ahead-threshold",
9340
 
          po::value<read_ahead_threshold_constraint>(&innodb_read_ahead_threshold)->default_value(56),
 
9811
          po::value<unsigned long>(&srv_read_ahead_threshold)->default_value(56),
9341
9812
          "Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.");
9342
9813
  context("disable-xa",
9343
9814
          "Disable InnoDB support for the XA two-phase commit");
9347
9818
          po::value<bool>(&strict_mode)->default_value(false)->zero_tokens(),
9348
9819
          "Use strict mode when evaluating create options.");
9349
9820
  context("replication-log",
9350
 
          po::value<bool>(&innobase_use_replication_log)->default_value(false),
9351
 
          _("Enable internal replication log."));
 
9821
          po::value<bool>()->default_value(false),
 
9822
          "Enable internal replication log.");
9352
9823
  context("lock-wait-timeout",
9353
9824
          po::value<lock_wait_constraint>(&lock_wait_timeout)->default_value(50),
9354
 
          _("Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout."));
9355
 
  context("old-blocks-pct",
9356
 
          po::value<old_blocks_constraint>(&innobase_old_blocks_pct)->default_value(100 * 3 / 8),
9357
 
          _("Percentage of the buffer pool to reserve for 'old' blocks."));
9358
 
  context("old-blocks-time",
9359
 
          po::value<uint32_t>(&buf_LRU_old_threshold_ms)->default_value(0),
9360
 
          _("ove blocks to the 'new' end of the buffer pool if the first access"
9361
 
            " was at least this many milliseconds ago."
9362
 
            " The timeout is disabled if 0 (the default)."));
 
9825
          "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.");
9363
9826
}
9364
9827
 
9365
 
 
 
9828
static drizzle_sys_var* innobase_system_variables[]= {
 
9829
  DRIZZLE_SYSVAR(additional_mem_pool_size),
 
9830
  DRIZZLE_SYSVAR(autoextend_increment),
 
9831
  DRIZZLE_SYSVAR(buffer_pool_size),
 
9832
  DRIZZLE_SYSVAR(buffer_pool_instances),
 
9833
  DRIZZLE_SYSVAR(commit_concurrency),
 
9834
  DRIZZLE_SYSVAR(concurrency_tickets),
 
9835
  DRIZZLE_SYSVAR(fast_shutdown),
 
9836
  DRIZZLE_SYSVAR(read_io_threads),
 
9837
  DRIZZLE_SYSVAR(write_io_threads),
 
9838
  DRIZZLE_SYSVAR(file_format),
 
9839
  DRIZZLE_SYSVAR(file_format_max),
 
9840
  DRIZZLE_SYSVAR(flush_log_at_trx_commit),
 
9841
  DRIZZLE_SYSVAR(force_recovery),
 
9842
#ifdef UNIV_LOG_ARCHIVE
 
9843
  DRIZZLE_SYSVAR(log_archive),
 
9844
#endif /* UNIV_LOG_ARCHIVE */
 
9845
  DRIZZLE_SYSVAR(log_buffer_size),
 
9846
  DRIZZLE_SYSVAR(log_file_size),
 
9847
  DRIZZLE_SYSVAR(log_files_in_group),
 
9848
  DRIZZLE_SYSVAR(max_dirty_pages_pct),
 
9849
  DRIZZLE_SYSVAR(max_purge_lag),
 
9850
  DRIZZLE_SYSVAR(mirrored_log_groups),
 
9851
  DRIZZLE_SYSVAR(old_blocks_pct),
 
9852
  DRIZZLE_SYSVAR(old_blocks_time),
 
9853
  DRIZZLE_SYSVAR(open_files),
 
9854
  DRIZZLE_SYSVAR(stats_sample_pages),
 
9855
  DRIZZLE_SYSVAR(adaptive_hash_index),
 
9856
  DRIZZLE_SYSVAR(replication_delay),
 
9857
  DRIZZLE_SYSVAR(sync_spin_loops),
 
9858
  DRIZZLE_SYSVAR(spin_wait_delay),
 
9859
  DRIZZLE_SYSVAR(thread_concurrency),
 
9860
  DRIZZLE_SYSVAR(thread_sleep_delay),
 
9861
  DRIZZLE_SYSVAR(change_buffering),
 
9862
  DRIZZLE_SYSVAR(read_ahead_threshold),
 
9863
  DRIZZLE_SYSVAR(io_capacity),
 
9864
  DRIZZLE_SYSVAR(purge_threads),
 
9865
  DRIZZLE_SYSVAR(purge_batch_size),
 
9866
  NULL
 
9867
};
9366
9868
 
9367
9869
DRIZZLE_DECLARE_PLUGIN
9368
9870
{
9373
9875
  "Supports transactions, row-level locking, and foreign keys",
9374
9876
  PLUGIN_LICENSE_GPL,
9375
9877
  innobase_init, /* Plugin Init */
9376
 
  NULL, /* system variables */
 
9878
  innobase_system_variables, /* system variables */
9377
9879
  init_options /* reserved */
9378
9880
}
9379
9881
DRIZZLE_DECLARE_PLUGIN_END;
9401
9903
  return res;
9402
9904
}
9403
9905
 
 
9906
/** @brief Initialize the default value of innodb_commit_concurrency.
 
9907
 
 
9908
Once InnoDB is running, the innodb_commit_concurrency must not change
 
9909
from zero to nonzero. (Bug #42101)
 
9910
 
 
9911
The initial default value is 0, and without this extra initialization,
 
9912
SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
 
9913
to 0, even if it was initially set to nonzero at the command line
 
9914
or configuration file. */
 
9915
static
 
9916
void
 
9917
innobase_commit_concurrency_init_default(void)
 
9918
/*==========================================*/
 
9919
{
 
9920
  DRIZZLE_SYSVAR_NAME(commit_concurrency).def_val
 
9921
    = innobase_commit_concurrency;
 
9922
}
 
9923
 
9404
9924
/***********************************************************************
9405
9925
This function checks each index name for a table against reserved
9406
9926
system default primary index name 'GEN_CLUST_INDEX'. If a name matches,