~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-12-21 16:39:40 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20101221163940-c1pfo1jjvx7909xq
Tags: 2010.12.06-0ubuntu1
* New upstream release.
* Added libaio-dev build depend for InnoDB.
* Removed libpcre patch - applied upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
4
 
Copyright (c) 2008, 2009 Google Inc.
5
 
Copyright (c) 2009, Percona Inc.
 
3
Copyright (C) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
 
4
Copyright (C) 2008, 2009 Google Inc.
 
5
Copyright (C) 2009, Percona Inc.
6
6
 
7
7
Portions of this file contain modifications contributed and copyrighted by
8
8
Google, Inc. Those modifications are gratefully acknowledged and are described
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 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;
 
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;
198
226
 
199
227
/** Percentage of the buffer pool to reserve for 'old' blocks.
200
228
Connected to buf_LRU_old_ratio. */
201
 
static uint innobase_old_blocks_pct;
 
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;
202
238
 
203
239
/* The default values for the following char* start-up parameters
204
240
are determined in innobase_init below: */
206
242
std::string innobase_data_home_dir;
207
243
std::string innobase_data_file_path;
208
244
std::string innobase_log_group_home_dir;
209
 
static char* innobase_file_format_name= NULL;
210
 
static char* innobase_change_buffering= NULL;
 
245
static string innobase_file_format_name;
 
246
static string innobase_change_buffering;
211
247
 
212
248
/* The highest file format being used in the database. The value can be
213
249
set by user, however, it will be adjusted to the newer file format if
214
250
a table of such format is created/opened. */
215
 
static char* innobase_file_format_max= NULL;
216
 
 
217
 
std::string  innobase_log_arch_dir;
 
251
static string innobase_file_format_max;
218
252
 
219
253
/* Below we have boolean-valued start-up parameters, and their default
220
254
values */
221
255
 
222
 
static ulong  innobase_fast_shutdown      = 1;
 
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
 
223
271
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 */
227
272
static my_bool  innobase_use_doublewrite    = TRUE;
228
273
static my_bool  innobase_use_checksums      = TRUE;
229
274
static my_bool  innobase_rollback_on_timeout    = FALSE;
230
275
static my_bool  innobase_create_status_file   = FALSE;
 
276
static bool innobase_use_replication_log;
231
277
static bool support_xa;
232
278
static bool strict_mode;
233
279
typedef constrained_check<uint32_t, 1024*1024*1024, 1> lock_wait_constraint;
573
619
  return ENOENT;
574
620
}
575
621
 
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
 
/*==========================================*/
589
622
 
590
623
/************************************************************//**
591
624
Validate the file format name and return its corresponding id.
608
641
 
609
642
static const char innobase_engine_name[]= "InnoDB";
610
643
 
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
 
 
641
644
 
642
645
/*****************************************************************//**
643
646
Commits a transaction in an InnoDB database. */
1036
1039
  case DB_INTERRUPTED:
1037
1040
    my_error(ER_QUERY_INTERRUPTED, MYF(0));
1038
1041
    /* 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
 
1039
1054
  case DB_ERROR:
1040
1055
  default:
1041
1056
    return(-1); /* unspecified error */
1162
1177
           use the default max length */
1163
1178
{
1164
1179
  Session *session= reinterpret_cast<Session *>(in_session);
 
1180
  drizzled::identifier::User::const_shared_ptr user_identifier(session->user());
 
1181
 
1165
1182
  fprintf(f,
1166
1183
          "Drizzle thread %"PRIu64", query id %"PRIu64", %s, %s, %s ",
1167
1184
          static_cast<uint64_t>(session->getSessionId()),
1168
1185
          static_cast<uint64_t>(session->getQueryId()),
1169
1186
          glob_hostname,
1170
 
          session->getSecurityContext().getIp().c_str(),
1171
 
          session->getSecurityContext().getUser().c_str()
 
1187
          user_identifier->address().c_str(),
 
1188
          user_identifier->username().c_str()
1172
1189
  );
1173
1190
  fprintf(f, "\n%s", session->getQueryString()->c_str());
1174
1191
  putc('\n', f);
1824
1841
  value= value - (value % align_val);
1825
1842
}
1826
1843
 
 
1844
static void auto_extend_update(Session *, sql_var_t)
 
1845
{
 
1846
  srv_auto_extend_increment= innodb_auto_extend_increment.get();
 
1847
}
 
1848
 
 
1849
static void io_capacity_update(Session *, sql_var_t)
 
1850
{
 
1851
  srv_io_capacity= innodb_io_capacity.get();
 
1852
}
 
1853
 
 
1854
static void purge_batch_update(Session *, sql_var_t)
 
1855
{
 
1856
  srv_purge_batch_size= innodb_purge_batch_size.get();
 
1857
}
 
1858
 
 
1859
static void purge_threads_update(Session *, sql_var_t)
 
1860
{
 
1861
  srv_n_purge_threads= innodb_n_purge_threads.get();
 
1862
}
 
1863
 
 
1864
static void innodb_adaptive_hash_index_update(Session *, sql_var_t)
 
1865
{
 
1866
  if (btr_search_enabled)
 
1867
  {
 
1868
    btr_search_enable();
 
1869
  } else {
 
1870
    btr_search_disable();
 
1871
  }
 
1872
}
 
1873
 
 
1874
static void innodb_old_blocks_pct_update(Session *, sql_var_t)
 
1875
{
 
1876
  innobase_old_blocks_pct= buf_LRU_old_ratio_update(innobase_old_blocks_pct.get(), TRUE);
 
1877
}
 
1878
 
 
1879
static void innodb_thread_concurrency_update(Session *, sql_var_t)
 
1880
{
 
1881
  srv_thread_concurrency= innobase_thread_concurrency.get();
 
1882
}
 
1883
 
 
1884
static void innodb_sync_spin_loops_update(Session *, sql_var_t)
 
1885
{
 
1886
  srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
 
1887
}
 
1888
 
 
1889
static void innodb_spin_wait_delay_update(Session *, sql_var_t)
 
1890
{
 
1891
  srv_spin_wait_delay= innodb_spin_wait_delay.get();
 
1892
}
 
1893
 
 
1894
static void innodb_thread_sleep_delay_update(Session *, sql_var_t)
 
1895
{
 
1896
  srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
 
1897
}
 
1898
 
 
1899
static void innodb_read_ahead_threshold_update(Session *, sql_var_t)
 
1900
{
 
1901
  srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
 
1902
}
 
1903
 
 
1904
 
 
1905
static int innodb_commit_concurrency_validate(Session *session, set_var *var)
 
1906
{
 
1907
   uint32_t new_value= var->save_result.uint32_t_value;
 
1908
 
 
1909
   if ((innobase_commit_concurrency.get() == 0 && new_value != 0) ||
 
1910
       (innobase_commit_concurrency.get() != 0 && new_value == 0))
 
1911
   {
 
1912
     push_warning_printf(session,
 
1913
                         DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
1914
                         ER_WRONG_ARGUMENTS,
 
1915
                         _("Once InnoDB is running, innodb_commit_concurrency "
 
1916
                           "must not change between zero and nonzero."));
 
1917
     return 1;
 
1918
   }
 
1919
   return 0;
 
1920
}
 
1921
 
 
1922
/*************************************************************//**
 
1923
Check if it is a valid file format. This function is registered as
 
1924
a callback with MySQL.
 
1925
@return 0 for valid file format */
 
1926
static
 
1927
int
 
1928
innodb_file_format_name_validate(
 
1929
/*=============================*/
 
1930
  Session*      , /*!< in: thread handle */
 
1931
  set_var *var)
 
1932
{
 
1933
  const char *file_format_input = var->value->str_value.ptr();
 
1934
  if (file_format_input == NULL)
 
1935
    return 1;
 
1936
 
 
1937
  if (file_format_input != NULL) {
 
1938
    uint  format_id;
 
1939
 
 
1940
    format_id = innobase_file_format_name_lookup(
 
1941
      file_format_input);
 
1942
 
 
1943
    if (format_id <= DICT_TF_FORMAT_MAX) {
 
1944
      innobase_file_format_name =
 
1945
        trx_sys_file_format_id_to_name(format_id);
 
1946
 
 
1947
      return(0);
 
1948
    }
 
1949
  }
 
1950
 
 
1951
  return(1);
 
1952
}
 
1953
 
 
1954
/*************************************************************//**
 
1955
Check if it is a valid value of innodb_change_buffering. This function is
 
1956
registered as a callback with MySQL.
 
1957
@return 0 for valid innodb_change_buffering */
 
1958
static
 
1959
int
 
1960
innodb_change_buffering_validate(
 
1961
/*=============================*/
 
1962
  Session*      , /*!< in: thread handle */
 
1963
  set_var *var)
 
1964
{
 
1965
  const char *change_buffering_input = var->value->str_value.ptr();
 
1966
 
 
1967
  if (change_buffering_input == NULL)
 
1968
    return 1;
 
1969
 
 
1970
  ulint use;
 
1971
 
 
1972
  for (use = 0;
 
1973
       use < UT_ARR_SIZE(innobase_change_buffering_values);
 
1974
       ++use) {
 
1975
    if (!innobase_strcasecmp(change_buffering_input,
 
1976
                             innobase_change_buffering_values[use]))
 
1977
    {
 
1978
      ibuf_use= static_cast<ibuf_use_t>(use); 
 
1979
      return 0;
 
1980
    }
 
1981
  }
 
1982
 
 
1983
  return 1;
 
1984
}
 
1985
 
 
1986
 
 
1987
/*************************************************************//**
 
1988
Check if valid argument to innodb_file_format_max. This function
 
1989
is registered as a callback with MySQL.
 
1990
@return 0 for valid file format */
 
1991
static
 
1992
int
 
1993
innodb_file_format_max_validate(
 
1994
/*==============================*/
 
1995
  Session*   session, /*!< in: thread handle */
 
1996
  set_var *var)
 
1997
{
 
1998
  const char *file_format_input = var->value->str_value.ptr();
 
1999
  if (file_format_input == NULL)
 
2000
    return 1;
 
2001
 
 
2002
  if (file_format_input != NULL) {
 
2003
    int format_id = innobase_file_format_validate_and_set(file_format_input);
 
2004
 
 
2005
    if (format_id > DICT_TF_FORMAT_MAX) {
 
2006
      /* DEFAULT is "on", which is invalid at runtime. */
 
2007
      return 1;
 
2008
    }
 
2009
 
 
2010
    if (format_id >= 0) {
 
2011
      innobase_file_format_max= 
 
2012
        trx_sys_file_format_id_to_name((uint)format_id);
 
2013
 
 
2014
      /* Update the max format id in the system tablespace. */
 
2015
      char name_buff[100];
 
2016
      strcpy(name_buff, innobase_file_format_max.c_str());
 
2017
      if (trx_sys_file_format_max_set(format_id, (const char **)&name_buff))
 
2018
      {
 
2019
        errmsg_printf(ERRMSG_LVL_WARN,
 
2020
                      " [Info] InnoDB: the file format in the system "
 
2021
                      "tablespace is now set to %s.\n", name_buff);
 
2022
        innobase_file_format_max= name_buff;
 
2023
      }
 
2024
      return(0);
 
2025
 
 
2026
    } else {
 
2027
      push_warning_printf(session,
 
2028
                          DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
2029
                          ER_WRONG_ARGUMENTS,
 
2030
                          "InnoDB: invalid innodb_file_format_max "
 
2031
                          "value; can be any format up to %s "
 
2032
                          "or equivalent id of %d",
 
2033
                          trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
 
2034
                          DICT_TF_FORMAT_MAX);
 
2035
    }
 
2036
  }
 
2037
 
 
2038
  return(1);
 
2039
}
 
2040
 
 
2041
 
1827
2042
/*********************************************************************//**
1828
2043
Opens an InnoDB database.
1829
2044
@return 0 on success, error code on failure */
1839
2054
  InnobaseEngine *actuall_engine_ptr;
1840
2055
  const module::option_map &vm= context.getOptions();
1841
2056
 
 
2057
  srv_auto_extend_increment= innodb_auto_extend_increment.get();
 
2058
  srv_io_capacity= innodb_io_capacity.get();
 
2059
  srv_purge_batch_size= innodb_purge_batch_size.get();
 
2060
  srv_n_purge_threads= innodb_n_purge_threads.get();
 
2061
  srv_flush_log_at_trx_commit= innodb_flush_log_at_trx_commit.get();
 
2062
  srv_max_buf_pool_modified_pct= innodb_max_dirty_pages_pct.get();
 
2063
  srv_max_purge_lag= innodb_max_purge_lag.get();
 
2064
  srv_stats_sample_pages= innodb_stats_sample_pages.get();
 
2065
  srv_n_free_tickets_to_enter= innodb_concurrency_tickets.get();
 
2066
  srv_replication_delay= innodb_replication_delay.get();
 
2067
  srv_thread_concurrency= innobase_thread_concurrency.get();
 
2068
  srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
 
2069
  srv_spin_wait_delay= innodb_spin_wait_delay.get();
 
2070
  srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
 
2071
  srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
 
2072
 
1842
2073
  /* Inverted Booleans */
1843
2074
 
1844
2075
  innobase_use_checksums= (vm.count("disable-checksums")) ? false : true;
1846
2077
  srv_adaptive_flushing= (vm.count("disable-adaptive-flushing")) ? false : true;
1847
2078
  srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
1848
2079
  support_xa= (vm.count("disable-xa")) ? false : true;
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
 
 
 
2080
  btr_search_enabled= (vm.count("disable-adaptive-hash-index")) ? false : true;
 
2081
 
 
2082
 
 
2083
  /* Hafta do this here because we need to late-bind the default value */
1859
2084
  if (vm.count("data-home-dir"))
1860
2085
  {
1861
2086
    innobase_data_home_dir= vm["data-home-dir"].as<string>();
1865
2090
    innobase_data_home_dir= getDataHome().file_string();
1866
2091
  }
1867
2092
 
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
 
  }
2065
2093
 
2066
2094
  if (vm.count("data-file-path"))
2067
2095
  {
2068
2096
    innobase_data_file_path= vm["data-file-path"].as<string>();
2069
2097
  }
2070
2098
 
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
 
 
2081
2099
 
2082
2100
  innodb_engine_ptr= actuall_engine_ptr= new InnobaseEngine(innobase_engine_name);
2083
2101
 
2101
2119
  }
2102
2120
#endif /* UNIV_DEBUG */
2103
2121
 
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
 
 
2123
2122
  os_innodb_umask = (ulint)internal::my_umask;
2124
2123
 
2125
2124
 
2171
2170
    innobase_log_group_home_dir= getDataHome().file_string();
2172
2171
  }
2173
2172
 
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
 
 
2184
2173
  ret = (bool)
2185
2174
    srv_parse_log_group_home_dirs((char *)innobase_log_group_home_dir.c_str());
2186
2175
 
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");
 
2176
  if (ret == FALSE || innobase_mirrored_log_groups.get() != 1) {
 
2177
    errmsg_printf(ERRMSG_LVL_ERROR,
 
2178
                  _("syntax error in innodb_log_group_home_dir, or a "
 
2179
                  "wrong number of mirrored log groups"));
2190
2180
 
2191
2181
    goto mem_free_and_error;
2192
2182
  }
2209
2199
    format_id = 0;
2210
2200
  }
2211
2201
 
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
 
 
2232
2202
  srv_file_format = format_id;
2233
2203
 
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
 
 
2239
2204
  innobase_file_format_name =
2240
 
    (char*) trx_sys_file_format_id_to_name(format_id);
 
2205
    trx_sys_file_format_id_to_name(format_id);
2241
2206
 
2242
2207
  /* Check innobase_file_format_check variable */
2243
2208
  if (!innobase_file_format_check)
2252
2217
  /* Did the user specify a format name that we support?
2253
2218
     As a side effect it will update the variable
2254
2219
     srv_max_file_format_at_startup */
2255
 
  if (innobase_file_format_validate_and_set(innobase_file_format_max) < 0)
 
2220
  if (innobase_file_format_validate_and_set(innobase_file_format_max.c_str()) < 0)
2256
2221
  {
2257
 
    errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: invalid "
 
2222
    errmsg_printf(ERRMSG_LVL_ERROR, _("InnoDB: invalid "
2258
2223
                    "innodb_file_format_max value: "
2259
2224
                    "should be any value up to %s or its "
2260
 
                    "equivalent numeric id",
 
2225
                    "equivalent numeric id"),
2261
2226
                    trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX));
2262
2227
    goto mem_free_and_error;
2263
2228
  }
2270
2235
         use < UT_ARR_SIZE(innobase_change_buffering_values);
2271
2236
         use++) {
2272
2237
      if (!innobase_strcasecmp(
2273
 
                               vm["change-buffering"].as<string>().c_str(),
 
2238
                               innobase_change_buffering.c_str(),
2274
2239
                               innobase_change_buffering_values[use])) {
2275
 
        ibuf_use = (ibuf_use_t) use;
 
2240
        ibuf_use = static_cast<ibuf_use_t>(use);
2276
2241
        goto innobase_change_buffering_inited_ok;
2277
2242
      }
2278
2243
    }
2286
2251
 
2287
2252
innobase_change_buffering_inited_ok:
2288
2253
  ut_a((ulint) ibuf_use < UT_ARR_SIZE(innobase_change_buffering_values));
2289
 
  innobase_change_buffering = (char*)
2290
 
    innobase_change_buffering_values[ibuf_use];
 
2254
  innobase_change_buffering = innobase_change_buffering_values[ibuf_use];
2291
2255
 
2292
2256
  /* --------------------------------------------------*/
2293
2257
 
2300
2264
  srv_n_log_files = (ulint) innobase_log_files_in_group;
2301
2265
  srv_log_file_size = (ulint) innobase_log_file_size;
2302
2266
 
2303
 
#ifdef UNIV_LOG_ARCHIVE
2304
 
  srv_log_archive_on = (ulint) innobase_log_archive;
2305
 
#endif /* UNIV_LOG_ARCHIVE */
2306
2267
  srv_log_buffer_size = (ulint) innobase_log_buffer_size;
2307
2268
 
2308
2269
  srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
2337
2298
 
2338
2299
  data_mysql_default_charset_coll = (ulint)default_charset_info->number;
2339
2300
 
2340
 
  innobase_commit_concurrency_init_default();
2341
 
 
2342
2301
  /* Since we in this module access directly the fields of a trx
2343
2302
    struct, and due to different headers and flags it might happen that
2344
2303
    mutex_t has a different size in this module and in InnoDB
2358
2317
    goto mem_free_and_error;
2359
2318
  }
2360
2319
 
2361
 
  innobase_old_blocks_pct = buf_LRU_old_ratio_update(innobase_old_blocks_pct,
 
2320
 
 
2321
  innobase_old_blocks_pct = buf_LRU_old_ratio_update(innobase_old_blocks_pct.get(),
2362
2322
                                                     TRUE);
2363
2323
 
2364
2324
  innobase_open_tables = hash_create(200);
2420
2380
  context.add(innodb_sys_foreign_cols_tool);
2421
2381
 
2422
2382
  context.add(new(std::nothrow)InnodbInternalTables());
 
2383
  context.add(new(std::nothrow)InnodbReplicationTable());
 
2384
 
 
2385
  if (innobase_use_replication_log)
 
2386
  {
 
2387
    replication_logger= new(std::nothrow)ReplicationLog();
 
2388
    context.add(replication_logger);
 
2389
    ReplicationLog::setup(replication_logger);
 
2390
  }
 
2391
 
2423
2392
  context.registerVariable(new sys_var_const_string_val("data-home-dir", innobase_data_home_dir));
2424
2393
  context.registerVariable(new sys_var_const_string_val("flush-method", 
2425
2394
                                                        vm.count("flush-method") ?  vm["flush-method"].as<string>() : ""));
2427
2396
  context.registerVariable(new sys_var_const_string_val("data-file-path", innobase_data_file_path));
2428
2397
  context.registerVariable(new sys_var_const_string_val("version", vm["version"].as<string>()));
2429
2398
 
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
 
 
2400
  context.registerVariable(new sys_var_bool_ptr_readonly("replication_log", &innobase_use_replication_log));
2445
2401
  context.registerVariable(new sys_var_bool_ptr_readonly("checksums", &innobase_use_checksums));
2446
2402
  context.registerVariable(new sys_var_bool_ptr_readonly("doublewrite", &innobase_use_doublewrite));
2447
2403
  context.registerVariable(new sys_var_bool_ptr("file-per-table", &srv_file_per_table));
2451
2407
  context.registerVariable(new sys_var_bool_ptr_readonly("use-sys-malloc", &srv_use_sys_malloc));
2452
2408
  context.registerVariable(new sys_var_bool_ptr_readonly("use-native-aio", &srv_use_native_aio));
2453
2409
 
2454
 
#ifdef UNIV_LOG_ARCHIVE
2455
 
 context.registerVariable(new sys_var_bool_ptr_readonly("log_archive", &innobase_log_archive));
2456
 
#endif /* UNIV_LOG_ARCHIVE */
2457
2410
  context.registerVariable(new sys_var_bool_ptr("support-xa", &support_xa));
2458
2411
  context.registerVariable(new sys_var_bool_ptr("strict_mode", &strict_mode));
2459
 
  context.registerVariable(new sys_var_constrained_value<uint32_t>("lock-wait-timeout", lock_wait_timeout));
2460
 
 
 
2412
  context.registerVariable(new sys_var_constrained_value<uint32_t>("lock_wait_timeout", lock_wait_timeout));
 
2413
 
 
2414
  context.registerVariable(new sys_var_constrained_value_readonly<size_t>("additional_mem_pool_size",innobase_additional_mem_pool_size));
 
2415
  context.registerVariable(new sys_var_constrained_value<uint32_t>("autoextend_increment",
 
2416
                                                                   innodb_auto_extend_increment,
 
2417
                                                                   auto_extend_update));
 
2418
  context.registerVariable(new sys_var_constrained_value<uint32_t>("io_capacity",
 
2419
                                                                   innodb_io_capacity,
 
2420
                                                                   io_capacity_update));
 
2421
  context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_batch_size",
 
2422
                                                                   innodb_purge_batch_size,
 
2423
                                                                   purge_batch_update));
 
2424
  context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_threads",
 
2425
                                                                   innodb_n_purge_threads,
 
2426
                                                                   purge_threads_update));
 
2427
  context.registerVariable(new sys_var_constrained_value<uint16_t>("fast_shutdown", innobase_fast_shutdown));
 
2428
  context.registerVariable(new sys_var_std_string("file_format",
 
2429
                                                  innobase_file_format_name,
 
2430
                                                  innodb_file_format_name_validate));
 
2431
  context.registerVariable(new sys_var_std_string("change_buffering",
 
2432
                                                  innobase_change_buffering,
 
2433
                                                  innodb_change_buffering_validate));
 
2434
  context.registerVariable(new sys_var_std_string("file_format_max",
 
2435
                                                  innobase_file_format_max,
 
2436
                                                  innodb_file_format_max_validate));
 
2437
  context.registerVariable(new sys_var_constrained_value_readonly<size_t>("buffer_pool_size", innobase_buffer_pool_size));
 
2438
  context.registerVariable(new sys_var_constrained_value_readonly<int64_t>("log_file_size", innobase_log_file_size));
 
2439
  context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("flush_log_at_trx_commit",
 
2440
                                                  innodb_flush_log_at_trx_commit));
 
2441
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct",
 
2442
                                                  innodb_max_dirty_pages_pct));
 
2443
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("max_purge_lag", innodb_max_purge_lag));
 
2444
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("stats_sample_pages", innodb_stats_sample_pages));
 
2445
  context.registerVariable(new sys_var_bool_ptr("adaptive_hash_index", &btr_search_enabled, innodb_adaptive_hash_index_update));
 
2446
 
 
2447
  context.registerVariable(new sys_var_constrained_value<uint32_t>("commit_concurrency",
 
2448
                                                                   innobase_commit_concurrency,
 
2449
                                                                   innodb_commit_concurrency_validate));
 
2450
  context.registerVariable(new sys_var_constrained_value<uint32_t>("concurrency_tickets",
 
2451
                                                                   innodb_concurrency_tickets));
 
2452
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("read_io_threads", innobase_read_io_threads));
 
2453
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("write_io_threads", innobase_write_io_threads));
 
2454
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("replication_delay", innodb_replication_delay));
 
2455
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("force_recovery", innobase_force_recovery));
 
2456
  context.registerVariable(new sys_var_constrained_value_readonly<size_t>("log_buffer_size", innobase_log_buffer_size));
 
2457
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("log_files_in_group", innobase_log_files_in_group));
 
2458
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("mirrored_log_groups", innobase_mirrored_log_groups));
 
2459
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("open_files", innobase_open_files));
 
2460
  context.registerVariable(new sys_var_constrained_value<uint32_t>("old_blocks_pct",
 
2461
                                                                   innobase_old_blocks_pct,
 
2462
                                                                   innodb_old_blocks_pct_update));
 
2463
  context.registerVariable(new sys_var_uint32_t_ptr("old_blocks_time", &buf_LRU_old_threshold_ms));
 
2464
  context.registerVariable(new sys_var_constrained_value<uint32_t>("sync_spin_loops", innodb_sync_spin_loops, innodb_sync_spin_loops_update));
 
2465
  context.registerVariable(new sys_var_constrained_value<uint32_t>("spin_wait_delay", innodb_spin_wait_delay, innodb_spin_wait_delay_update));
 
2466
  context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_sleep_delay", innodb_thread_sleep_delay, innodb_thread_sleep_delay_update));
 
2467
  context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_concurrency",
 
2468
                                                                   innobase_thread_concurrency,
 
2469
                                                                   innodb_thread_concurrency_update));
 
2470
  context.registerVariable(new sys_var_constrained_value<uint32_t>("read_ahead_threshold",
 
2471
                                                                   innodb_read_ahead_threshold,
 
2472
                                                                   innodb_read_ahead_threshold_update));
2461
2473
  /* Get the current high water mark format. */
2462
 
  innobase_file_format_max = (char*) trx_sys_file_format_max_get();
 
2474
  innobase_file_format_max = trx_sys_file_format_max_get();
2463
2475
  btr_search_fully_disabled = (!btr_search_enabled);
2464
2476
 
2465
2477
  return(FALSE);
2569
2581
    Note, the position is current because of
2570
2582
    prepare_commit_mutex */
2571
2583
retry:
2572
 
    if (innobase_commit_concurrency > 0) {
 
2584
    if (innobase_commit_concurrency.get() > 0) {
2573
2585
      pthread_mutex_lock(&commit_cond_m);
2574
2586
      commit_threads++;
2575
2587
 
2576
 
      if (commit_threads > innobase_commit_concurrency) {
 
2588
      if (commit_threads > innobase_commit_concurrency.get()) {
2577
2589
        commit_threads--;
2578
2590
        pthread_cond_wait(&commit_cond,
2579
2591
          &commit_cond_m);
2598
2610
    innobase_commit_low(trx);
2599
2611
    trx->flush_log_later = FALSE;
2600
2612
 
2601
 
    if (innobase_commit_concurrency > 0) {
 
2613
    if (innobase_commit_concurrency.get() > 0) {
2602
2614
      pthread_mutex_lock(&commit_cond_m);
2603
2615
      commit_threads--;
2604
2616
      pthread_cond_signal(&commit_cond);
3286
3298
    err = row_search_max_autoinc(index, col_name, &read_auto_inc);
3287
3299
 
3288
3300
    switch (err) {
3289
 
    case DB_SUCCESS:
 
3301
    case DB_SUCCESS: {
 
3302
      uint64_t col_max_value;
 
3303
 
 
3304
      col_max_value = innobase_get_int_col_max_value(field);
 
3305
 
3290
3306
      /* At the this stage we do not know the increment
3291
 
         or the offset, so use a default increment of 1. */
3292
 
      auto_inc = read_auto_inc + 1;
 
3307
         nor the offset, so use a default increment of 1. */
 
3308
 
 
3309
      auto_inc = innobase_next_autoinc(read_auto_inc, 1, 1, col_max_value);
 
3310
 
3293
3311
      break;
3294
 
 
 
3312
    }
3295
3313
    case DB_RECORD_NOT_FOUND:
3296
3314
      ut_print_timestamp(stderr);
3297
3315
      fprintf(stderr, "  InnoDB: MySQL and InnoDB data "
3564
3582
    /* We update the highest file format in the system table
3565
3583
    space, if this table has higher file format setting. */
3566
3584
 
3567
 
    trx_sys_file_format_max_upgrade(
3568
 
      (const char**) &innobase_file_format_max,
 
3585
    char changed_file_format_max[100];
 
3586
    strcpy(changed_file_format_max, innobase_file_format_max.c_str());
 
3587
    trx_sys_file_format_max_upgrade((const char **)&changed_file_format_max,
3569
3588
      dict_table_get_format(prebuilt->table));
 
3589
    innobase_file_format_max= changed_file_format_max;
3570
3590
  }
3571
3591
 
3572
 
  info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
3573
 
 
3574
3592
  /* Only if the table has an AUTOINC column. */
3575
3593
  if (prebuilt->table != NULL && getTable()->found_next_number_field != NULL) {
3576
3594
 
3588
3606
    dict_table_autoinc_unlock(prebuilt->table);
3589
3607
  }
3590
3608
 
 
3609
  info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
 
3610
 
3591
3611
  return(0);
3592
3612
}
3593
3613
 
3835
3855
  case DRIZZLE_TYPE_DATETIME:
3836
3856
  case DRIZZLE_TYPE_DATE:
3837
3857
  case DRIZZLE_TYPE_TIMESTAMP:
 
3858
  case DRIZZLE_TYPE_ENUM:
3838
3859
    return(DATA_INT);
3839
3860
  case DRIZZLE_TYPE_DOUBLE:
3840
3861
    return(DATA_DOUBLE);
3841
3862
  case DRIZZLE_TYPE_BLOB:
3842
3863
    return(DATA_BLOB);
3843
 
  default:
 
3864
  case DRIZZLE_TYPE_UUID:
 
3865
    return(DATA_FIXBINARY);
 
3866
  case DRIZZLE_TYPE_NULL:
3844
3867
    ut_error;
3845
3868
  }
3846
3869
 
6339
6362
    /* We update the highest file format in the system table
6340
6363
      space, if this table has higher file format setting. */
6341
6364
 
6342
 
    trx_sys_file_format_max_upgrade((const char**) &innobase_file_format_max,
6343
 
                                    dict_table_get_format(innobase_table));
 
6365
    char changed_file_format_max[100];
 
6366
    strcpy(changed_file_format_max, innobase_file_format_max.c_str());
 
6367
    trx_sys_file_format_max_upgrade((const char **)&changed_file_format_max,
 
6368
      dict_table_get_format(innobase_table));
 
6369
    innobase_file_format_max= changed_file_format_max;
6344
6370
  }
6345
6371
 
6346
6372
  /* Note: We can't call update_session() as prebuilt will not be
7106
7132
  dict_index_t* index;
7107
7133
  ha_rows   rec_per_key;
7108
7134
  ib_int64_t  n_rows;
7109
 
  ulong   j;
7110
 
  ulong   i;
7111
7135
  os_file_stat_t  stat_info;
7112
7136
 
7113
7137
  /* If we are forcing recovery at a high level, we will suppress
7114
7138
  statistics calculation on tables, because that may crash the
7115
7139
  server if an index is badly corrupted. */
7116
7140
 
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
 
 
7127
7141
  /* We do not know if MySQL can call this function before calling
7128
7142
  external_lock(). To be safe, update the session of the current table
7129
7143
  handle. */
7215
7229
    acquiring latches inside InnoDB, we do not call it if we
7216
7230
    are asked by MySQL to avoid locking. Another reason to
7217
7231
    avoid the call is that it uses quite a lot of CPU.
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
 
 
 
7232
    See Bug#38185. */
 
7233
    if (flag & HA_STATUS_NO_LOCK) {
 
7234
      /* We do not update delete_length if no
 
7235
         locking is requested so the "old" value can
 
7236
         remain. delete_length is initialized to 0 in
 
7237
         the ha_statistics' constructor. */
 
7238
    } else if (UNIV_UNLIKELY
 
7239
               (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE)) {
 
7240
      /* Avoid accessing the tablespace if
 
7241
         innodb_crash_recovery is set to a high value. */
 
7242
      stats.delete_length = 0;
 
7243
    } else {
7224
7244
      /* lock the data dictionary to avoid races with
7225
7245
      ibd_file_missing and tablespace_discarded */
7226
7246
      row_mysql_lock_data_dictionary(prebuilt->trx);
7266
7286
  }
7267
7287
 
7268
7288
  if (flag & HA_STATUS_CONST) {
 
7289
    ulong i;
7269
7290
    /* Verify the number of index in InnoDB and MySQL
7270
7291
       matches up. If prebuilt->clust_index_was_generated
7271
7292
       holds, InnoDB defines GEN_CLUST_INDEX internally */
7281
7302
    }
7282
7303
 
7283
7304
    for (i = 0; i < getTable()->getShare()->sizeKeys(); i++) {
 
7305
      ulong j;
7284
7306
      /* We could get index quickly through internal
7285
7307
         index mapping with the index translation table.
7286
7308
         The identity of index (match up index name with
7346
7368
    }
7347
7369
  }
7348
7370
 
 
7371
  if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
 
7372
    goto func_exit;
 
7373
  }
 
7374
 
7349
7375
  if (flag & HA_STATUS_ERRKEY) {
7350
7376
    const dict_index_t* err_index;
7351
7377
 
7367
7393
    stats.auto_increment_value = innobase_peek_autoinc();
7368
7394
  }
7369
7395
 
 
7396
func_exit:
7370
7397
  prebuilt->trx->op_info = (char*)"";
7371
7398
 
7372
7399
  return(0);
8067
8094
{
8068
8095
  trx_t*      trx;
8069
8096
  static const char truncated_msg[] = "... truncated...\n";
8070
 
  const long    MAX_STATUS_SIZE = 64000;
 
8097
  const long    MAX_STATUS_SIZE = 1048576;
8071
8098
  ulint     trx_list_start = ULINT_UNDEFINED;
8072
8099
  ulint     trx_list_end = ULINT_UNDEFINED;
8073
8100
 
8096
8123
 
8097
8124
  if (flen > MAX_STATUS_SIZE) {
8098
8125
    usable_len = MAX_STATUS_SIZE;
 
8126
    srv_truncated_status_writes++;
8099
8127
  } else {
8100
8128
    usable_len = flen;
8101
8129
  }
8131
8159
 
8132
8160
  mutex_exit(&srv_monitor_file_mutex);
8133
8161
 
8134
 
  bool result = FALSE;
 
8162
  stat_print(session, innobase_engine_name, strlen(innobase_engine_name),
 
8163
             STRING_WITH_LEN(""), str, flen);
8135
8164
 
8136
 
  if (stat_print(session, innobase_engine_name, strlen(innobase_engine_name),
8137
 
      STRING_WITH_LEN(""), str, flen)) {
8138
 
    result= TRUE;
8139
 
  }
8140
8165
  free(str);
8141
8166
 
8142
8167
  return(FALSE);
8485
8510
        && (sql_command == SQLCOM_INSERT_SELECT
8486
8511
            || sql_command == SQLCOM_REPLACE_SELECT
8487
8512
            || sql_command == SQLCOM_UPDATE
8488
 
            || sql_command == SQLCOM_CREATE_TABLE)) {
 
8513
            || sql_command == SQLCOM_CREATE_TABLE
 
8514
            || sql_command == SQLCOM_SET_OPTION)) {
8489
8515
 
8490
8516
      /* If we either have innobase_locks_unsafe_for_binlog
8491
8517
      option set or this session is using READ COMMITTED
8493
8519
      is not set to serializable and MySQL is doing
8494
8520
      INSERT INTO...SELECT or REPLACE INTO...SELECT
8495
8521
      or UPDATE ... = (SELECT ...) or CREATE  ...
8496
 
      SELECT... without FOR UPDATE or IN SHARE
8497
 
      MODE in select, then we use consistent read
8498
 
      for select. */
 
8522
      SELECT... or SET ... = (SELECT ...) without
 
8523
      FOR UPDATE or IN SHARE MODE in select,
 
8524
      then we use consistent read for select. */
8499
8525
 
8500
8526
      prebuilt->select_lock_type = LOCK_NONE;
8501
8527
      prebuilt->stored_select_lock_type = LOCK_NONE;
8583
8609
}
8584
8610
 
8585
8611
/*******************************************************************//**
8586
 
This function reads the global auto-inc counter. It doesn't use the 
 
8612
This function reads the global auto-inc counter. It doesn't use the
8587
8613
AUTOINC lock even if the lock mode is set to TRADITIONAL.
8588
8614
@return the autoinc value */
8589
8615
UNIV_INTERN
8603
8629
 
8604
8630
  auto_inc = dict_table_autoinc_read(innodb_table);
8605
8631
 
8606
 
  ut_a(auto_inc > 0);
 
8632
  if (auto_inc == 0) {
 
8633
    ut_print_timestamp(stderr);
 
8634
    fprintf(stderr, "  InnoDB: AUTOINC next value generation "
 
8635
            "is disabled for '%s'\n", innodb_table->name);
 
8636
  }
8607
8637
 
8608
8638
  dict_table_autoinc_unlock(innodb_table);
8609
8639
 
9176
9206
  }
9177
9207
}
9178
9208
 
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);
 
9209
 
9671
9210
 
9672
9211
static void init_options(drizzled::module::option_context &context)
9673
9212
{
9679
9218
  context("disable-doublewrite",
9680
9219
          "Disable InnoDB doublewrite buffer.");
9681
9220
  context("io-capacity",
9682
 
          po::value<unsigned long>(&srv_io_capacity)->default_value(200),
 
9221
          po::value<io_capacity_constraint>(&innodb_io_capacity)->default_value(200),
9683
9222
          "Number of IOPs the server can do. Tunes the background IO rate");
9684
9223
  context("fast-shutdown",
9685
 
          po::value<unsigned long>(&innobase_fast_shutdown)->default_value(1), 
 
9224
          po::value<trinary_constraint>(&innobase_fast_shutdown)->default_value(1), 
9686
9225
          "Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).");
9687
9226
  context("purge-batch-size",
9688
 
          po::value<unsigned long>(&srv_purge_batch_size)->default_value(20),
 
9227
          po::value<purge_batch_constraint>(&innodb_purge_batch_size)->default_value(20),
9689
9228
          "Number of UNDO logs to purge in one batch from the history list. "
9690
9229
          "Default is 20.");
9691
9230
  context("purge-threads",
9692
 
          po::value<unsigned long>(&srv_n_purge_threads)->default_value(0),
 
9231
          po::value<purge_threads_constraint>(&innodb_n_purge_threads)->default_value(0),
9693
9232
          "Purge threads can be either 0 or 1. Defalut is 0.");
9694
9233
  context("file-per-table",
9695
9234
          po::value<bool>(&srv_file_per_table)->default_value(false)->zero_tokens(),
9696
9235
          "Stores each InnoDB table to an .ibd file in the database dir.");
9697
9236
  context("file-format",
9698
 
          po::value<string>()->default_value("Antelope"),
 
9237
          po::value<string>(&innobase_file_format_name)->default_value("Antelope"),
9699
9238
          "File format to use for new tables in .ibd files.");
9700
9239
  context("file-format-max",
9701
 
          po::value<string>()->default_value("Antelope"),
 
9240
          po::value<string>(&innobase_file_format_max)->default_value("Antelope"),
9702
9241
          "The highest file format in the tablespace.");
9703
9242
  context("file-format-check",
9704
9243
          po::value<bool>(&innobase_file_format_check)->default_value(true)->zero_tokens(),
9705
9244
          "Whether to perform system file format check.");
9706
9245
  context("flush-log-at-trx-commit",
9707
 
          po::value<unsigned long>(&srv_flush_log_at_trx_commit)->default_value(1),
 
9246
          po::value<trinary_constraint>(&innodb_flush_log_at_trx_commit)->default_value(1),
9708
9247
          "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).");
9709
9248
  context("flush-method",
9710
9249
          po::value<string>(),
9711
9250
          "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 */
9720
9251
  context("log-group-home-dir",
9721
9252
          po::value<string>(),
9722
9253
          "Path to InnoDB log files.");
9723
9254
  context("max-dirty-pages-pct",
9724
 
          po::value<unsigned long>(&srv_max_buf_pool_modified_pct)->default_value(75),
 
9255
          po::value<max_dirty_pages_constraint>(&innodb_max_dirty_pages_pct)->default_value(75),
9725
9256
          "Percentage of dirty pages allowed in bufferpool.");
9726
9257
  context("disable-adaptive-flushing",
9727
9258
          "Do not attempt flushing dirty pages to avoid IO bursts at checkpoints.");
9728
9259
  context("max-purge-lag",
9729
 
          po::value<unsigned long>(&srv_max_purge_lag)->default_value(0),
 
9260
          po::value<uint64_constraint>(&innodb_max_purge_lag)->default_value(0),
9730
9261
          "Desired maximum length of the purge queue (0 = no limit)");
9731
9262
  context("status-file",
9732
9263
          po::value<bool>(&innobase_create_status_file)->default_value(false)->zero_tokens(),
9734
9265
  context("disable-stats-on-metadata",
9735
9266
          "Disable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)");
9736
9267
  context("stats-sample-pages",
9737
 
          po::value<uint64_t>(&srv_stats_sample_pages)->default_value(8),
 
9268
          po::value<uint64_nonzero_constraint>(&innodb_stats_sample_pages)->default_value(8),
9738
9269
          "The number of index pages to sample when calculating statistics (default 8)");
9739
9270
  context("disable-adaptive-hash-index",
9740
9271
          "Enable InnoDB adaptive hash index (enabled by default)");
9741
9272
  context("replication-delay",
9742
 
          po::value<unsigned long>(&srv_replication_delay)->default_value(0),
 
9273
          po::value<uint64_constraint>(&innodb_replication_delay)->default_value(0),
9743
9274
          "Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)");
9744
9275
  context("additional-mem-pool-size",
9745
 
          po::value<long>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
 
9276
          po::value<additional_mem_pool_constraint>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9746
9277
          "Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.");
9747
9278
  context("autoextend-increment",
9748
 
          po::value<uint32_t>(&srv_auto_extend_increment)->default_value(8L),
 
9279
          po::value<autoextend_constraint>(&innodb_auto_extend_increment)->default_value(8L),
9749
9280
          "Data file autoextend increment in megabytes");
9750
9281
  context("buffer-pool-size",
9751
 
          po::value<int64_t>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
 
9282
          po::value<buffer_pool_constraint>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9752
9283
          "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.");
9753
9284
  context("buffer-pool-instances",
9754
 
          po::value<int64_t>(&innobase_buffer_pool_instances)->default_value(1),
 
9285
          po::value<buffer_pool_instances_constraint>(&innobase_buffer_pool_instances)->default_value(1),
9755
9286
          "Number of buffer pool instances, set to higher value on high-end machines to increase scalability");
9756
9287
 
9757
9288
  context("commit-concurrency",
9758
 
          po::value<unsigned long>(&innobase_commit_concurrency)->default_value(0),
 
9289
          po::value<concurrency_constraint>(&innobase_commit_concurrency)->default_value(0),
9759
9290
          "Helps in performance tuning in heavily concurrent environments.");
9760
9291
  context("concurrency-tickets",
9761
 
          po::value<unsigned long>(&srv_n_free_tickets_to_enter)->default_value(500L),
 
9292
          po::value<uint32_nonzero_constraint>(&innodb_concurrency_tickets)->default_value(500L),
9762
9293
          "Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket");
9763
9294
  context("read-io-threads",
9764
 
          po::value<unsigned long>(&innobase_read_io_threads)->default_value(4),
 
9295
          po::value<io_threads_constraint>(&innobase_read_io_threads)->default_value(4),
9765
9296
          "Number of background read I/O threads in InnoDB.");
9766
9297
  context("write-io-threads",
9767
 
          po::value<unsigned long>(&innobase_write_io_threads)->default_value(4),
 
9298
          po::value<io_threads_constraint>(&innobase_write_io_threads)->default_value(4),
9768
9299
          "Number of background write I/O threads in InnoDB.");
9769
9300
  context("force-recovery",
9770
 
          po::value<long>(&innobase_force_recovery)->default_value(0),
 
9301
          po::value<force_recovery_constraint>(&innobase_force_recovery)->default_value(0),
9771
9302
          "Helps to save your data in case the disk image of the database becomes corrupt.");
9772
9303
  context("log-buffer-size",
9773
 
          po::value<long>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
 
9304
          po::value<log_buffer_constraint>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
9774
9305
          "The size of the buffer which InnoDB uses to write log to the log files on disk.");
9775
9306
  context("log-file-size",
9776
 
          po::value<int64_t>(&innobase_log_file_size)->default_value(20*1024*1024L),
 
9307
          po::value<log_file_constraint>(&innobase_log_file_size)->default_value(20*1024*1024L),
9777
9308
          "The size of the buffer which InnoDB uses to write log to the log files on disk.");
9778
9309
  context("log-files-in-group",
9779
 
          po::value<long>(&innobase_log_files_in_group)->default_value(2),
 
9310
          po::value<log_files_in_group_constraint>(&innobase_log_files_in_group)->default_value(2),
9780
9311
          "Number of log files in the log group. InnoDB writes to the files in a circular fashion.");
9781
9312
  context("mirrored-log-groups",
9782
 
          po::value<long>(&innobase_mirrored_log_groups)->default_value(1),
 
9313
          po::value<mirrored_log_groups_constraint>(&innobase_mirrored_log_groups)->default_value(1),
9783
9314
          "Number of identical copies of log groups we keep for the database. Currently this should be set to 1.");
9784
9315
  context("open-files",
9785
 
          po::value<long>(&innobase_open_files)->default_value(300L),
 
9316
          po::value<open_files_constraint>(&innobase_open_files)->default_value(300L),
9786
9317
          "How many files at the maximum InnoDB keeps open at the same time.");
9787
9318
  context("sync-spin-loops",
9788
 
          po::value<unsigned long>(&srv_n_spin_wait_rounds)->default_value(30L),
 
9319
          po::value<uint32_constraint>(&innodb_sync_spin_loops)->default_value(30L),
9789
9320
          "Count of spin-loop rounds in InnoDB mutexes (30 by default)");
9790
9321
  context("spin-wait-delay",
9791
 
          po::value<unsigned long>(&srv_spin_wait_delay)->default_value(6L),
 
9322
          po::value<uint32_constraint>(&innodb_spin_wait_delay)->default_value(6L),
9792
9323
          "Maximum delay between polling for a spin lock (6 by default)");
9793
9324
  context("thread-concurrency",
9794
 
          po::value<unsigned long>(&srv_thread_concurrency)->default_value(0),
 
9325
          po::value<concurrency_constraint>(&innobase_thread_concurrency)->default_value(0),
9795
9326
          "Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.");
9796
9327
  context("thread-sleep-delay",
9797
 
          po::value<unsigned long>(&srv_thread_sleep_delay)->default_value(10000L),
 
9328
          po::value<uint32_constraint>(&innodb_thread_sleep_delay)->default_value(10000L),
9798
9329
          "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep");
9799
9330
  context("data-file-path",
9800
9331
          po::value<string>(),
9805
9336
  context("use-internal-malloc",
9806
9337
          "Use InnoDB's internal memory allocator instal of the OS memory allocator.");
9807
9338
  context("change-buffering",
9808
 
          po::value<string>(),
 
9339
          po::value<string>(&innobase_change_buffering),
9809
9340
          "Buffer changes to reduce random access: OFF, ON, inserting, deleting, changing, or purging.");
9810
9341
  context("read-ahead-threshold",
9811
 
          po::value<unsigned long>(&srv_read_ahead_threshold)->default_value(56),
 
9342
          po::value<read_ahead_threshold_constraint>(&innodb_read_ahead_threshold)->default_value(56),
9812
9343
          "Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.");
9813
9344
  context("disable-xa",
9814
9345
          "Disable InnoDB support for the XA two-phase commit");
9818
9349
          po::value<bool>(&strict_mode)->default_value(false)->zero_tokens(),
9819
9350
          "Use strict mode when evaluating create options.");
9820
9351
  context("replication-log",
9821
 
          po::value<bool>()->default_value(false),
9822
 
          "Enable internal replication log.");
 
9352
          po::value<bool>(&innobase_use_replication_log)->default_value(false),
 
9353
          _("Enable internal replication log."));
9823
9354
  context("lock-wait-timeout",
9824
9355
          po::value<lock_wait_constraint>(&lock_wait_timeout)->default_value(50),
9825
 
          "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.");
 
9356
          _("Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout."));
 
9357
  context("old-blocks-pct",
 
9358
          po::value<old_blocks_constraint>(&innobase_old_blocks_pct)->default_value(100 * 3 / 8),
 
9359
          _("Percentage of the buffer pool to reserve for 'old' blocks."));
 
9360
  context("old-blocks-time",
 
9361
          po::value<uint32_t>(&buf_LRU_old_threshold_ms)->default_value(0),
 
9362
          _("ove blocks to the 'new' end of the buffer pool if the first access"
 
9363
            " was at least this many milliseconds ago."
 
9364
            " The timeout is disabled if 0 (the default)."));
9826
9365
}
9827
9366
 
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
 
};
 
9367
 
9868
9368
 
9869
9369
DRIZZLE_DECLARE_PLUGIN
9870
9370
{
9875
9375
  "Supports transactions, row-level locking, and foreign keys",
9876
9376
  PLUGIN_LICENSE_GPL,
9877
9377
  innobase_init, /* Plugin Init */
9878
 
  innobase_system_variables, /* system variables */
 
9378
  NULL, /* system variables */
9879
9379
  init_options /* reserved */
9880
9380
}
9881
9381
DRIZZLE_DECLARE_PLUGIN_END;
9903
9403
  return res;
9904
9404
}
9905
9405
 
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
 
 
9924
9406
/***********************************************************************
9925
9407
This function checks each index name for a table against reserved
9926
9408
system default primary index name 'GEN_CLUST_INDEX'. If a name matches,