~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2010-12-30 18:45:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2048.
  • Revision ID: mordred@inaugust.com-20101230184537-m5g5nu3w0u630npo
Removed unused no_error bool param.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
 
72
72
#include <boost/algorithm/string.hpp>
73
73
#include <boost/program_options.hpp>
 
74
#include <boost/scoped_array.hpp>
74
75
#include <boost/filesystem.hpp>
75
76
#include <drizzled/module/option_map.h>
76
77
#include <iostream>
82
83
/** @file ha_innodb.cc */
83
84
 
84
85
/* Include necessary InnoDB headers */
85
 
extern "C" {
86
86
#include "univ.i"
87
87
#include "buf0lru.h"
88
88
#include "btr0sea.h"
115
115
#include "ut0mem.h"
116
116
#include "ibuf0ibuf.h"
117
117
#include "mysql_addons.h"
118
 
}
119
118
 
120
119
#include "ha_innodb.h"
121
120
#include "data_dictionary.h"
803
802
DRIZZLE: Note, we didn't change this name to avoid more ifdef forking 
804
803
         in non-Cursor code.
805
804
@return true if session is the replication thread */
806
 
extern "C" UNIV_INTERN
 
805
UNIV_INTERN
807
806
ibool
808
807
thd_is_replication_slave_thread(
809
808
/*============================*/
877
876
DRIZZLE: Note, we didn't change this name to avoid more ifdef forking 
878
877
         in non-Cursor code.
879
878
@return true if non-transactional tables have been edited */
880
 
extern "C" UNIV_INTERN
 
879
UNIV_INTERN
881
880
ibool
882
881
thd_has_edited_nontrans_tables(
883
882
/*===========================*/
889
888
/******************************************************************//**
890
889
Returns true if the thread is executing a SELECT statement.
891
890
@return true if session is executing SELECT */
892
 
extern "C" UNIV_INTERN
 
891
UNIV_INTERN
893
892
ibool
894
893
thd_is_select(
895
894
/*==========*/
902
901
Returns true if the thread supports XA,
903
902
global value of innodb_supports_xa if session is NULL.
904
903
@return true if session has XA support */
905
 
extern "C" UNIV_INTERN
 
904
UNIV_INTERN
906
905
ibool
907
906
thd_supports_xa(
908
907
/*============*/
916
915
/******************************************************************//**
917
916
Returns the lock wait timeout for the current connection.
918
917
@return the lock wait timeout, in seconds */
919
 
extern "C" UNIV_INTERN
 
918
UNIV_INTERN
920
919
ulong
921
920
thd_lock_wait_timeout(
922
921
/*==================*/
931
930
 
932
931
/******************************************************************//**
933
932
Set the time waited for the lock for the current query. */
934
 
extern "C" UNIV_INTERN
 
933
UNIV_INTERN
935
934
void
936
935
thd_set_lock_wait_time(
937
936
/*===================*/
1023
1022
about a possible transaction rollback inside InnoDB caused by a lock wait
1024
1023
timeout or a deadlock.
1025
1024
@return MySQL error code */
1026
 
extern "C" UNIV_INTERN
 
1025
UNIV_INTERN
1027
1026
int
1028
1027
convert_error_code_to_mysql(
1029
1028
/*========================*/
1168
1167
 
1169
1168
/*************************************************************//**
1170
1169
Prints info of a Session object (== user session thread) to the given file. */
1171
 
extern "C" UNIV_INTERN
 
1170
UNIV_INTERN
1172
1171
void
1173
1172
innobase_mysql_print_thd(
1174
1173
/*=====================*/
1194
1193
 
1195
1194
/******************************************************************//**
1196
1195
Get the variable length bounds of the given character set. */
1197
 
extern "C" UNIV_INTERN
 
1196
UNIV_INTERN
1198
1197
void
1199
1198
innobase_get_cset_width(
1200
1199
/*====================*/
1221
1220
 
1222
1221
/******************************************************************//**
1223
1222
Converts an identifier to a table name. */
1224
 
extern "C" UNIV_INTERN
 
1223
UNIV_INTERN
1225
1224
void
1226
1225
innobase_convert_from_table_id(
1227
1226
/*===========================*/
1235
1234
 
1236
1235
/******************************************************************//**
1237
1236
Converts an identifier to UTF-8. */
1238
 
extern "C" UNIV_INTERN
 
1237
UNIV_INTERN
1239
1238
void
1240
1239
innobase_convert_from_id(
1241
1240
/*=====================*/
1250
1249
/******************************************************************//**
1251
1250
Compares NUL-terminated UTF-8 strings case insensitively.
1252
1251
@return 0 if a=b, <0 if a<b, >1 if a>b */
1253
 
extern "C" UNIV_INTERN
 
1252
UNIV_INTERN
1254
1253
int
1255
1254
innobase_strcasecmp(
1256
1255
/*================*/
1262
1261
 
1263
1262
/******************************************************************//**
1264
1263
Makes all characters in a NUL-terminated UTF-8 string lower case. */
1265
 
extern "C" UNIV_INTERN
 
1264
UNIV_INTERN
1266
1265
void
1267
1266
innobase_casedn_str(
1268
1267
/*================*/
1274
1273
/**********************************************************************//**
1275
1274
Determines the connection character set.
1276
1275
@return connection character set */
1277
 
extern "C" UNIV_INTERN
 
1276
UNIV_INTERN
1278
1277
const void*
1279
1278
innobase_get_charset(
1280
1279
/*=================*/
1283
1282
  return static_cast<Session*>(mysql_session)->charset();
1284
1283
}
1285
1284
 
1286
 
extern "C" UNIV_INTERN
 
1285
UNIV_INTERN
1287
1286
bool
1288
1287
innobase_isspace(
1289
1288
  const void *cs,
1303
1302
/**********************************************************************//**
1304
1303
Determines the current SQL statement.
1305
1304
@return        SQL statement string */
1306
 
extern "C" UNIV_INTERN
 
1305
UNIV_INTERN
1307
1306
const char*
1308
1307
innobase_get_stmt(
1309
1308
/*==============*/
1317
1316
/*******************************************************************//**
1318
1317
Map an OS error to an errno value. The OS error number is stored in
1319
1318
_doserrno and the mapped value is stored in errno) */
1320
 
extern "C"
1321
1319
void __cdecl
1322
1320
_dosmaperr(
1323
1321
  unsigned long); /*!< in: OS error value */
1325
1323
/*********************************************************************//**
1326
1324
Creates a temporary file.
1327
1325
@return temporary file descriptor, or < 0 on error */
1328
 
extern "C" UNIV_INTERN
 
1326
UNIV_INTERN
1329
1327
int
1330
1328
innobase_mysql_tmpfile(void)
1331
1329
/*========================*/
1405
1403
/*********************************************************************//**
1406
1404
Creates a temporary file.
1407
1405
@return temporary file descriptor, or < 0 on error */
1408
 
extern "C" UNIV_INTERN
 
1406
UNIV_INTERN
1409
1407
int
1410
1408
innobase_mysql_tmpfile(void)
1411
1409
/*========================*/
1444
1442
number of bytes that were written to "buf" is returned (including the
1445
1443
terminating NUL).
1446
1444
@return number of bytes that were written */
1447
 
extern "C" UNIV_INTERN
 
1445
UNIV_INTERN
1448
1446
ulint
1449
1447
innobase_raw_format(
1450
1448
/*================*/
1564
1562
/*********************************************************************//**
1565
1563
Allocates an InnoDB transaction for a MySQL Cursor object.
1566
1564
@return InnoDB transaction handle */
1567
 
extern "C" UNIV_INTERN
 
1565
UNIV_INTERN
1568
1566
trx_t*
1569
1567
innobase_trx_allocate(
1570
1568
/*==================*/
1673
1671
        FALSE=id is an UTF-8 string */
1674
1672
{
1675
1673
  char nz[NAME_LEN + 1];
1676
 
  char nz2[NAME_LEN + 1 + sizeof srv_mysql50_table_name_prefix];
 
1674
  const size_t nz2_size= NAME_LEN + 1 + srv_mysql50_table_name_prefix.size();
 
1675
  boost::scoped_array<char> nz2(new char[nz2_size]);
1677
1676
 
1678
1677
  const char* s = id;
1679
1678
  int   q;
1690
1689
    memcpy(nz, id, idlen);
1691
1690
    nz[idlen] = 0;
1692
1691
 
1693
 
    s = nz2;
1694
 
    idlen = TableIdentifier::filename_to_tablename(nz, nz2, sizeof nz2);
 
1692
    s = nz2.get();
 
1693
    idlen = TableIdentifier::filename_to_tablename(nz, nz2.get(), nz2_size);
1695
1694
  }
1696
1695
 
1697
1696
  /* See if the identifier needs to be quoted. */
1745
1744
Convert a table or index name to the MySQL system_charset_info (UTF-8)
1746
1745
and quote it if needed.
1747
1746
@return pointer to the end of buf */
1748
 
extern "C" UNIV_INTERN
 
1747
UNIV_INTERN
1749
1748
char*
1750
1749
innobase_convert_name(
1751
1750
/*==================*/
1801
1800
/**********************************************************************//**
1802
1801
Determines if the currently running transaction has been interrupted.
1803
1802
@return TRUE if interrupted */
1804
 
extern "C" UNIV_INTERN
 
1803
UNIV_INTERN
1805
1804
ibool
1806
1805
trx_is_interrupted(
1807
1806
/*===============*/
1813
1812
/**********************************************************************//**
1814
1813
Determines if the currently running transaction is in strict mode.
1815
1814
@return TRUE if strict */
1816
 
extern "C" UNIV_INTERN
 
1815
UNIV_INTERN
1817
1816
ibool
1818
1817
trx_is_strict(
1819
1818
/*==========*/
2077
2076
  innobase_use_doublewrite= (vm.count("disable-doublewrite")) ? false : true;
2078
2077
  srv_adaptive_flushing= (vm.count("disable-adaptive-flushing")) ? false : true;
2079
2078
  srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
 
2079
  srv_use_native_aio= (vm.count("disable-native-aio")) ? false : true;
2080
2080
  support_xa= (vm.count("disable-xa")) ? false : true;
2081
2081
  btr_search_enabled= (vm.count("disable-adaptive-hash-index")) ? false : true;
2082
2082
 
2104
2104
 
2105
2105
#ifdef UNIV_DEBUG
2106
2106
  static const char test_filename[] = "-@";
2107
 
  char      test_tablename[sizeof test_filename
2108
 
    + sizeof srv_mysql50_table_name_prefix];
2109
 
  if ((sizeof test_tablename) - 1
2110
 
      != filename_to_tablename(test_filename, test_tablename,
2111
 
                               sizeof test_tablename)
2112
 
      || strncmp(test_tablename,
2113
 
                 srv_mysql50_table_name_prefix,
2114
 
                 sizeof srv_mysql50_table_name_prefix)
2115
 
      || strcmp(test_tablename
2116
 
                + sizeof srv_mysql50_table_name_prefix,
 
2107
  const size_t test_tablename_size= sizeof test_filename
 
2108
    + srv_mysql50_table_name_prefix.size();
 
2109
  boost::scoped_array test_tablename(new char[test_tablename_size]);
 
2110
  if ((test_tablename_size) - 1
 
2111
      != filename_to_tablename(test_filename, test_tablename.get(),
 
2112
                               test_tablename_size)
 
2113
      || strncmp(test_tablename.get(),
 
2114
                 srv_mysql50_table_name_prefix.c_str(),
 
2115
                 srv_mysql50_table_name_prefix.size())
 
2116
      || strcmp(test_tablename.get()
 
2117
                + srv_mysql50_table_name_prefix.size(),
2117
2118
                test_filename)) {
2118
2119
    errmsg_printf(ERRMSG_LVL_ERROR, "tablename encoding has been changed");
2119
2120
    goto error;
3718
3719
of this function is in rem0cmp.c in InnoDB source code! If you change this
3719
3720
function, remember to update the prototype there!
3720
3721
@return 1, 0, -1, if a is greater, equal, less than b, respectively */
3721
 
extern "C" UNIV_INTERN
3722
 
int
 
3722
UNIV_INTERN int
3723
3723
innobase_mysql_cmp(
3724
3724
/*===============*/
3725
3725
  int   mysql_type, /*!< in: MySQL type */
3801
3801
the 'mtype' of InnoDB. InnoDB differentiates between MySQL's old <= 4.1
3802
3802
VARCHAR and the new true VARCHAR in >= 5.0.3 by the 'prtype'.
3803
3803
@return DATA_BINARY, DATA_VARCHAR, ... */
3804
 
extern "C" UNIV_INTERN
 
3804
UNIV_INTERN
3805
3805
ulint
3806
3806
get_innobase_type_from_mysql_type(
3807
3807
/*==============================*/
8896
8896
finds charset information and returns length of prefix_len characters in the
8897
8897
index field in bytes.
8898
8898
@return number of bytes occupied by the first n characters */
8899
 
extern "C" UNIV_INTERN
 
8899
UNIV_INTERN
8900
8900
ulint
8901
8901
innobase_get_at_most_n_mbchars(
8902
8902
/*===========================*/
9360
9360
          "InnoDB version");
9361
9361
  context("use-internal-malloc",
9362
9362
          "Use InnoDB's internal memory allocator instal of the OS memory allocator.");
 
9363
  context("disable-native-aio",
 
9364
          _("Do not use Native AIO library for IO, even if available"));
9363
9365
  context("change-buffering",
9364
9366
          po::value<string>(&innobase_change_buffering),
9365
9367
          "Buffer changes to reduce random access: OFF, ON, inserting, deleting, changing, or purging.");
9432
9434
This function checks each index name for a table against reserved
9433
9435
system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
9434
9436
this function pushes an warning message to the client, and returns true. */
9435
 
extern "C" UNIV_INTERN
 
9437
UNIV_INTERN
9436
9438
bool
9437
9439
innobase_index_name_is_reserved(
9438
9440
/*============================*/