summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorunknown <joerg@trift2.>2008-03-27 12:45:16 +0100
committerunknown <joerg@trift2.>2008-03-27 12:45:16 +0100
commit797a2d68f81bc931170d71d066d204c4071653b6 (patch)
treead0f3904109b50a452c4e481659cd1eec465d3e9 /storage
parent321f392f629479eedf63062f85283e911ce05d7e (diff)
parentdb9df4c725c5b9b8ed35a965fdd4a8b0a8278e0a (diff)
downloadmariadb-git-797a2d68f81bc931170d71d066d204c4071653b6.tar.gz
Merge trift2.:/MySQL/M51/mysql-5.1
into trift2.:/MySQL/M51/push-5.1 configure.in: Auto merged mysql-test/r/federated.result: Auto merged mysql-test/t/federated.test: Auto merged
Diffstat (limited to 'storage')
-rw-r--r--storage/archive/Makefile.am5
-rw-r--r--storage/blackhole/Makefile.am5
-rw-r--r--storage/example/Makefile.am5
-rw-r--r--storage/federated/Makefile.am5
-rw-r--r--storage/innobase/Makefile.am3
-rw-r--r--storage/innobase/dict/dict0dict.c6
-rw-r--r--storage/innobase/handler/ha_innodb.cc59
-rw-r--r--storage/innobase/handler/ha_innodb.h2
-rw-r--r--storage/innobase/include/dict0dict.h6
-rw-r--r--storage/innobase/include/dict0mem.h2
-rw-r--r--storage/innobase/include/row0sel.h2
-rw-r--r--storage/innobase/include/univ.i3
-rw-r--r--storage/innobase/row/row0sel.c10
-rw-r--r--storage/ndb/src/common/util/SocketServer.cpp2
14 files changed, 75 insertions, 40 deletions
diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am
index 4920527e0e9..d092f091798 100644
--- a/storage/archive/Makefile.am
+++ b/storage/archive/Makefile.am
@@ -19,6 +19,7 @@ MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(pkglibdir)
+pkgplugindir = $(pkglibdir)/plugin
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/sql \
@@ -33,8 +34,8 @@ noinst_HEADERS = ha_archive.h azlib.h
noinst_PROGRAMS = archive_test archive_reader
EXTRA_LTLIBRARIES = ha_archive.la
-pkglib_LTLIBRARIES = @plugin_archive_shared_target@
-ha_archive_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
+pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@
+ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_archive_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_archive_la_SOURCES = ha_archive.cc azio.c
diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am
index 9dd533dd4fa..db4f67cf847 100644
--- a/storage/blackhole/Makefile.am
+++ b/storage/blackhole/Makefile.am
@@ -19,6 +19,7 @@ MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(pkglibdir)
+pkgplugindir = $(pkglibdir)/plugin
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/sql \
@@ -32,8 +33,8 @@ DEFS = @DEFS@
noinst_HEADERS = ha_blackhole.h
EXTRA_LTLIBRARIES = ha_blackhole.la
-pkglib_LTLIBRARIES = @plugin_blackhole_shared_target@
-ha_blackhole_la_LDFLAGS=-module -rpath $(MYSQLLIBdir)
+pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@
+ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir)
ha_blackhole_la_CXXFLAGS=$(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_blackhole_la_SOURCES=ha_blackhole.cc
diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am
index 73016d24b57..4b2f165377c 100644
--- a/storage/example/Makefile.am
+++ b/storage/example/Makefile.am
@@ -19,6 +19,7 @@ MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(pkglibdir)
+pkgplugindir = $(pkglibdir)/plugin
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/sql \
@@ -32,8 +33,8 @@ DEFS = @DEFS@
noinst_HEADERS = ha_example.h
EXTRA_LTLIBRARIES = ha_example.la
-pkglib_LTLIBRARIES = @plugin_example_shared_target@
-ha_example_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
+pkgplugin_LTLIBRARIES = @plugin_example_shared_target@
+ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_example_la_SOURCES = ha_example.cc
diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am
index 287b2cb1696..64ea0207017 100644
--- a/storage/federated/Makefile.am
+++ b/storage/federated/Makefile.am
@@ -19,6 +19,7 @@ MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(pkglibdir)
+pkgplugindir = $(pkglibdir)/plugin
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/sql \
@@ -32,8 +33,8 @@ DEFS = @DEFS@
noinst_HEADERS = ha_federated.h
EXTRA_LTLIBRARIES = ha_federated.la
-pkglib_LTLIBRARIES = @plugin_federated_shared_target@
-ha_federated_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
+pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@
+ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_federated_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_federated_la_SOURCES = ha_federated.cc
diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am
index 30e056d68fb..563522cd032 100644
--- a/storage/innobase/Makefile.am
+++ b/storage/innobase/Makefile.am
@@ -19,6 +19,7 @@ MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
MYSQLLIBdir= $(pkglibdir)
+pkgplugindir = $(pkglibdir)/plugin
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/storage/innobase/include \
@@ -160,7 +161,7 @@ libinnobase_a_CFLAGS = $(AM_CFLAGS)
EXTRA_LTLIBRARIES = ha_innodb.la
pkglib_LTLIBRARIES = @plugin_innobase_shared_target@
-ha_innodb_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
+ha_innodb_la_LDFLAGS = -module -rpath $(pkgplugindir)
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_innodb_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES)
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 8aba5ac1c85..10cef688705 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -429,7 +429,7 @@ void
dict_table_autoinc_initialize(
/*==========================*/
dict_table_t* table, /* in: table */
- ib_longlong value) /* in: next value to assign to a row */
+ ib_ulonglong value) /* in: next value to assign to a row */
{
ut_ad(mutex_own(&table->autoinc_mutex));
@@ -441,7 +441,7 @@ dict_table_autoinc_initialize(
Reads the next autoinc value (== autoinc counter value), 0 if not yet
initialized. */
-ib_longlong
+ib_ulonglong
dict_table_autoinc_read(
/*====================*/
/* out: value for a new row, or 0 */
@@ -470,7 +470,7 @@ dict_table_autoinc_update(
/*======================*/
dict_table_t* table, /* in: table */
- ib_longlong value) /* in: value which was assigned to a row */
+ ib_ulonglong value) /* in: value which was assigned to a row */
{
if (table->autoinc_inited && value > table->autoinc) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index f81804c0701..a181ecf1612 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -3545,7 +3545,19 @@ no_commit:
if (auto_inc > prebuilt->last_value) {
set_max_autoinc:
ut_a(prebuilt->table->autoinc_increment > 0);
- auto_inc += prebuilt->table->autoinc_increment;
+
+ ulonglong have;
+ ulonglong need;
+
+ /* Check for overflow conditions. */
+ need = prebuilt->table->autoinc_increment;
+ have = ~0x0ULL - auto_inc;
+
+ if (have < need) {
+ need = have;
+ }
+
+ auto_inc += need;
err = innobase_set_max_autoinc(auto_inc);
@@ -5105,8 +5117,15 @@ ha_innobase::create(
DBUG_ASSERT(innobase_table != 0);
- if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
- (create_info->auto_increment_value != 0)) {
+ /* Note: We can't call update_thd() as prebuilt will not be
+ setup at this stage and so we use thd. */
+
+ /* We need to copy the AUTOINC value from the old table if
+ this is an ALTER TABLE. */
+
+ if (((create_info->used_fields & HA_CREATE_USED_AUTO)
+ || thd_sql_command(thd) == SQLCOM_ALTER_TABLE)
+ && create_info->auto_increment_value != 0) {
/* Query was ALTER TABLE...AUTO_INCREMENT = x; or
CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
@@ -5856,7 +5875,7 @@ ha_innobase::info(
}
if (flag & HA_STATUS_AUTO && table->found_next_number_field) {
- longlong auto_inc;
+ ulonglong auto_inc;
int ret;
/* The following function call can the first time fail in
@@ -7207,9 +7226,9 @@ ha_innobase::innobase_read_and_init_auto_inc(
/*=========================================*/
/* out: 0 or generic MySQL
error code */
- longlong* value) /* out: the autoinc value */
+ ulonglong* value) /* out: the autoinc value */
{
- longlong auto_inc;
+ ulonglong auto_inc;
ibool stmt_start;
int mysql_error = 0;
dict_table_t* innodb_table = prebuilt->table;
@@ -7260,7 +7279,9 @@ ha_innobase::innobase_read_and_init_auto_inc(
index, autoinc_col_name, &auto_inc);
if (error == DB_SUCCESS) {
- ++auto_inc;
+ if (auto_inc < ~0x0ULL) {
+ ++auto_inc;
+ }
dict_table_autoinc_initialize(innodb_table, auto_inc);
} else {
ut_print_timestamp(stderr);
@@ -7313,14 +7334,14 @@ ha_innobase::innobase_get_auto_increment(
error = innobase_autoinc_lock();
if (error == DB_SUCCESS) {
- ib_longlong autoinc;
+ ulonglong autoinc;
/* Determine the first value of the interval */
autoinc = dict_table_autoinc_read(prebuilt->table);
/* We need to initialize the AUTO-INC value, for
that we release all locks.*/
- if (autoinc <= 0) {
+ if (autoinc == 0) {
trx_t* trx;
trx = prebuilt->trx;
@@ -7339,14 +7360,11 @@ ha_innobase::innobase_get_auto_increment(
mysql_error = innobase_read_and_init_auto_inc(
&autoinc);
- if (!mysql_error) {
- /* Should have read the proper value */
- ut_a(autoinc > 0);
- } else {
+ if (mysql_error) {
error = DB_ERROR;
}
} else {
- *value = (ulonglong) autoinc;
+ *value = autoinc;
}
/* A deadlock error during normal processing is OK
and can be ignored. */
@@ -7431,10 +7449,19 @@ ha_innobase::get_auto_increment(
/* With old style AUTOINC locking we only update the table's
AUTOINC counter after attempting to insert the row. */
if (innobase_autoinc_lock_mode != AUTOINC_OLD_STYLE_LOCKING) {
+ ulonglong have;
+ ulonglong need;
+
+ /* Check for overflow conditions. */
+ need = *nb_reserved_values * increment;
+ have = ~0x0ULL - *first_value;
+
+ if (have < need) {
+ need = have;
+ }
/* Compute the last value in the interval */
- prebuilt->last_value = *first_value +
- (*nb_reserved_values * increment);
+ prebuilt->last_value = *first_value + need;
ut_a(prebuilt->last_value >= *first_value);
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 773884b6584..4ffcdb1e3c2 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -72,7 +72,7 @@ class ha_innobase: public handler
int update_thd(THD* thd);
int change_active_index(uint keynr);
int general_fetch(uchar* buf, uint direction, uint match_mode);
- int innobase_read_and_init_auto_inc(longlong* ret);
+ int innobase_read_and_init_auto_inc(ulonglong* ret);
ulong innobase_autoinc_lock();
ulong innobase_set_max_autoinc(ulonglong auto_inc);
ulong innobase_reset_autoinc(ulonglong auto_inc);
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 2f038b21e8e..f60775c8c2f 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -185,12 +185,12 @@ void
dict_table_autoinc_initialize(
/*==========================*/
dict_table_t* table, /* in: table */
- ib_longlong value); /* in: next value to assign to a row */
+ ib_ulonglong value); /* in: next value to assign to a row */
/************************************************************************
Reads the next autoinc value (== autoinc counter value), 0 if not yet
initialized. */
-ib_longlong
+ib_ulonglong
dict_table_autoinc_read(
/*====================*/
/* out: value for a new row, or 0 */
@@ -204,7 +204,7 @@ dict_table_autoinc_update(
/*======================*/
dict_table_t* table, /* in: table */
- ib_longlong value); /* in: value which was assigned to a row */
+ ib_ulonglong value); /* in: value which was assigned to a row */
/************************************************************************
Release the autoinc lock.*/
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index a05bc513efd..2fe72498989 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -409,7 +409,7 @@ struct dict_table_struct{
/* TRUE if the autoinc counter has been
inited; MySQL gets the init value by executing
SELECT MAX(auto inc column) */
- ib_longlong autoinc;/* autoinc counter value to give to the
+ ib_ulonglong autoinc;/* autoinc counter value to give to the
next inserted row */
ib_longlong autoinc_increment;
diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h
index 4bde648f18e..a0a4ccb973b 100644
--- a/storage/innobase/include/row0sel.h
+++ b/storage/innobase/include/row0sel.h
@@ -181,7 +181,7 @@ row_search_max_autoinc(
error code */
dict_index_t* index, /* in: index to search */
const char* col_name, /* in: autoinc column name */
- ib_longlong* value); /* out: AUTOINC value read */
+ ib_ulonglong* value); /* out: AUTOINC value read */
/* A structure for caching column values for prefetched rows */
struct sel_buf_struct{
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 8163ae16e4e..8ab62e655ff 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -212,8 +212,11 @@ typedef long int lint;
#ifdef __WIN__
typedef __int64 ib_longlong;
+typedef unsigned __int64 ib_ulonglong;
#else
+/* Note: longlong and ulonglong come from MySQL headers. */
typedef longlong ib_longlong;
+typedef ulonglong ib_ulonglong;
#endif
typedef unsigned long long int ullint;
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index 29bded114e0..b050838aad2 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -4529,7 +4529,7 @@ row_search_check_if_query_cache_permitted(
Read the AUTOINC column from the current row. If the value is less than
0 and the type is not unsigned then we reset the value to 0. */
static
-ib_longlong
+ib_ulonglong
row_search_autoinc_read_column(
/*===========================*/
/* out: value read from the column */
@@ -4540,7 +4540,7 @@ row_search_autoinc_read_column(
{
ulint len;
const byte* data;
- ib_longlong value;
+ ib_ulonglong value;
mem_heap_t* heap = NULL;
/* Our requirement is that dest should be word aligned. */
byte dest[sizeof(value)];
@@ -4567,7 +4567,7 @@ row_search_autoinc_read_column(
and that dest is word aligned. */
switch (len) {
case 8:
- value = *(ib_longlong*) dest;
+ value = *(ib_ulonglong*) dest;
break;
case 4:
@@ -4595,7 +4595,7 @@ row_search_autoinc_read_column(
mem_heap_free(heap);
}
- if (!unsigned_type && value < 0) {
+ if (!unsigned_type && (ib_longlong) value < 0) {
value = 0;
}
@@ -4634,7 +4634,7 @@ row_search_max_autoinc(
column name can't be found in index */
dict_index_t* index, /* in: index to search */
const char* col_name, /* in: name of autoinc column */
- ib_longlong* value) /* out: AUTOINC value read */
+ ib_ulonglong* value) /* out: AUTOINC value read */
{
ulint i;
ulint n_cols;
diff --git a/storage/ndb/src/common/util/SocketServer.cpp b/storage/ndb/src/common/util/SocketServer.cpp
index 51d48ec54f2..47bf562f7d1 100644
--- a/storage/ndb/src/common/util/SocketServer.cpp
+++ b/storage/ndb/src/common/util/SocketServer.cpp
@@ -112,7 +112,7 @@ SocketServer::setup(SocketServer::Service * service,
const int on = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(const char*)&on, sizeof(on)) == -1) {
- DBUG_PRINT("error",("getsockopt() - %d - %s",
+ DBUG_PRINT("error",("setsockopt() - %d - %s",
errno, strerror(errno)));
NDB_CLOSE_SOCKET(sock);
DBUG_RETURN(false);