summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-10-24 14:53:18 +0200
committerSergei Golubchik <serg@mariadb.org>2017-10-24 14:53:18 +0200
commite0a1c745ec3ed1ec6c0375a2a624697c29f480a6 (patch)
tree24ded2c6ebe3ea3413ce56af89ea0f2f63bb3a39 /storage
parent4ec88ea9c3ec52d996b39167d12a61ab95fdeacc (diff)
parent2aa51f528fd5d23cc54eca8fbd07e88e7b2993c7 (diff)
downloadmariadb-git-e0a1c745ec3ed1ec6c0375a2a624697c29f480a6.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/CMakeLists.txt39
-rw-r--r--storage/connect/fmdlex.c16
-rw-r--r--storage/connect/jsonudf.cpp2
-rw-r--r--storage/connect/plugutil.cpp2
-rw-r--r--storage/connect/rcmsg.c7
-rw-r--r--storage/connect/rcmsg.h2
-rw-r--r--storage/connect/tabmul.cpp4
-rw-r--r--storage/connect/value.cpp2
-rw-r--r--storage/federatedx/federatedx_io_mysql.cc9
-rw-r--r--storage/innobase/dict/dict0dict.cc22
-rw-r--r--storage/innobase/fts/fts0fts.cc49
-rw-r--r--storage/innobase/fts/fts0que.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/handler/handler0alter.cc58
-rw-r--r--storage/innobase/handler/i_s.cc54
-rw-r--r--storage/innobase/include/data0type.ic2
-rw-r--r--storage/innobase/include/dict0dict.ic7
-rw-r--r--storage/innobase/include/dict0mem.h5
-rw-r--r--storage/innobase/include/fts0fts.h17
-rw-r--r--storage/innobase/row/row0mysql.cc33
-rw-r--r--storage/innobase/row/row0sel.cc1
-rw-r--r--storage/maria/ma_extra.c3
-rw-r--r--storage/maria/ma_loghandler.c2
-rw-r--r--storage/maria/ma_recovery.c2
-rw-r--r--storage/mroonga/CMakeLists.txt1
-rw-r--r--storage/mroonga/vendor/groonga/CMakeLists.txt3
-rw-r--r--storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp1
-rw-r--r--storage/mroonga/vendor/groonga/lib/tokenizers.c2
-rw-r--r--storage/myisam/mi_extra.c2
-rw-r--r--storage/oqgraph/graphcore.cc14
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/general-Aria.result99
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result99
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/general-innodb.result99
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_1196036.result6
-rw-r--r--storage/oqgraph/mysql-test/oqgraph/regression_1213120.result71
-rw-r--r--storage/oqgraph/oqgraph_shim.h6
-rw-r--r--storage/sphinx/ha_sphinx.cc12
-rw-r--r--storage/tokudb/CMakeLists.txt1
-rw-r--r--storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt1
-rwxr-xr-xstorage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure92
-rw-r--r--storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac57
-rw-r--r--storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m46
-rw-r--r--storage/xtradb/dict/dict0dict.cc55
-rw-r--r--storage/xtradb/fts/fts0fts.cc74
-rw-r--r--storage/xtradb/fts/fts0que.cc7
-rw-r--r--storage/xtradb/handler/ha_innodb.cc6
-rw-r--r--storage/xtradb/handler/handler0alter.cc101
-rw-r--r--storage/xtradb/handler/i_s.cc27
-rw-r--r--storage/xtradb/include/data0type.ic2
-rw-r--r--storage/xtradb/include/dict0dict.h11
-rw-r--r--storage/xtradb/include/fts0fts.h17
-rw-r--r--storage/xtradb/include/row0merge.h7
-rw-r--r--storage/xtradb/row/row0merge.cc26
-rw-r--r--storage/xtradb/row/row0mysql.cc33
-rw-r--r--storage/xtradb/row/row0sel.cc1
55 files changed, 463 insertions, 822 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index dc1f61d0d26..46710fd64e6 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -45,34 +45,17 @@ add_definitions( -DNEW_MAR -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
# OS specific C flags, definitions and source files.
#
IF(UNIX)
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
- # Bar: -Wfatal-errors removed (does not present in gcc on solaris10)
- if(WITH_WARNINGS)
- add_definitions(-Wall -Wextra -Wmissing-declarations)
- #message(STATUS "CONNECT: GCC: All warnings enabled")
- else()
- add_definitions(-Wall -Wmissing-declarations)
- add_definitions(-Wno-write-strings)
- add_definitions(-Wno-unused-variable)
- # Bar: -Wno-unused-but-set-variables commented (does not present on sol10)
- # add_definitions(-Wno-unused-but-set-variable)
- add_definitions(-Wno-unused-value)
- add_definitions(-Wno-unused-function)
- add_definitions(-Wno-parentheses)
- #add_definitions(-Wno-missing-declarations)
- # Bar: -Wno-int-to-pointer-cast commended (does not present in gcc on sol10)
- # add_definitions(-Wno-int-to-pointer-cast)
- # Bar: -Wno-narrowing commented (does not present in gcc on solaris10)
- # add_definitions(-Wno-narrowing)
-
-# This switch is for pure C only:
-# add_definitions(-Wno-implicit-function-declaration)
-# These switches are for C++ only
-# add_definitions(-Wno-reorder)
-
- #message(STATUS "CONNECT: GCC: Some warnings disabled")
- endif(WITH_WARNINGS)
- endif()
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wall -Wmissing-declarations")
+ if(NOT WITH_WARNINGS)
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-function")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-variable")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-value")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-parentheses")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-misleading-indentation")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-format-truncation")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
+ endif(NOT WITH_WARNINGS)
add_definitions( -DUNIX -DLINUX -DUBUNTU )
diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c
index 4bf075acf42..729b1b883c1 100644
--- a/storage/connect/fmdlex.c
+++ b/storage/connect/fmdlex.c
@@ -417,10 +417,10 @@ static PDTP pp;
static void MakeParm(int n);
static void MakeMMDD(int n);
static void MakeAMPM(int n);
-static void MakeIn(char *);
-static void MakeOut(char *);
-static void Quotin(char *);
-static void Quotout(char *);
+static void MakeIn(const char *);
+static void MakeOut(const char *);
+static void Quotin(const char *);
+static void Quotout(const char *);
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -1492,7 +1492,7 @@ void MakeAMPM(int n)
} /* end of MakeAMPM */
-void MakeIn(char *text)
+void MakeIn(const char *text)
{
if (!pp->InFmt)
return;
@@ -1500,14 +1500,14 @@ void MakeIn(char *text)
strncat(pp->InFmt, text, (pp->Outsize - 1) - strlen(pp->InFmt));
} /* end of MakeIn */
-void MakeOut(char *text)
+void MakeOut(const char *text)
{
if (!pp->OutFmt) return;
strncat(pp->OutFmt, text, (pp->Outsize - 1) - strlen(pp->OutFmt));
} /* end of MakeOut */
-void Quotin(char *text)
+void Quotin(const char *text)
{
if (!pp->InFmt)
return;
@@ -1516,7 +1516,7 @@ void Quotin(char *text)
pp->InFmt[strlen(pp->InFmt)-1] = '\0';
} /* end of Quotin */
-void Quotout(char *text)
+void Quotout(const char *text)
{
if (!pp->OutFmt)
return;
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index a7052188a5d..5c8896d1bc9 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -1512,7 +1512,7 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
if (!(g->Sarea = PlugAllocMem(g, ml))) {
char errmsg[MAX_STR];
- sprintf(errmsg, MSG(WORK_AREA), g->Message);
+ snprintf(errmsg, sizeof(errmsg)-1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
g->Sarea_Size = 0;
return true;
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index dbf90fb5599..0367aacd050 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -162,7 +162,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
/*******************************************************************/
if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) {
char errmsg[MAX_STR];
- sprintf(errmsg, MSG(WORK_AREA), g->Message);
+ snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
g->Sarea_Size = 0;
} else
diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c
index 75759e03314..895f8f5862b 100644
--- a/storage/connect/rcmsg.c
+++ b/storage/connect/rcmsg.c
@@ -27,9 +27,9 @@
char *msglang(void);
-char *GetMsgid(int id)
+const char *GetMsgid(int id)
{
- char *p = NULL;
+ const char *p = NULL;
// This conditional until a real fix is found for MDEV-7304
#if defined(FRENCH)
@@ -55,7 +55,8 @@ char *GetMsgid(int id)
int GetRcString(int id, char *buf, int bufsize)
{
- char *p = NULL, msg[32];
+ const char *p = NULL;
+ char msg[32];
if (!(p = GetMsgid(id))) {
sprintf(msg, "ID=%d unknown", id);
diff --git a/storage/connect/rcmsg.h b/storage/connect/rcmsg.h
index b22e77f5175..499ca3b2dd4 100644
--- a/storage/connect/rcmsg.h
+++ b/storage/connect/rcmsg.h
@@ -5,7 +5,7 @@
extern "C" {
#endif
-char *GetMsgid(int id);
+const char *GetMsgid(int id);
int GetRcString(int id, char *buf, int bufsize);
#ifdef __cplusplus
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index 5c41f9094ac..0967afca6cd 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -203,12 +203,12 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
// Data files can be imported from Windows (having CRLF)
if (*p == '\n' || *p == '\r') {
// is this enough for Unix ???
- *p--; // Eliminate ending CR or LF character
+ p--; // Eliminate ending CR or LF character
if (p >= filename)
// is this enough for Unix ???
if (*p == '\n' || *p == '\r')
- *p--; // Eliminate ending CR or LF character
+ p--; // Eliminate ending CR or LF character
} // endif p
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index eae72984ca6..372ee2541ac 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -1374,7 +1374,7 @@ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n)
} else if (cp != Strp) {
const char *p = cp + n - 1;
- for (p; p >= cp; p--, n--)
+ for (; p >= cp; p--, n--)
if (*p && *p != ' ')
break;
diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc
index 54059c0ecff..2068716eeba 100644
--- a/storage/federatedx/federatedx_io_mysql.cc
+++ b/storage/federatedx/federatedx_io_mysql.cc
@@ -265,9 +265,8 @@ ulong federatedx_io_mysql::savepoint_release(ulong sp)
savept= dynamic_element(&savepoints, savepoints.elements - 1, SAVEPT *);
if (savept->level < sp)
break;
- if ((savept->flags & (SAVEPOINT_REALIZED |
- SAVEPOINT_RESTRICT)) == SAVEPOINT_REALIZED)
- last= savept;
+ if ((savept->flags & (SAVEPOINT_REALIZED | SAVEPOINT_RESTRICT)) == SAVEPOINT_REALIZED)
+ last= savept;
savepoints.elements--;
}
@@ -293,8 +292,8 @@ ulong federatedx_io_mysql::savepoint_rollback(ulong sp)
while (savepoints.elements)
{
savept= dynamic_element(&savepoints, savepoints.elements - 1, SAVEPT *);
- if (savept->level <= sp)
- break;
+ if (savept->level <= sp)
+ break;
savepoints.elements--;
}
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index b95592d43d4..87334954cf8 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -501,15 +501,14 @@ dict_table_close(
ut_ad(mutex_own(&dict_sys->mutex));
ut_a(table->get_ref_count() > 0);
- table->release();
+ const bool last_handle = table->release();
/* Force persistent stats re-read upon next open of the table
so that FLUSH TABLE can be used to forcibly fetch stats from disk
if they have been manually modified. We reset table->stat_initialized
only if table reference count is 0 because we do not want too frequent
stats re-reads (e.g. in other cases than FLUSH TABLE). */
- if (strchr(table->name.m_name, '/') != NULL
- && table->get_ref_count() == 0
+ if (last_handle && strchr(table->name.m_name, '/') != NULL
&& dict_stats_is_persistent_enabled(table)) {
dict_stats_deinit(table);
@@ -529,11 +528,8 @@ dict_table_close(
if (!dict_locked) {
table_id_t table_id = table->id;
- ibool drop_aborted;
-
- drop_aborted = try_drop
+ const bool drop_aborted = last_handle && try_drop
&& table->drop_aborted
- && table->get_ref_count() == 1
&& dict_table_get_first_index(table);
mutex_exit(&dict_sys->mutex);
@@ -2067,8 +2063,9 @@ dict_table_remove_from_cache_low(
ut_ad(dict_lru_validate());
if (lru_evict && table->drop_aborted) {
- /* Do as dict_table_try_drop_aborted() does. */
-
+ /* When evicting the table definition,
+ drop the orphan indexes from the data dictionary
+ and free the index pages. */
trx_t* trx = trx_allocate_for_background();
ut_ad(mutex_own(&dict_sys->mutex));
@@ -2078,12 +2075,7 @@ dict_table_remove_from_cache_low(
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
-
- /* Silence a debug assertion in row_merge_drop_indexes(). */
- ut_d(table->acquire());
- row_merge_drop_indexes(trx, table, TRUE);
- ut_d(table->release());
- ut_ad(table->get_ref_count() == 0);
+ row_merge_drop_indexes_dict(trx, table->id);
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 09012ad4101..0b1218ed076 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -2629,8 +2629,9 @@ fts_get_next_doc_id(
return(DB_SUCCESS);
}
+ DEBUG_SYNC_C("get_next_FTS_DOC_ID");
mutex_enter(&cache->doc_id_lock);
- *doc_id = ++cache->next_doc_id;
+ *doc_id = cache->next_doc_id++;
mutex_exit(&cache->doc_id_lock);
return(DB_SUCCESS);
@@ -3013,52 +3014,6 @@ fts_modify(
}
/*********************************************************************//**
-Create a new document id.
-@return DB_SUCCESS if all went well else error */
-dberr_t
-fts_create_doc_id(
-/*==============*/
- dict_table_t* table, /*!< in: row is of this table. */
- dtuple_t* row, /* in/out: add doc id value to this
- row. This is the current row that is
- being inserted. */
- mem_heap_t* heap) /*!< in: heap */
-{
- doc_id_t doc_id;
- dberr_t error = DB_SUCCESS;
-
- ut_a(table->fts->doc_col != ULINT_UNDEFINED);
-
- if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) {
- if (table->fts->cache->first_doc_id == FTS_NULL_DOC_ID) {
- error = fts_get_next_doc_id(table, &doc_id);
- }
- return(error);
- }
-
- error = fts_get_next_doc_id(table, &doc_id);
-
- if (error == DB_SUCCESS) {
- dfield_t* dfield;
- doc_id_t* write_doc_id;
-
- ut_a(doc_id > 0);
-
- dfield = dtuple_get_nth_field(row, table->fts->doc_col);
- write_doc_id = static_cast<doc_id_t*>(
- mem_heap_alloc(heap, sizeof(*write_doc_id)));
-
- ut_a(doc_id != FTS_NULL_DOC_ID);
- ut_a(sizeof(doc_id) == dfield->type.len);
- fts_write_doc_id((byte*) write_doc_id, doc_id);
-
- dfield_set_data(dfield, write_doc_id, sizeof(*write_doc_id));
- }
-
- return(error);
-}
-
-/*********************************************************************//**
The given transaction is about to be committed; do whatever is necessary
from the FTS system's POV.
@return DB_SUCCESS or error code */
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 858d84f1a5e..84b1cbe32cb 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -3795,6 +3795,10 @@ fts_query_free(
fts_doc_ids_free(query->deleted);
}
+ if (query->intersection) {
+ fts_query_free_doc_ids(query, query->intersection);
+ }
+
if (query->doc_ids) {
fts_query_free_doc_ids(query, query->doc_ids);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 1463deb6e14..d7b68885aa6 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -19838,7 +19838,7 @@ buffer_pool_load_now(
const void* save) /*!< in: immediate result from
check function */
{
- if (*(my_bool*) save) {
+ if (*(my_bool*) save && !srv_read_only_mode) {
buf_load_start();
}
}
@@ -19861,7 +19861,7 @@ buffer_pool_load_abort(
const void* save) /*!< in: immediate result from
check function */
{
- if (*(my_bool*) save) {
+ if (*(my_bool*) save && !srv_read_only_mode) {
buf_load_abort();
}
}
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index f270a61e54e..3cbfbceb41e 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -416,34 +416,6 @@ innobase_need_rebuild(
return(false);
}
- /* If alter table changes column name and adds a new
- index, we need to check is this new index created
- to new column name. This is because column name
- changes are done normally after creating indexes. */
- if ((ha_alter_info->handler_flags
- & Alter_inplace_info::ALTER_COLUMN_NAME) &&
- ((ha_alter_info->handler_flags
- & Alter_inplace_info::ADD_INDEX) ||
- (ha_alter_info->handler_flags
- & Alter_inplace_info::ADD_FOREIGN_KEY))) {
- for (ulint i = 0; i < ha_alter_info->index_add_count; i++) {
- const KEY* key = &ha_alter_info->key_info_buffer[
- ha_alter_info->index_add_buffer[i]];
-
- for (ulint j = 0; j < key->user_defined_key_parts; j++) {
- const KEY_PART_INFO* key_part = &(key->key_part[j]);
- const Field* field = altered_table->field[key_part->fieldnr];
-
- /* Field used on added index is renamed on
- this same alter table. We need table
- rebuild. */
- if (field && field->flags & FIELD_IS_RENAMED) {
- return (true);
- }
- }
- }
- }
-
return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD));
}
@@ -2131,19 +2103,18 @@ name_ok:
}
/** Create index field definition for key part
-@param[in] altered_table MySQL table that is being altered,
- or NULL if a new clustered index
- is not being created
-@param[in] key_part MySQL key definition
-@param[in,out] index_field index field
-@param[in] new_clustered new cluster */
-static
+@param[in] new_clustered true if alter is generating a new clustered
+index
+@param[in] altered_table MySQL table that is being altered
+@param[in] key_part MySQL key definition
+@param[out] index_field index field defition for key_part */
+static MY_ATTRIBUTE((nonnull(2,3)))
void
innobase_create_index_field_def(
+ bool new_clustered,
const TABLE* altered_table,
const KEY_PART_INFO* key_part,
- index_field_t* index_field,
- bool new_clustered)
+ index_field_t* index_field)
{
const Field* field;
ibool is_unsigned;
@@ -2154,11 +2125,11 @@ innobase_create_index_field_def(
ut_ad(key_part);
ut_ad(index_field);
+ ut_ad(altered_table);
field = new_clustered
? altered_table->field[key_part->fieldnr]
: key_part->field;
- ut_a(field);
for (ulint i = 0; i < key_part->fieldnr; i++) {
if (innobase_is_v_fld(altered_table->field[i])) {
@@ -2219,9 +2190,10 @@ innobase_create_index_def(
DBUG_ENTER("innobase_create_index_def");
DBUG_ASSERT(!key_clustered || new_clustered);
+ ut_ad(altered_table);
+
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, n_fields * sizeof *index->fields));
- memset(index->fields, 0, n_fields * sizeof *index->fields);
index->parser = NULL;
index->key_number = key_number;
@@ -2299,8 +2271,8 @@ innobase_create_index_def(
if (!(key->flags & HA_SPATIAL)) {
for (i = 0; i < n_fields; i++) {
innobase_create_index_field_def(
- altered_table, &key->key_part[i],
- &index->fields[i], new_clustered);
+ new_clustered, altered_table,
+ &key->key_part[i], &index->fields[i]);
if (index->fields[i].is_v_col) {
index->ind_type |= DICT_VIRTUAL;
@@ -2713,7 +2685,6 @@ created_clustered:
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, sizeof *index->fields));
- memset(index->fields, 0, sizeof *index->fields);
index->n_fields = 1;
index->fields->col_no = fts_doc_id_col;
index->fields->prefix_len = 0;
@@ -4849,8 +4820,7 @@ new_clustered_failed:
}
ctx->add_index[a] = row_merge_create_index(
- ctx->trx, ctx->new_table,
- &index_defs[a], add_v);
+ ctx->trx, ctx->new_table, &index_defs[a], add_v);
add_key_nums[a] = index_defs[a].key_number;
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 8880d21aafb..19f3fbc4dd9 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -6424,6 +6424,7 @@ i_s_sys_tables_fill_table_stats(
}
heap = mem_heap_create(1000);
+ rw_lock_s_lock(dict_operation_lock);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
@@ -6466,9 +6467,11 @@ i_s_sys_tables_fill_table_stats(
err_msg);
}
+ rw_lock_s_unlock(dict_operation_lock);
mem_heap_empty(heap);
/* Get the next record */
+ rw_lock_s_lock(dict_operation_lock);
mutex_enter(&dict_sys->mutex);
if (table_rec != NULL) {
@@ -6481,6 +6484,7 @@ i_s_sys_tables_fill_table_stats(
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
+ rw_lock_s_unlock(dict_operation_lock);
mem_heap_free(heap);
DBUG_RETURN(0);
@@ -8045,20 +8049,17 @@ i_s_dict_fill_sys_tablespaces(
ulint flags, /*!< in: tablespace flags */
TABLE* table_to_fill) /*!< in/out: fill this table */
{
- Field** fields;
- ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags);
- bool is_compressed = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- const char* file_format;
- const char* row_format;
- const page_size_t page_size(flags);
- const char* space_type;
+ Field** fields;
+ ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags);
+ const char* file_format;
+ const char* row_format;
DBUG_ENTER("i_s_dict_fill_sys_tablespaces");
file_format = trx_sys_file_format_id_to_name(atomic_blobs);
if (is_system_tablespace(space)) {
- row_format = "Compact or Redundant";
- } else if (is_compressed) {
+ row_format = "Compact, Redundant or Dynamic";
+ } else if (FSP_FLAGS_GET_ZIP_SSIZE(flags)) {
row_format = "Compressed";
} else if (atomic_blobs) {
row_format = "Dynamic";
@@ -8066,12 +8067,6 @@ i_s_dict_fill_sys_tablespaces(
row_format = "Compact or Redundant";
}
- if (is_system_tablespace(space)) {
- space_type = "System";
- } else {
- space_type = "Single";
- }
-
fields = table_to_fill->field;
OK(fields[SYS_TABLESPACES_SPACE]->store(space, true));
@@ -8085,19 +8080,32 @@ i_s_dict_fill_sys_tablespaces(
OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT], row_format));
+ OK(field_store_string(fields[SYS_TABLESPACES_SPACE_TYPE],
+ is_system_tablespace(space)
+ ? "System" : "Single"));
+
+ ulint cflags = fsp_flags_is_valid(flags, space)
+ ? flags : fsp_flags_convert_from_101(flags);
+ if (cflags == ULINT_UNDEFINED) {
+ fields[SYS_TABLESPACES_PAGE_SIZE]->set_null();
+ fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->set_null();
+ fields[SYS_TABLESPACES_FS_BLOCK_SIZE]->set_null();
+ fields[SYS_TABLESPACES_FILE_SIZE]->set_null();
+ fields[SYS_TABLESPACES_ALLOC_SIZE]->set_null();
+ OK(schema_table_store_record(thd, table_to_fill));
+ DBUG_RETURN(0);
+ }
+
+ const page_size_t page_size(cflags);
+
OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store(
- univ_page_size.physical(), true));
+ page_size.logical(), true));
OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(
- page_size.is_compressed()
- ? page_size.physical()
- : 0, true));
-
- OK(field_store_string(fields[SYS_TABLESPACES_SPACE_TYPE],
- space_type));
+ page_size.physical(), true));
char* filepath = NULL;
- if (FSP_FLAGS_HAS_DATA_DIR(flags)) {
+ if (FSP_FLAGS_HAS_DATA_DIR(cflags)) {
mutex_enter(&dict_sys->mutex);
filepath = dict_get_first_path(space);
mutex_exit(&dict_sys->mutex);
diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic
index 3d2f46ed877..a68f4829561 100644
--- a/storage/innobase/include/data0type.ic
+++ b/storage/innobase/include/data0type.ic
@@ -527,7 +527,7 @@ dtype_get_fixed_size_low(
}
}
/* Treat as variable-length. */
- /* Fall through */
+ /* fall through */
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index 243a4541067..6810f0821bd 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -1560,14 +1560,15 @@ dict_table_t::acquire()
++n_ref_count;
}
-/** Release the table handle. */
+/** Release the table handle.
+@return whether the last handle was released */
inline
-void
+bool
dict_table_t::release()
{
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(n_ref_count > 0);
- --n_ref_count;
+ return !--n_ref_count;
}
/** Encode the number of columns and number of virtual columns in a
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index e4b682a41ad..227d4d9dc7e 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -1308,8 +1308,9 @@ struct dict_table_t {
/** Acquire the table handle. */
inline void acquire();
- /** Release the table handle. */
- inline void release();
+ /** Release the table handle.
+ @return whether the last handle was released */
+ inline bool release();
/** @return whether this is a temporary table */
bool is_temporary() const
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 30b8b66b83b..813e34b43d3 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
+Copyright (c) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -456,20 +456,6 @@ fts_update_next_doc_id(
doc_id_t doc_id); /*!< in: DOC ID to set */
/******************************************************************//**
-Create a new document id .
-@return DB_SUCCESS if all went well else error */
-dberr_t
-fts_create_doc_id(
-/*==============*/
- dict_table_t* table, /*!< in: row is of this
- table. */
- dtuple_t* row, /*!< in/out: add doc id
- value to this row. This is the
- current row that is being
- inserted. */
- mem_heap_t* heap); /*!< in: heap */
-
-/******************************************************************//**
Create a new fts_doc_ids_t.
@return new fts_doc_ids_t. */
fts_doc_ids_t*
@@ -1031,4 +1017,3 @@ fts_check_corrupt(
#endif /*!< fts0fts.h */
-
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 48eaa8c675e..eeea12aacee 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -715,11 +715,33 @@ next_column:
/* If there is a FTS doc id column and it is not user supplied (
generated by server) then assign it a new doc id. */
- if (prebuilt->table->fts) {
+ if (!prebuilt->table->fts) {
+ return;
+ }
+
+ ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED);
- ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED);
+ doc_id_t doc_id;
- fts_create_doc_id(prebuilt->table, row, prebuilt->heap);
+ if (!DICT_TF2_FLAG_IS_SET(prebuilt->table, DICT_TF2_FTS_HAS_DOC_ID)) {
+ if (prebuilt->table->fts->cache->first_doc_id
+ == FTS_NULL_DOC_ID) {
+ fts_get_next_doc_id(prebuilt->table, &doc_id);
+ }
+ return;
+ }
+
+ dfield_t* fts_doc_id = dtuple_get_nth_field(
+ row, prebuilt->table->fts->doc_col);
+
+ if (fts_get_next_doc_id(prebuilt->table, &doc_id) == DB_SUCCESS) {
+ ut_a(doc_id != FTS_NULL_DOC_ID);
+ ut_ad(sizeof(doc_id) == fts_doc_id->type.len);
+ dfield_set_data(fts_doc_id, prebuilt->ins_upd_rec_buff
+ + prebuilt->mysql_row_len, 8);
+ fts_write_doc_id(fts_doc_id->data, doc_id);
+ } else {
+ dfield_set_null(fts_doc_id);
}
}
@@ -1168,7 +1190,10 @@ row_get_prebuilt_insert_row(
prebuilt->ins_upd_rec_buff = static_cast<byte*>(
mem_heap_alloc(
prebuilt->heap,
- prebuilt->mysql_row_len));
+ DICT_TF2_FLAG_IS_SET(prebuilt->table,
+ DICT_TF2_FTS_HAS_DOC_ID)
+ ? prebuilt->mysql_row_len + 8/* FTS_DOC_ID */
+ : prebuilt->mysql_row_len));
}
dtuple_t* row;
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index f81b2e68159..d38538a4ac2 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -2933,6 +2933,7 @@ row_sel_field_store_in_mysql_format_func(
case DATA_SYS:
/* These column types should never be shipped to MySQL. */
ut_ad(0);
+ /* fall through */
case DATA_CHAR:
case DATA_FIXBINARY:
diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c
index 1db81a0ee1b..41261b1422e 100644
--- a/storage/maria/ma_extra.c
+++ b/storage/maria/ma_extra.c
@@ -314,7 +314,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
share->state.open_count= 1;
share->changed= 1;
_ma_mark_file_changed_now(share);
- /* Fall through */
+ /* fall through */
case HA_EXTRA_PREPARE_FOR_RENAME:
{
my_bool do_flush= MY_TEST(function != HA_EXTRA_PREPARE_FOR_DROP);
@@ -661,4 +661,3 @@ my_bool ma_killed_standalone(MARIA_HA *info __attribute__((unused)))
{
return 0;
}
-
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index ce254c5f631..bc30adad43a 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -2727,7 +2727,7 @@ static my_bool translog_recover_page_up_to_sector(uchar *page, uint16 offset)
DBUG_PRINT("enter", ("offset: %u first chunk: %u",
(uint) offset, (uint) chunk_offset));
- while (page[chunk_offset] != TRANSLOG_FILLER && chunk_offset < offset)
+ while (chunk_offset < offset && page[chunk_offset] != TRANSLOG_FILLER)
{
uint16 chunk_length;
if ((chunk_length=
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 256cb2b45b2..ad1df75f19e 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -3058,7 +3058,7 @@ static MARIA_HA *get_MARIA_HA_from_REDO_record(const
case LOGREC_REDO_INDEX:
case LOGREC_REDO_INDEX_FREE_PAGE:
index_page_redo_entry= 1;
- /* Fall through */
+ /* fall through*/
case LOGREC_REDO_INSERT_ROW_HEAD:
case LOGREC_REDO_INSERT_ROW_TAIL:
case LOGREC_REDO_PURGE_ROW_HEAD:
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index 39dad9ce16b..a9f9d7cc8b2 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -343,6 +343,7 @@ else()
MY_CHECK_AND_SET_COMPILER_FLAG("-fno-exceptions")
MY_CHECK_AND_SET_COMPILER_FLAG("-fno-rtti")
MY_CHECK_AND_SET_COMPILER_FLAG("-felide-constructors")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
endif()
set_source_files_properties(${MRN_SOURCES} PROPERTIES
COMPILE_FLAGS "${MYSQL_CFLAGS} ${MRN_CXX_COMPILE_FLAGS}")
diff --git a/storage/mroonga/vendor/groonga/CMakeLists.txt b/storage/mroonga/vendor/groonga/CMakeLists.txt
index 2d8a59fa664..6c448a4e606 100644
--- a/storage/mroonga/vendor/groonga/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/CMakeLists.txt
@@ -154,7 +154,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wformat=2")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wstrict-aliasing=2")
MY_CHECK_AND_SET_COMPILER_FLAG("-fno-strict-aliasing")
- MY_CHECK_AND_SET_COMPILER_FLAG("-Wdisabled-optimization")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-disabled-optimization")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wfloat-equal")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wpointer-arith")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wdeclaration-after-statement")
@@ -165,6 +165,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)
MY_CHECK_AND_SET_COMPILER_FLAG("-fexceptions")
MY_CHECK_AND_SET_COMPILER_FLAG("-fimplicit-templates")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-clobbered")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
endif()
if(NOT DEFINED CMAKE_C_COMPILE_OPTIONS_PIC)
diff --git a/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp b/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp
index 6dab51a2978..7276c148796 100644
--- a/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp
+++ b/storage/mroonga/vendor/groonga/lib/dat/cursor-factory.cpp
@@ -32,7 +32,6 @@ Cursor *CursorFactory::open(const Trie &trie,
UInt32 offset,
UInt32 limit,
UInt32 flags) {
- GRN_DAT_THROW_IF(PARAM_ERROR, &trie == NULL);
const UInt32 cursor_type = flags & CURSOR_TYPE_MASK;
switch (cursor_type) {
diff --git a/storage/mroonga/vendor/groonga/lib/tokenizers.c b/storage/mroonga/vendor/groonga/lib/tokenizers.c
index 28fd13c33c4..c5f112fa8cd 100644
--- a/storage/mroonga/vendor/groonga/lib/tokenizers.c
+++ b/storage/mroonga/vendor/groonga/lib/tokenizers.c
@@ -544,7 +544,7 @@ regexp_next(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
grn_obj *buffer = &(tokenizer->buffer);
const char *current = tokenizer->next;
const char *end = tokenizer->end;
- const const uint_least8_t *char_types = tokenizer->char_types;
+ const uint_least8_t *char_types = tokenizer->char_types;
grn_tokenize_mode mode = tokenizer->query->tokenize_mode;
grn_bool is_begin = tokenizer->is_begin;
grn_bool is_start_token = tokenizer->is_start_token;
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 1487592d2d6..39b28d95759 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -263,7 +263,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
//share->deleting= TRUE;
share->global_changed= FALSE; /* force writing changed flag */
_mi_mark_file_changed(info);
- /* Fall through */
+ /* fall through */
case HA_EXTRA_PREPARE_FOR_RENAME:
DBUG_ASSERT(!share->temporary);
mysql_mutex_lock(&THR_LOCK_myisam);
diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc
index fb2b105f2fd..bf454aa3333 100644
--- a/storage/oqgraph/graphcore.cc
+++ b/storage/oqgraph/graphcore.cc
@@ -891,18 +891,18 @@ namespace open_query
boost::unordered_map<Vertex, Vertex> p;
boost::unordered_map<Vertex, EdgeWeight> d;
boost::queue<Vertex> Q;
- reverse_graph<Graph> r(share->g);
+ const reverse_graph<Graph> r(share->g);
p[ *dest ]= *dest;
d[ *dest ] = EdgeWeight();
switch (ALGORITHM & op)
{
case DIJKSTRAS:
- dijkstra_shortest_paths_no_init(share->g, *dest,
+ dijkstra_shortest_paths_no_init(r, *dest,
make_lazy_property_map(p, identity_initializer<Vertex>()),
make_lazy_property_map(d, value_initializer<EdgeWeight>(
(std::numeric_limits<EdgeWeight>::max)())),
- get(edge_weight, share->g),
- get(vertex_index, share->g),
+ get(edge_weight, r),
+ get(vertex_index, r),
std::less<EdgeWeight>(),
closed_plus<EdgeWeight>(),
EdgeWeight(),
@@ -913,10 +913,10 @@ namespace open_query
static_cast<stack_cursor*>(cursor)
)
),
- make_two_bit_judy_map(get(vertex_index, share->g)));
+ make_two_bit_judy_map(get(vertex_index, r)));
break;
case BREADTH_FIRST:
- breadth_first_visit(share->g, *dest, Q,
+ breadth_first_visit(r, *dest, Q,
make_bfs_visitor(
std::make_pair(
record_predecessors(
@@ -935,7 +935,7 @@ namespace open_query
)
))
),
- make_two_bit_judy_map(get(vertex_index, share->g)));
+ make_two_bit_judy_map(get(vertex_index, r)));
break;
default:
abort();
diff --git a/storage/oqgraph/mysql-test/oqgraph/general-Aria.result b/storage/oqgraph/mysql-test/oqgraph/general-Aria.result
index a35b5182611..e527705045f 100644
--- a/storage/oqgraph/mysql-test/oqgraph/general-Aria.result
+++ b/storage/oqgraph/mysql-test/oqgraph/general-Aria.result
@@ -455,16 +455,16 @@ breadth_first NULL 4 1 2 3
breadth_first NULL 4 0 1 4
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
breadth_first NULL 5 0 1 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
breadth_first NULL 6 1 2 5
breadth_first NULL 6 0 1 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
+breadth_first NULL 7 1 2 5
breadth_first NULL 7 0 1 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8;
latch origid destid weight seq linkid
@@ -473,18 +473,18 @@ latch origid destid weight seq linkid
breadth_first NULL 9 0 1 9
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 2 3 11
+breadth_first NULL 10 1 2 12
breadth_first NULL 10 0 1 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 2 3 12
+breadth_first NULL 11 1 2 10
breadth_first NULL 11 0 1 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 2 3 10
+breadth_first NULL 12 1 2 11
breadth_first NULL 12 0 1 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -502,26 +502,26 @@ latch origid destid weight seq linkid
breadth_first NULL 4 1 2 3
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1;
latch origid destid weight seq linkid
breadth_first NULL 6 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1;
latch origid destid weight seq linkid
+breadth_first NULL 7 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 1 2 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 1 2 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 1 2 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2;
latch origid destid weight seq linkid
breadth_first NULL 1 2 4 4
@@ -538,22 +538,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
+breadth_first NULL 10 2 3 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
+breadth_first NULL 11 2 3 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
+breadth_first NULL 12 2 3 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3;
@@ -847,16 +847,16 @@ latch origid destid weight seq linkid
2 NULL 4 0 1 4
SELECT * FROM graph WHERE latch = '2' AND destid = 5;
latch origid destid weight seq linkid
-2 NULL 5 1 3 7
2 NULL 5 1 2 6
2 NULL 5 0 1 5
SELECT * FROM graph WHERE latch = '2' AND destid = 6;
latch origid destid weight seq linkid
-2 NULL 6 2 3 7
2 NULL 6 1 2 5
2 NULL 6 0 1 6
SELECT * FROM graph WHERE latch = '2' AND destid = 7;
latch origid destid weight seq linkid
+2 NULL 7 2 3 6
+2 NULL 7 1 2 5
2 NULL 7 0 1 7
SELECT * FROM graph WHERE latch = '2' AND destid = 8;
latch origid destid weight seq linkid
@@ -865,18 +865,18 @@ latch origid destid weight seq linkid
2 NULL 9 0 1 9
SELECT * FROM graph WHERE latch = '2' AND destid = 10;
latch origid destid weight seq linkid
-2 NULL 10 2 3 12
-2 NULL 10 1 2 11
+2 NULL 10 2 3 11
+2 NULL 10 1 2 12
2 NULL 10 0 1 10
SELECT * FROM graph WHERE latch = '2' AND destid = 11;
latch origid destid weight seq linkid
-2 NULL 11 2 3 10
-2 NULL 11 1 2 12
+2 NULL 11 2 3 12
+2 NULL 11 1 2 10
2 NULL 11 0 1 11
SELECT * FROM graph WHERE latch = '2' AND destid = 12;
latch origid destid weight seq linkid
-2 NULL 12 2 3 11
-2 NULL 12 1 2 10
+2 NULL 12 2 3 10
+2 NULL 12 1 2 11
2 NULL 12 0 1 12
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -894,26 +894,26 @@ latch origid destid weight seq linkid
2 NULL 4 1 2 3
SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 5 1 3 7
2 NULL 5 1 2 6
SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1;
latch origid destid weight seq linkid
2 NULL 6 1 2 5
SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1;
latch origid destid weight seq linkid
+2 NULL 7 1 2 5
SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 10 1 2 11
+2 NULL 10 1 2 12
SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 11 1 2 12
+2 NULL 11 1 2 10
SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 12 1 2 10
+2 NULL 12 1 2 11
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2;
latch origid destid weight seq linkid
2 NULL 1 2 4 4
@@ -930,22 +930,22 @@ SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 6 2 3 7
SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2;
latch origid destid weight seq linkid
+2 NULL 7 2 3 6
SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 10 2 3 12
+2 NULL 10 2 3 11
SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 11 2 3 10
+2 NULL 11 2 3 12
SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 12 2 3 11
+2 NULL 12 2 3 10
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3;
@@ -1124,16 +1124,16 @@ dijkstras NULL 4 1 2 3
dijkstras NULL 4 0 1 4
SELECT * FROM graph WHERE latch='dijkstras' AND destid=5;
latch origid destid weight seq linkid
-dijkstras NULL 5 1 3 7
dijkstras NULL 5 1 2 6
dijkstras NULL 5 0 1 5
SELECT * FROM graph WHERE latch='dijkstras' AND destid=6;
latch origid destid weight seq linkid
-dijkstras NULL 6 2 3 7
dijkstras NULL 6 1 2 5
dijkstras NULL 6 0 1 6
SELECT * FROM graph WHERE latch='dijkstras' AND destid=7;
latch origid destid weight seq linkid
+dijkstras NULL 7 2 3 6
+dijkstras NULL 7 1 2 5
dijkstras NULL 7 0 1 7
SELECT * FROM graph WHERE latch='dijkstras' AND destid=8;
latch origid destid weight seq linkid
@@ -1142,18 +1142,18 @@ latch origid destid weight seq linkid
dijkstras NULL 9 0 1 9
SELECT * FROM graph WHERE latch='dijkstras' AND destid=10;
latch origid destid weight seq linkid
-dijkstras NULL 10 2 3 12
-dijkstras NULL 10 1 2 11
+dijkstras NULL 10 2 3 11
+dijkstras NULL 10 1 2 12
dijkstras NULL 10 0 1 10
SELECT * FROM graph WHERE latch='dijkstras' AND destid=11;
latch origid destid weight seq linkid
-dijkstras NULL 11 2 3 10
-dijkstras NULL 11 1 2 12
+dijkstras NULL 11 2 3 12
+dijkstras NULL 11 1 2 10
dijkstras NULL 11 0 1 11
SELECT * FROM graph WHERE latch='dijkstras' AND destid=12;
latch origid destid weight seq linkid
-dijkstras NULL 12 2 3 11
-dijkstras NULL 12 1 2 10
+dijkstras NULL 12 2 3 10
+dijkstras NULL 12 1 2 11
dijkstras NULL 12 0 1 12
# legacy string number
SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1;
@@ -1299,16 +1299,16 @@ latch origid destid weight seq linkid
1 NULL 4 0 1 4
SELECT * FROM graph WHERE latch='1' AND destid=5;
latch origid destid weight seq linkid
-1 NULL 5 1 3 7
1 NULL 5 1 2 6
1 NULL 5 0 1 5
SELECT * FROM graph WHERE latch='1' AND destid=6;
latch origid destid weight seq linkid
-1 NULL 6 2 3 7
1 NULL 6 1 2 5
1 NULL 6 0 1 6
SELECT * FROM graph WHERE latch='1' AND destid=7;
latch origid destid weight seq linkid
+1 NULL 7 2 3 6
+1 NULL 7 1 2 5
1 NULL 7 0 1 7
SELECT * FROM graph WHERE latch='1' AND destid=8;
latch origid destid weight seq linkid
@@ -1317,18 +1317,18 @@ latch origid destid weight seq linkid
1 NULL 9 0 1 9
SELECT * FROM graph WHERE latch='1' AND destid=10;
latch origid destid weight seq linkid
-1 NULL 10 2 3 12
-1 NULL 10 1 2 11
+1 NULL 10 2 3 11
+1 NULL 10 1 2 12
1 NULL 10 0 1 10
SELECT * FROM graph WHERE latch='1' AND destid=11;
latch origid destid weight seq linkid
-1 NULL 11 2 3 10
-1 NULL 11 1 2 12
+1 NULL 11 2 3 12
+1 NULL 11 1 2 10
1 NULL 11 0 1 11
SELECT * FROM graph WHERE latch='1' AND destid=12;
latch origid destid weight seq linkid
-1 NULL 12 2 3 11
-1 NULL 12 1 2 10
+1 NULL 12 2 3 10
+1 NULL 12 1 2 11
1 NULL 12 0 1 12
INSERT INTO graph_base(from_id, to_id) VALUES (11,13);
INSERT INTO graph_base(from_id, to_id) VALUES (10,14);
@@ -1395,9 +1395,6 @@ dijkstras 1 NULL 1 2 2
dijkstras 1 NULL 0 1 1
SELECT * FROM graph WHERE latch='dijkstras' AND destid=1;
latch origid destid weight seq linkid
-dijkstras NULL 1 4 7 18
-dijkstras NULL 1 3 6 17
-dijkstras NULL 1 3 5 16
dijkstras NULL 1 2 4 4
dijkstras NULL 1 1 3 3
dijkstras NULL 1 1 2 2
diff --git a/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result
index f12e160a2b7..bbf660e7db4 100644
--- a/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result
+++ b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result
@@ -455,16 +455,16 @@ breadth_first NULL 4 1 2 3
breadth_first NULL 4 0 1 4
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
breadth_first NULL 5 0 1 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
breadth_first NULL 6 1 2 5
breadth_first NULL 6 0 1 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
+breadth_first NULL 7 1 2 5
breadth_first NULL 7 0 1 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8;
latch origid destid weight seq linkid
@@ -473,18 +473,18 @@ latch origid destid weight seq linkid
breadth_first NULL 9 0 1 9
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 2 3 11
+breadth_first NULL 10 1 2 12
breadth_first NULL 10 0 1 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 2 3 12
+breadth_first NULL 11 1 2 10
breadth_first NULL 11 0 1 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 2 3 10
+breadth_first NULL 12 1 2 11
breadth_first NULL 12 0 1 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -502,26 +502,26 @@ latch origid destid weight seq linkid
breadth_first NULL 4 1 2 3
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1;
latch origid destid weight seq linkid
breadth_first NULL 6 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1;
latch origid destid weight seq linkid
+breadth_first NULL 7 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 1 2 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 1 2 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 1 2 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2;
latch origid destid weight seq linkid
breadth_first NULL 1 2 4 4
@@ -538,22 +538,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
+breadth_first NULL 10 2 3 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
+breadth_first NULL 11 2 3 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
+breadth_first NULL 12 2 3 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3;
@@ -847,16 +847,16 @@ latch origid destid weight seq linkid
2 NULL 4 0 1 4
SELECT * FROM graph WHERE latch = '2' AND destid = 5;
latch origid destid weight seq linkid
-2 NULL 5 1 3 7
2 NULL 5 1 2 6
2 NULL 5 0 1 5
SELECT * FROM graph WHERE latch = '2' AND destid = 6;
latch origid destid weight seq linkid
-2 NULL 6 2 3 7
2 NULL 6 1 2 5
2 NULL 6 0 1 6
SELECT * FROM graph WHERE latch = '2' AND destid = 7;
latch origid destid weight seq linkid
+2 NULL 7 2 3 6
+2 NULL 7 1 2 5
2 NULL 7 0 1 7
SELECT * FROM graph WHERE latch = '2' AND destid = 8;
latch origid destid weight seq linkid
@@ -865,18 +865,18 @@ latch origid destid weight seq linkid
2 NULL 9 0 1 9
SELECT * FROM graph WHERE latch = '2' AND destid = 10;
latch origid destid weight seq linkid
-2 NULL 10 2 3 12
-2 NULL 10 1 2 11
+2 NULL 10 2 3 11
+2 NULL 10 1 2 12
2 NULL 10 0 1 10
SELECT * FROM graph WHERE latch = '2' AND destid = 11;
latch origid destid weight seq linkid
-2 NULL 11 2 3 10
-2 NULL 11 1 2 12
+2 NULL 11 2 3 12
+2 NULL 11 1 2 10
2 NULL 11 0 1 11
SELECT * FROM graph WHERE latch = '2' AND destid = 12;
latch origid destid weight seq linkid
-2 NULL 12 2 3 11
-2 NULL 12 1 2 10
+2 NULL 12 2 3 10
+2 NULL 12 1 2 11
2 NULL 12 0 1 12
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -894,26 +894,26 @@ latch origid destid weight seq linkid
2 NULL 4 1 2 3
SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 5 1 3 7
2 NULL 5 1 2 6
SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1;
latch origid destid weight seq linkid
2 NULL 6 1 2 5
SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1;
latch origid destid weight seq linkid
+2 NULL 7 1 2 5
SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 10 1 2 11
+2 NULL 10 1 2 12
SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 11 1 2 12
+2 NULL 11 1 2 10
SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 12 1 2 10
+2 NULL 12 1 2 11
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2;
latch origid destid weight seq linkid
2 NULL 1 2 4 4
@@ -930,22 +930,22 @@ SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 6 2 3 7
SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2;
latch origid destid weight seq linkid
+2 NULL 7 2 3 6
SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 10 2 3 12
+2 NULL 10 2 3 11
SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 11 2 3 10
+2 NULL 11 2 3 12
SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 12 2 3 11
+2 NULL 12 2 3 10
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3;
@@ -1124,16 +1124,16 @@ dijkstras NULL 4 1 2 3
dijkstras NULL 4 0 1 4
SELECT * FROM graph WHERE latch='dijkstras' AND destid=5;
latch origid destid weight seq linkid
-dijkstras NULL 5 1 3 7
dijkstras NULL 5 1 2 6
dijkstras NULL 5 0 1 5
SELECT * FROM graph WHERE latch='dijkstras' AND destid=6;
latch origid destid weight seq linkid
-dijkstras NULL 6 2 3 7
dijkstras NULL 6 1 2 5
dijkstras NULL 6 0 1 6
SELECT * FROM graph WHERE latch='dijkstras' AND destid=7;
latch origid destid weight seq linkid
+dijkstras NULL 7 2 3 6
+dijkstras NULL 7 1 2 5
dijkstras NULL 7 0 1 7
SELECT * FROM graph WHERE latch='dijkstras' AND destid=8;
latch origid destid weight seq linkid
@@ -1142,18 +1142,18 @@ latch origid destid weight seq linkid
dijkstras NULL 9 0 1 9
SELECT * FROM graph WHERE latch='dijkstras' AND destid=10;
latch origid destid weight seq linkid
-dijkstras NULL 10 2 3 12
-dijkstras NULL 10 1 2 11
+dijkstras NULL 10 2 3 11
+dijkstras NULL 10 1 2 12
dijkstras NULL 10 0 1 10
SELECT * FROM graph WHERE latch='dijkstras' AND destid=11;
latch origid destid weight seq linkid
-dijkstras NULL 11 2 3 10
-dijkstras NULL 11 1 2 12
+dijkstras NULL 11 2 3 12
+dijkstras NULL 11 1 2 10
dijkstras NULL 11 0 1 11
SELECT * FROM graph WHERE latch='dijkstras' AND destid=12;
latch origid destid weight seq linkid
-dijkstras NULL 12 2 3 11
-dijkstras NULL 12 1 2 10
+dijkstras NULL 12 2 3 10
+dijkstras NULL 12 1 2 11
dijkstras NULL 12 0 1 12
# legacy string number
SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1;
@@ -1299,16 +1299,16 @@ latch origid destid weight seq linkid
1 NULL 4 0 1 4
SELECT * FROM graph WHERE latch='1' AND destid=5;
latch origid destid weight seq linkid
-1 NULL 5 1 3 7
1 NULL 5 1 2 6
1 NULL 5 0 1 5
SELECT * FROM graph WHERE latch='1' AND destid=6;
latch origid destid weight seq linkid
-1 NULL 6 2 3 7
1 NULL 6 1 2 5
1 NULL 6 0 1 6
SELECT * FROM graph WHERE latch='1' AND destid=7;
latch origid destid weight seq linkid
+1 NULL 7 2 3 6
+1 NULL 7 1 2 5
1 NULL 7 0 1 7
SELECT * FROM graph WHERE latch='1' AND destid=8;
latch origid destid weight seq linkid
@@ -1317,18 +1317,18 @@ latch origid destid weight seq linkid
1 NULL 9 0 1 9
SELECT * FROM graph WHERE latch='1' AND destid=10;
latch origid destid weight seq linkid
-1 NULL 10 2 3 12
-1 NULL 10 1 2 11
+1 NULL 10 2 3 11
+1 NULL 10 1 2 12
1 NULL 10 0 1 10
SELECT * FROM graph WHERE latch='1' AND destid=11;
latch origid destid weight seq linkid
-1 NULL 11 2 3 10
-1 NULL 11 1 2 12
+1 NULL 11 2 3 12
+1 NULL 11 1 2 10
1 NULL 11 0 1 11
SELECT * FROM graph WHERE latch='1' AND destid=12;
latch origid destid weight seq linkid
-1 NULL 12 2 3 11
-1 NULL 12 1 2 10
+1 NULL 12 2 3 10
+1 NULL 12 1 2 11
1 NULL 12 0 1 12
INSERT INTO graph_base(from_id, to_id) VALUES (11,13);
INSERT INTO graph_base(from_id, to_id) VALUES (10,14);
@@ -1395,9 +1395,6 @@ dijkstras 1 NULL 1 2 2
dijkstras 1 NULL 0 1 1
SELECT * FROM graph WHERE latch='dijkstras' AND destid=1;
latch origid destid weight seq linkid
-dijkstras NULL 1 4 7 18
-dijkstras NULL 1 3 6 17
-dijkstras NULL 1 3 5 16
dijkstras NULL 1 2 4 4
dijkstras NULL 1 1 3 3
dijkstras NULL 1 1 2 2
diff --git a/storage/oqgraph/mysql-test/oqgraph/general-innodb.result b/storage/oqgraph/mysql-test/oqgraph/general-innodb.result
index b390dd38e34..927d856bc84 100644
--- a/storage/oqgraph/mysql-test/oqgraph/general-innodb.result
+++ b/storage/oqgraph/mysql-test/oqgraph/general-innodb.result
@@ -455,16 +455,16 @@ breadth_first NULL 4 1 2 3
breadth_first NULL 4 0 1 4
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
breadth_first NULL 5 0 1 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
breadth_first NULL 6 1 2 5
breadth_first NULL 6 0 1 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
+breadth_first NULL 7 1 2 5
breadth_first NULL 7 0 1 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8;
latch origid destid weight seq linkid
@@ -473,18 +473,18 @@ latch origid destid weight seq linkid
breadth_first NULL 9 0 1 9
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 2 3 11
+breadth_first NULL 10 1 2 12
breadth_first NULL 10 0 1 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 2 3 12
+breadth_first NULL 11 1 2 10
breadth_first NULL 11 0 1 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 2 3 10
+breadth_first NULL 12 1 2 11
breadth_first NULL 12 0 1 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -502,26 +502,26 @@ latch origid destid weight seq linkid
breadth_first NULL 4 1 2 3
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1;
latch origid destid weight seq linkid
breadth_first NULL 6 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1;
latch origid destid weight seq linkid
+breadth_first NULL 7 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 1 2 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 1 2 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 1 2 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2;
latch origid destid weight seq linkid
breadth_first NULL 1 2 4 4
@@ -538,22 +538,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
+breadth_first NULL 10 2 3 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
+breadth_first NULL 11 2 3 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
+breadth_first NULL 12 2 3 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3;
@@ -847,16 +847,16 @@ latch origid destid weight seq linkid
2 NULL 4 0 1 4
SELECT * FROM graph WHERE latch = '2' AND destid = 5;
latch origid destid weight seq linkid
-2 NULL 5 1 3 7
2 NULL 5 1 2 6
2 NULL 5 0 1 5
SELECT * FROM graph WHERE latch = '2' AND destid = 6;
latch origid destid weight seq linkid
-2 NULL 6 2 3 7
2 NULL 6 1 2 5
2 NULL 6 0 1 6
SELECT * FROM graph WHERE latch = '2' AND destid = 7;
latch origid destid weight seq linkid
+2 NULL 7 2 3 6
+2 NULL 7 1 2 5
2 NULL 7 0 1 7
SELECT * FROM graph WHERE latch = '2' AND destid = 8;
latch origid destid weight seq linkid
@@ -865,18 +865,18 @@ latch origid destid weight seq linkid
2 NULL 9 0 1 9
SELECT * FROM graph WHERE latch = '2' AND destid = 10;
latch origid destid weight seq linkid
-2 NULL 10 2 3 12
-2 NULL 10 1 2 11
+2 NULL 10 2 3 11
+2 NULL 10 1 2 12
2 NULL 10 0 1 10
SELECT * FROM graph WHERE latch = '2' AND destid = 11;
latch origid destid weight seq linkid
-2 NULL 11 2 3 10
-2 NULL 11 1 2 12
+2 NULL 11 2 3 12
+2 NULL 11 1 2 10
2 NULL 11 0 1 11
SELECT * FROM graph WHERE latch = '2' AND destid = 12;
latch origid destid weight seq linkid
-2 NULL 12 2 3 11
-2 NULL 12 1 2 10
+2 NULL 12 2 3 10
+2 NULL 12 1 2 11
2 NULL 12 0 1 12
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -894,26 +894,26 @@ latch origid destid weight seq linkid
2 NULL 4 1 2 3
SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 5 1 3 7
2 NULL 5 1 2 6
SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1;
latch origid destid weight seq linkid
2 NULL 6 1 2 5
SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1;
latch origid destid weight seq linkid
+2 NULL 7 1 2 5
SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 10 1 2 11
+2 NULL 10 1 2 12
SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 11 1 2 12
+2 NULL 11 1 2 10
SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1;
latch origid destid weight seq linkid
-2 NULL 12 1 2 10
+2 NULL 12 1 2 11
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2;
latch origid destid weight seq linkid
2 NULL 1 2 4 4
@@ -930,22 +930,22 @@ SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 6 2 3 7
SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2;
latch origid destid weight seq linkid
+2 NULL 7 2 3 6
SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 10 2 3 12
+2 NULL 10 2 3 11
SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 11 2 3 10
+2 NULL 11 2 3 12
SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2;
latch origid destid weight seq linkid
-2 NULL 12 2 3 11
+2 NULL 12 2 3 10
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3;
@@ -1124,16 +1124,16 @@ dijkstras NULL 4 1 2 3
dijkstras NULL 4 0 1 4
SELECT * FROM graph WHERE latch='dijkstras' AND destid=5;
latch origid destid weight seq linkid
-dijkstras NULL 5 1 3 7
dijkstras NULL 5 1 2 6
dijkstras NULL 5 0 1 5
SELECT * FROM graph WHERE latch='dijkstras' AND destid=6;
latch origid destid weight seq linkid
-dijkstras NULL 6 2 3 7
dijkstras NULL 6 1 2 5
dijkstras NULL 6 0 1 6
SELECT * FROM graph WHERE latch='dijkstras' AND destid=7;
latch origid destid weight seq linkid
+dijkstras NULL 7 2 3 6
+dijkstras NULL 7 1 2 5
dijkstras NULL 7 0 1 7
SELECT * FROM graph WHERE latch='dijkstras' AND destid=8;
latch origid destid weight seq linkid
@@ -1142,18 +1142,18 @@ latch origid destid weight seq linkid
dijkstras NULL 9 0 1 9
SELECT * FROM graph WHERE latch='dijkstras' AND destid=10;
latch origid destid weight seq linkid
-dijkstras NULL 10 2 3 12
-dijkstras NULL 10 1 2 11
+dijkstras NULL 10 2 3 11
+dijkstras NULL 10 1 2 12
dijkstras NULL 10 0 1 10
SELECT * FROM graph WHERE latch='dijkstras' AND destid=11;
latch origid destid weight seq linkid
-dijkstras NULL 11 2 3 10
-dijkstras NULL 11 1 2 12
+dijkstras NULL 11 2 3 12
+dijkstras NULL 11 1 2 10
dijkstras NULL 11 0 1 11
SELECT * FROM graph WHERE latch='dijkstras' AND destid=12;
latch origid destid weight seq linkid
-dijkstras NULL 12 2 3 11
-dijkstras NULL 12 1 2 10
+dijkstras NULL 12 2 3 10
+dijkstras NULL 12 1 2 11
dijkstras NULL 12 0 1 12
# legacy string number
SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1;
@@ -1299,16 +1299,16 @@ latch origid destid weight seq linkid
1 NULL 4 0 1 4
SELECT * FROM graph WHERE latch='1' AND destid=5;
latch origid destid weight seq linkid
-1 NULL 5 1 3 7
1 NULL 5 1 2 6
1 NULL 5 0 1 5
SELECT * FROM graph WHERE latch='1' AND destid=6;
latch origid destid weight seq linkid
-1 NULL 6 2 3 7
1 NULL 6 1 2 5
1 NULL 6 0 1 6
SELECT * FROM graph WHERE latch='1' AND destid=7;
latch origid destid weight seq linkid
+1 NULL 7 2 3 6
+1 NULL 7 1 2 5
1 NULL 7 0 1 7
SELECT * FROM graph WHERE latch='1' AND destid=8;
latch origid destid weight seq linkid
@@ -1317,18 +1317,18 @@ latch origid destid weight seq linkid
1 NULL 9 0 1 9
SELECT * FROM graph WHERE latch='1' AND destid=10;
latch origid destid weight seq linkid
-1 NULL 10 2 3 12
-1 NULL 10 1 2 11
+1 NULL 10 2 3 11
+1 NULL 10 1 2 12
1 NULL 10 0 1 10
SELECT * FROM graph WHERE latch='1' AND destid=11;
latch origid destid weight seq linkid
-1 NULL 11 2 3 10
-1 NULL 11 1 2 12
+1 NULL 11 2 3 12
+1 NULL 11 1 2 10
1 NULL 11 0 1 11
SELECT * FROM graph WHERE latch='1' AND destid=12;
latch origid destid weight seq linkid
-1 NULL 12 2 3 11
-1 NULL 12 1 2 10
+1 NULL 12 2 3 10
+1 NULL 12 1 2 11
1 NULL 12 0 1 12
INSERT INTO graph_base(from_id, to_id) VALUES (11,13);
INSERT INTO graph_base(from_id, to_id) VALUES (10,14);
@@ -1395,9 +1395,6 @@ dijkstras 1 NULL 1 2 2
dijkstras 1 NULL 0 1 1
SELECT * FROM graph WHERE latch='dijkstras' AND destid=1;
latch origid destid weight seq linkid
-dijkstras NULL 1 4 7 18
-dijkstras NULL 1 3 6 17
-dijkstras NULL 1 3 5 16
dijkstras NULL 1 2 4 4
dijkstras NULL 1 1 3 3
dijkstras NULL 1 1 2 2
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result
index 45bbccfa87e..c372a0c088f 100644
--- a/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result
@@ -41,19 +41,19 @@ dijkstras 3 NULL 256 2 2
dijkstras 3 NULL 0 1 3
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 1;
latch origid destid weight seq linkid
-dijkstras NULL 1 784 4 4
+dijkstras NULL 1 65808 4 4
dijkstras NULL 1 272 3 3
dijkstras NULL 1 16 2 2
dijkstras NULL 1 0 1 1
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 2;
latch origid destid weight seq linkid
-dijkstras NULL 2 768 4 4
+dijkstras NULL 2 65792 4 4
dijkstras NULL 2 256 3 3
dijkstras NULL 2 16 2 1
dijkstras NULL 2 0 1 2
SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 3;
latch origid destid weight seq linkid
-dijkstras NULL 3 1024 4 4
+dijkstras NULL 3 65536 4 4
dijkstras NULL 3 272 3 1
dijkstras NULL 3 256 2 2
dijkstras NULL 3 0 1 3
diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result
index b6cd53ab673..642c0aa3b5d 100644
--- a/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result
+++ b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result
@@ -464,16 +464,16 @@ breadth_first NULL 4 1 2 3
breadth_first NULL 4 0 1 4
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
breadth_first NULL 5 0 1 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
breadth_first NULL 6 1 2 5
breadth_first NULL 6 0 1 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
+breadth_first NULL 7 1 2 5
breadth_first NULL 7 0 1 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8;
latch origid destid weight seq linkid
@@ -482,18 +482,18 @@ latch origid destid weight seq linkid
breadth_first NULL 9 0 1 9
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 2 3 11
+breadth_first NULL 10 1 2 12
breadth_first NULL 10 0 1 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 2 3 12
+breadth_first NULL 11 1 2 10
breadth_first NULL 11 0 1 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 2 3 10
+breadth_first NULL 12 1 2 11
breadth_first NULL 12 0 1 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -511,26 +511,26 @@ latch origid destid weight seq linkid
breadth_first NULL 4 1 2 3
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 5 1 3 7
breadth_first NULL 5 1 2 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1;
latch origid destid weight seq linkid
breadth_first NULL 6 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1;
latch origid destid weight seq linkid
+breadth_first NULL 7 1 2 5
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 10 1 2 11
+breadth_first NULL 10 1 2 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 11 1 2 12
+breadth_first NULL 11 1 2 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1;
latch origid destid weight seq linkid
-breadth_first NULL 12 1 2 10
+breadth_first NULL 12 1 2 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2;
latch origid destid weight seq linkid
breadth_first NULL 1 2 4 4
@@ -547,22 +547,22 @@ SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 6 2 3 7
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2;
latch origid destid weight seq linkid
+breadth_first NULL 7 2 3 6
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 10 2 3 12
+breadth_first NULL 10 2 3 11
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 11 2 3 10
+breadth_first NULL 11 2 3 12
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2;
latch origid destid weight seq linkid
-breadth_first NULL 12 2 3 11
+breadth_first NULL 12 2 3 10
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3;
latch origid destid weight seq linkid
SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3;
@@ -838,8 +838,8 @@ latch origid destid weight seq linkid
2 NULL 1 0 1 1
SELECT * FROM graph WHERE latch = '2' AND destid = 12;
latch origid destid weight seq linkid
-2 NULL 12 2 3 11
-2 NULL 12 1 2 10
+2 NULL 12 2 3 10
+2 NULL 12 1 2 11
2 NULL 12 0 1 12
SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1;
latch origid destid weight seq linkid
@@ -997,16 +997,16 @@ dijkstras NULL 4 1 2 3
dijkstras NULL 4 0 1 4
SELECT * FROM graph WHERE latch='dijkstras' AND destid=5;
latch origid destid weight seq linkid
-dijkstras NULL 5 1 3 7
dijkstras NULL 5 1 2 6
dijkstras NULL 5 0 1 5
SELECT * FROM graph WHERE latch='dijkstras' AND destid=6;
latch origid destid weight seq linkid
-dijkstras NULL 6 2 3 7
dijkstras NULL 6 1 2 5
dijkstras NULL 6 0 1 6
SELECT * FROM graph WHERE latch='dijkstras' AND destid=7;
latch origid destid weight seq linkid
+dijkstras NULL 7 2 3 6
+dijkstras NULL 7 1 2 5
dijkstras NULL 7 0 1 7
SELECT * FROM graph WHERE latch='dijkstras' AND destid=8;
latch origid destid weight seq linkid
@@ -1015,18 +1015,18 @@ latch origid destid weight seq linkid
dijkstras NULL 9 0 1 9
SELECT * FROM graph WHERE latch='dijkstras' AND destid=10;
latch origid destid weight seq linkid
-dijkstras NULL 10 2 3 12
-dijkstras NULL 10 1 2 11
+dijkstras NULL 10 2 3 11
+dijkstras NULL 10 1 2 12
dijkstras NULL 10 0 1 10
SELECT * FROM graph WHERE latch='dijkstras' AND destid=11;
latch origid destid weight seq linkid
-dijkstras NULL 11 2 3 10
-dijkstras NULL 11 1 2 12
+dijkstras NULL 11 2 3 12
+dijkstras NULL 11 1 2 10
dijkstras NULL 11 0 1 11
SELECT * FROM graph WHERE latch='dijkstras' AND destid=12;
latch origid destid weight seq linkid
-dijkstras NULL 12 2 3 11
-dijkstras NULL 12 1 2 10
+dijkstras NULL 12 2 3 10
+dijkstras NULL 12 1 2 11
dijkstras NULL 12 0 1 12
# legacy string number
SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1;
@@ -1172,16 +1172,16 @@ latch origid destid weight seq linkid
1 NULL 4 0 1 4
SELECT * FROM graph WHERE latch='1' AND destid=5;
latch origid destid weight seq linkid
-1 NULL 5 1 3 7
1 NULL 5 1 2 6
1 NULL 5 0 1 5
SELECT * FROM graph WHERE latch='1' AND destid=6;
latch origid destid weight seq linkid
-1 NULL 6 2 3 7
1 NULL 6 1 2 5
1 NULL 6 0 1 6
SELECT * FROM graph WHERE latch='1' AND destid=7;
latch origid destid weight seq linkid
+1 NULL 7 2 3 6
+1 NULL 7 1 2 5
1 NULL 7 0 1 7
SELECT * FROM graph WHERE latch='1' AND destid=8;
latch origid destid weight seq linkid
@@ -1190,18 +1190,18 @@ latch origid destid weight seq linkid
1 NULL 9 0 1 9
SELECT * FROM graph WHERE latch='1' AND destid=10;
latch origid destid weight seq linkid
-1 NULL 10 2 3 12
-1 NULL 10 1 2 11
+1 NULL 10 2 3 11
+1 NULL 10 1 2 12
1 NULL 10 0 1 10
SELECT * FROM graph WHERE latch='1' AND destid=11;
latch origid destid weight seq linkid
-1 NULL 11 2 3 10
-1 NULL 11 1 2 12
+1 NULL 11 2 3 12
+1 NULL 11 1 2 10
1 NULL 11 0 1 11
SELECT * FROM graph WHERE latch='1' AND destid=12;
latch origid destid weight seq linkid
-1 NULL 12 2 3 11
-1 NULL 12 1 2 10
+1 NULL 12 2 3 10
+1 NULL 12 1 2 11
1 NULL 12 0 1 12
SELECT count(*) FROM graph;
count(*)
@@ -1280,9 +1280,6 @@ dijkstras 1 NULL 1 2 2
dijkstras 1 NULL 0 1 1
SELECT * FROM graph WHERE latch='dijkstras' AND destid=1;
latch origid destid weight seq linkid
-dijkstras NULL 1 4 7 18
-dijkstras NULL 1 3 6 17
-dijkstras NULL 1 3 5 16
dijkstras NULL 1 2 4 4
dijkstras NULL 1 1 3 3
dijkstras NULL 1 1 2 2
diff --git a/storage/oqgraph/oqgraph_shim.h b/storage/oqgraph/oqgraph_shim.h
index c0a9dbb2b40..f24732af4ef 100644
--- a/storage/oqgraph/oqgraph_shim.h
+++ b/storage/oqgraph/oqgraph_shim.h
@@ -154,12 +154,12 @@ namespace oqgraph3
typedef std::input_iterator_tag iterator_category;
in_edge_iterator() { }
in_edge_iterator(const cursor_ptr& cursor) : _cursor(cursor) { }
- value_type operator*() { return value_type(_cursor); }
+ value_type operator*() const { return value_type(_cursor); }
self& operator++() { _cursor->seek_next(); return *this; }
self operator++(int)
{ cursor_ptr t(new cursor(*_cursor)); ++(*this); return in_edge_iterator(t); }
- bool operator==(const self& x) { return _cursor == x._cursor; }
- bool operator!=(const self& x) { return _cursor != x._cursor; }
+ bool operator==(const self& x) const { return _cursor == x._cursor; }
+ bool operator!=(const self& x) const { return _cursor != x._cursor; }
cursor_ptr _cursor;
};
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 121cf41a3fe..41d68645fc6 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -1712,13 +1712,16 @@ bool CSphSEQuery::ParseField ( char * sField )
char * sLat = sValue;
char * p = sValue;
- if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0';
+ if (!( p = strchr ( p, ',' ) )) break;
+ *p++ = '\0';
char * sLong = p;
- if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0';
+ if (!( p = strchr ( p, ',' ) )) break;
+ *p++ = '\0';
char * sLatVal = p;
- if (!( p = strchr ( p, ',' ) )) break; *p++ = '\0';
+ if (!( p = strchr ( p, ',' ) )) break;
+ *p++ = '\0';
char * sLongVal = p;
m_sGeoLatAttr = chop(sLat);
@@ -1787,7 +1790,8 @@ bool CSphSEQuery::ParseField ( char * sField )
while ( sRest )
{
char * sId = sRest;
- if (!( sRest = strchr ( sRest, ':' ) )) break; *sRest++ = '\0';
+ if (!( sRest = strchr ( sRest, ':' ) )) break;
+ *sRest++ = '\0';
if (!( sRest - sId )) break;
sValue = sRest;
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 73e4bf37a06..b0ed6e41188 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -38,6 +38,7 @@ IF(NOT LIBJEMALLOC)
ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
+MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
############################################
MARK_AS_ADVANCED(BUILDNAME)
diff --git a/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt b/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt
index f9d93917627..c241f7918ee 100644
--- a/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt
+++ b/storage/tokudb/PerconaFT/third_party/snappy-1.1.2/CMakeLists.txt
@@ -1,3 +1,4 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(snappy_srcs
diff --git a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure
index 2d3e2062f0d..bfa3d4ad4df 100755
--- a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure
+++ b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure
@@ -19870,98 +19870,6 @@ if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
fi
-if test "$GCC" = yes ; then
- # Enable as much warnings as possible. These commented warnings won't
- # work for this package though:
- # * -Wunreachable-code breaks several assert(0) cases, which are
- # backed up with "return LZMA_PROG_ERROR".
- # * -Wcast-qual would break various things where we need a non-const
- # pointer although we don't modify anything through it.
- # * -Wcast-align breaks optimized CRC32 and CRC64 implementation
- # on some architectures (not on x86), where this warning is bogus,
- # because we take care of correct alignment.
- # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations
- # don't seem so useful here; at least the last one gives some
- # warnings which are not bugs.
- for NEW_FLAG in \
- -Wall \
- -Wextra \
- -Wformat=2 \
- -Winit-self \
- -Wmissing-include-dirs \
- -Wstrict-aliasing \
- -Wfloat-equal \
- -Wundef \
- -Wshadow \
- -Wpointer-arith \
- -Wbad-function-cast \
- -Wwrite-strings \
- -Wlogical-op \
- -Waggregate-return \
- -Wstrict-prototypes \
- -Wold-style-definition \
- -Wmissing-prototypes \
- -Wmissing-declarations \
- -Wmissing-noreturn \
- -Wredundant-decls
- do
- { $as_echo "$as_me:$LINENO: checking if $CC accepts $NEW_FLAG" >&5
-$as_echo_n "checking if $CC accepts $NEW_FLAG... " >&6; }
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $NEW_FLAG"
- cat >conftest.$ac_ext <<_ACEOF
-void foo(void) { }
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
-
- AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
- { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS="$OLD_CFLAGS"
- done
-
- # Check whether --enable-werror was given.
-if test "${enable_werror+set}" = set; then
- enableval=$enable_werror;
-else
- enable_werror=no
-fi
-
- if test "x$enable_werror" = "xyes"; then
- AM_CFLAGS="$AM_CFLAGS -Werror"
- fi
-fi
-
-
###############################################################################
# Create the makefiles and config.h
###############################################################################
diff --git a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac
index 148f174169e..e2bb87781c8 100644
--- a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac
+++ b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/configure.ac
@@ -569,63 +569,6 @@ if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
fi
-if test "$GCC" = yes ; then
- # Enable as much warnings as possible. These commented warnings won't
- # work for this package though:
- # * -Wunreachable-code breaks several assert(0) cases, which are
- # backed up with "return LZMA_PROG_ERROR".
- # * -Wcast-qual would break various things where we need a non-const
- # pointer although we don't modify anything through it.
- # * -Wcast-align breaks optimized CRC32 and CRC64 implementation
- # on some architectures (not on x86), where this warning is bogus,
- # because we take care of correct alignment.
- # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations
- # don't seem so useful here; at least the last one gives some
- # warnings which are not bugs.
- for NEW_FLAG in \
- -Wall \
- -Wextra \
- -Wformat=2 \
- -Winit-self \
- -Wmissing-include-dirs \
- -Wstrict-aliasing \
- -Wfloat-equal \
- -Wundef \
- -Wshadow \
- -Wpointer-arith \
- -Wbad-function-cast \
- -Wwrite-strings \
- -Wlogical-op \
- -Waggregate-return \
- -Wstrict-prototypes \
- -Wold-style-definition \
- -Wmissing-prototypes \
- -Wmissing-declarations \
- -Wmissing-noreturn \
- -Wredundant-decls
- do
- AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $NEW_FLAG"
- AC_COMPILE_IFELSE([void foo(void) { }], [
- AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
- AC_MSG_RESULT([yes])
- ], [
- AC_MSG_RESULT([no])
- ])
- CFLAGS="$OLD_CFLAGS"
- done
-
- AC_ARG_ENABLE([werror],
- AC_HELP_STRING([--enable-werror], [Enable -Werror to abort
- compilation on all compiler warnings.]),
- [], [enable_werror=no])
- if test "x$enable_werror" = "xyes"; then
- AM_CFLAGS="$AM_CFLAGS -Werror"
- fi
-fi
-
-
###############################################################################
# Create the makefiles and config.h
###############################################################################
diff --git a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4 b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4
index 39ba996cb96..faec0c309e8 100644
--- a/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4
+++ b/storage/tokudb/PerconaFT/third_party/xz-4.999.9beta/m4/libtool.m4
@@ -1021,7 +1021,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
# to the aix ld manual.
m4_defun([_LT_SYS_MODULE_PATH_AIX],
[m4_require([_LT_DECL_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+AC_LINK_IFELSE([AC_LANG_PROGRAM],[
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
/^0/ {
@@ -4826,9 +4826,9 @@ _LT_EOF
# implicitly export all symbols.
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
- AC_LINK_IFELSE(int foo(void) {},
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int foo(void) {}]),
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
- )
+ ])
LDFLAGS="$save_LDFLAGS"
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 7550943de7a..1558c6d50ac 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -570,15 +570,14 @@ dict_table_close(
ut_ad(mutex_own(&dict_sys->mutex));
ut_a(table->n_ref_count > 0);
- --table->n_ref_count;
+ const bool last_handle = !--table->n_ref_count;
/* Force persistent stats re-read upon next open of the table
so that FLUSH TABLE can be used to forcibly fetch stats from disk
if they have been manually modified. We reset table->stat_initialized
only if table reference count is 0 because we do not want too frequent
stats re-reads (e.g. in other cases than FLUSH TABLE). */
- if (strchr(table->name, '/') != NULL
- && table->n_ref_count == 0
+ if (last_handle && strchr(table->name, '/') != NULL
&& dict_stats_is_persistent_enabled(table)) {
dict_stats_deinit(table);
@@ -598,11 +597,8 @@ dict_table_close(
if (!dict_locked) {
table_id_t table_id = table->id;
- ibool drop_aborted;
-
- drop_aborted = try_drop
+ const bool drop_aborted = last_handle && try_drop
&& table->drop_aborted
- && table->n_ref_count == 1
&& dict_table_get_first_index(table);
mutex_exit(&dict_sys->mutex);
@@ -642,40 +638,6 @@ dict_table_get_col_name(
return(s);
}
-/**********************************************************************//**
-Returns a column's name.
-@return column name. NOTE: not guaranteed to stay valid if table is
-modified in any way (columns added, etc.). */
-UNIV_INTERN
-const char*
-dict_table_get_col_name_for_mysql(
-/*==============================*/
- const dict_table_t* table, /*!< in: table */
- const char* col_name)/*! in: MySQL table column name */
-{
- ulint i;
- const char* s;
-
- ut_ad(table);
- ut_ad(col_name);
- ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
-
- s = table->col_names;
- if (s) {
- /* If we have many virtual columns MySQL key_part->fieldnr
- could be larger than number of columns in InnoDB table
- when creating new indexes. */
- for (i = 0; i < table->n_def; i++) {
-
- if (!innobase_strcasecmp(s, col_name)) {
- break; /* Found */
- }
- s += strlen(s) + 1;
- }
- }
-
- return(s);
-}
#ifndef UNIV_HOTBACKUP
/** Allocate and init the autoinc latch of a given table.
This function must not be called concurrently on the same table object.
@@ -2151,8 +2113,9 @@ dict_table_remove_from_cache_low(
}
if (lru_evict && table->drop_aborted) {
- /* Do as dict_table_try_drop_aborted() does. */
-
+ /* When evicting the table definition,
+ drop the orphan indexes from the data dictionary
+ and free the index pages. */
trx_t* trx = trx_allocate_for_background();
ut_ad(mutex_own(&dict_sys->mutex));
@@ -2163,12 +2126,8 @@ dict_table_remove_from_cache_low(
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
+ row_merge_drop_indexes_dict(trx, table->id);
- /* Silence a debug assertion in row_merge_drop_indexes(). */
- ut_d(table->n_ref_count++);
- row_merge_drop_indexes(trx, table, TRUE);
- ut_d(table->n_ref_count--);
- ut_ad(table->n_ref_count == 0);
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index e1a95bcd427..88b5ad97277 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
+Copyright (c) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2644,22 +2644,23 @@ fts_get_next_doc_id(
will consult the CONFIG table and user table to re-establish
the initial value of the Doc ID */
- if (cache->first_doc_id != 0 || !fts_init_doc_id(table)) {
- if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) {
- *doc_id = FTS_NULL_DOC_ID;
- return(DB_SUCCESS);
+ if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) {
+ if (cache->first_doc_id == FTS_NULL_DOC_ID) {
+ fts_init_doc_id(table);
}
+ *doc_id = FTS_NULL_DOC_ID;
+ return(DB_SUCCESS);
+ }
- /* Otherwise, simply increment the value in cache */
- mutex_enter(&cache->doc_id_lock);
- *doc_id = ++cache->next_doc_id;
- mutex_exit(&cache->doc_id_lock);
- } else {
- mutex_enter(&cache->doc_id_lock);
- *doc_id = cache->next_doc_id;
- mutex_exit(&cache->doc_id_lock);
+ if (cache->first_doc_id == FTS_NULL_DOC_ID) {
+ fts_init_doc_id(table);
}
+ DEBUG_SYNC_C("get_next_FTS_DOC_ID");
+ mutex_enter(&cache->doc_id_lock);
+ *doc_id = cache->next_doc_id++;
+ mutex_exit(&cache->doc_id_lock);
+
return(DB_SUCCESS);
}
@@ -3033,53 +3034,6 @@ fts_modify(
}
/*********************************************************************//**
-Create a new document id.
-@return DB_SUCCESS if all went well else error */
-UNIV_INTERN
-dberr_t
-fts_create_doc_id(
-/*==============*/
- dict_table_t* table, /*!< in: row is of this table. */
- dtuple_t* row, /* in/out: add doc id value to this
- row. This is the current row that is
- being inserted. */
- mem_heap_t* heap) /*!< in: heap */
-{
- doc_id_t doc_id;
- dberr_t error = DB_SUCCESS;
-
- ut_a(table->fts->doc_col != ULINT_UNDEFINED);
-
- if (!DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID)) {
- if (table->fts->cache->first_doc_id == FTS_NULL_DOC_ID) {
- error = fts_get_next_doc_id(table, &doc_id);
- }
- return(error);
- }
-
- error = fts_get_next_doc_id(table, &doc_id);
-
- if (error == DB_SUCCESS) {
- dfield_t* dfield;
- doc_id_t* write_doc_id;
-
- ut_a(doc_id > 0);
-
- dfield = dtuple_get_nth_field(row, table->fts->doc_col);
- write_doc_id = static_cast<doc_id_t*>(
- mem_heap_alloc(heap, sizeof(*write_doc_id)));
-
- ut_a(doc_id != FTS_NULL_DOC_ID);
- ut_a(sizeof(doc_id) == dfield->type.len);
- fts_write_doc_id((byte*) write_doc_id, doc_id);
-
- dfield_set_data(dfield, write_doc_id, sizeof(*write_doc_id));
- }
-
- return(error);
-}
-
-/*********************************************************************//**
The given transaction is about to be committed; do whatever is necessary
from the FTS system's POV.
@return DB_SUCCESS or error code */
diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc
index f24973e26fb..358d979fff6 100644
--- a/storage/xtradb/fts/fts0que.cc
+++ b/storage/xtradb/fts/fts0que.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -3653,6 +3654,10 @@ fts_query_free(
fts_doc_ids_free(query->deleted);
}
+ if (query->intersection) {
+ fts_query_free_doc_ids(query, query->intersection);
+ }
+
if (query->doc_ids) {
fts_query_free_doc_ids(query, query->doc_ids);
}
@@ -3677,8 +3682,6 @@ fts_query_free(
rbt_free(query->word_freqs);
}
- ut_a(!query->intersection);
-
if (query->word_map) {
rbt_free(query->word_map);
}
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 412c386a20b..8d4cfbb29ff 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -5952,8 +5952,6 @@ innobase_match_index_columns(
if (innodb_idx_fld >= innodb_idx_fld_end) {
DBUG_RETURN(FALSE);
}
-
- mtype = innodb_idx_fld->col->mtype;
}
if (col_type != mtype) {
@@ -19421,7 +19419,7 @@ buffer_pool_load_now(
const void* save) /*!< in: immediate result from
check function */
{
- if (*(my_bool*) save) {
+ if (*(my_bool*) save && !srv_read_only_mode) {
buf_load_start();
}
}
@@ -19444,7 +19442,7 @@ buffer_pool_load_abort(
const void* save) /*!< in: immediate result from
check function */
{
- if (*(my_bool*) save) {
+ if (*(my_bool*) save && !srv_read_only_mode) {
buf_load_abort();
}
}
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 32ad4844c34..ca3c4648af3 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -237,34 +237,6 @@ innobase_need_rebuild(
return(false);
}
- /* If alter table changes column name and adds a new
- index, we need to check is this new index created
- to new column name. This is because column name
- changes are done normally after creating indexes. */
- if ((ha_alter_info->handler_flags
- & Alter_inplace_info::ALTER_COLUMN_NAME) &&
- ((ha_alter_info->handler_flags
- & Alter_inplace_info::ADD_INDEX) ||
- (ha_alter_info->handler_flags
- & Alter_inplace_info::ADD_FOREIGN_KEY))) {
- for (ulint i = 0; i < ha_alter_info->index_add_count; i++) {
- const KEY* key = &ha_alter_info->key_info_buffer[
- ha_alter_info->index_add_buffer[i]];
-
- for (ulint j = 0; j < key->user_defined_key_parts; j++) {
- const KEY_PART_INFO* key_part = &(key->key_part[j]);
- const Field* field = altered_table->field[key_part->fieldnr];
-
- /* Field used on added index is renamed on
- this same alter table. We need table
- rebuild. */
- if (field && field->flags & FIELD_IS_RENAMED) {
- return (true);
- }
- }
- }
- }
-
return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD));
}
@@ -1551,38 +1523,49 @@ name_ok:
return(0);
}
-/*******************************************************************//**
-Create index field definition for key part */
+/** Create index field definition for key part
+@param[in] new_clustered true if alter is generating a new clustered
+index
+@param[in] altered_table MySQL table that is being altered
+@param[in] key_part MySQL key definition
+@param[out] index_field index field defition for key_part */
static MY_ATTRIBUTE((nonnull(2,3)))
void
innobase_create_index_field_def(
-/*============================*/
- const TABLE* altered_table, /*!< in: MySQL table that is
- being altered, or NULL
- if a new clustered index is
- not being created */
- const KEY_PART_INFO* key_part, /*!< in: MySQL key definition */
- index_field_t* index_field, /*!< out: index field
- definition for key_part */
- const Field** fields) /*!< in: MySQL table fields */
+ bool new_clustered,
+ const TABLE* altered_table,
+ const KEY_PART_INFO* key_part,
+ index_field_t* index_field)
{
const Field* field;
ibool is_unsigned;
ulint col_type;
+ ulint innodb_fieldnr=0;
DBUG_ENTER("innobase_create_index_field_def");
ut_ad(key_part);
ut_ad(index_field);
+ ut_ad(altered_table);
+
+ /* Virtual columns are not stored in InnoDB data dictionary, thus
+ if there is virtual columns we need to skip them to find the
+ correct field. */
+ for(ulint i = 0; i < key_part->fieldnr; i++) {
+ const Field* table_field = altered_table->field[i];
+ if (!table_field->stored_in_db) {
+ continue;
+ }
+ innodb_fieldnr++;
+ }
- field = altered_table
- ? altered_table->field[key_part->fieldnr]
+ field = new_clustered ?
+ altered_table->field[key_part->fieldnr]
: key_part->field;
- ut_a(field);
- index_field->col_no = key_part->fieldnr;
- index_field->col_name = altered_table ? field->field_name : fields[key_part->fieldnr]->field_name;
+ ut_a(field);
+ index_field->col_no = innodb_fieldnr;
col_type = get_innobase_type_from_mysql_type(&is_unsigned, field);
if (DATA_BLOB == col_type
@@ -1616,10 +1599,8 @@ innobase_create_index_def(
bool key_clustered, /*!< in: true if this is
the new clustered index */
index_def_t* index, /*!< out: index definition */
- mem_heap_t* heap, /*!< in: heap where memory
+ mem_heap_t* heap) /*!< in: heap where memory
is allocated */
- const Field** fields) /*!< in: MySQL table fields
- */
{
const KEY* key = &keys[key_number];
ulint i;
@@ -1630,11 +1611,10 @@ innobase_create_index_def(
DBUG_ENTER("innobase_create_index_def");
DBUG_ASSERT(!key_clustered || new_clustered);
+ ut_ad(altered_table);
+
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, n_fields * sizeof *index->fields));
-
- memset(index->fields, 0, n_fields * sizeof *index->fields);
-
index->ind_type = 0;
index->key_number = key_number;
index->n_fields = n_fields;
@@ -1665,13 +1645,12 @@ innobase_create_index_def(
index->ind_type |= DICT_FTS;
}
- if (!new_clustered) {
- altered_table = NULL;
- }
-
for (i = 0; i < n_fields; i++) {
innobase_create_index_field_def(
- altered_table, &key->key_part[i], &index->fields[i], fields);
+ new_clustered,
+ altered_table,
+ &key->key_part[i],
+ &index->fields[i]);
}
DBUG_VOID_RETURN;
@@ -1997,7 +1976,7 @@ innobase_create_key_defs(
/* Create the PRIMARY key index definition */
innobase_create_index_def(
altered_table, key_info, primary_key_number,
- TRUE, TRUE, indexdef++, heap, (const Field **)altered_table->field);
+ TRUE, TRUE, indexdef++, heap);
created_clustered:
n_add = 1;
@@ -2009,7 +1988,7 @@ created_clustered:
/* Copy the index definitions. */
innobase_create_index_def(
altered_table, key_info, i, TRUE, FALSE,
- indexdef, heap, (const Field **)altered_table->field);
+ indexdef, heap);
if (indexdef->ind_type & DICT_FTS) {
n_fts_add++;
@@ -2054,7 +2033,7 @@ created_clustered:
for (ulint i = 0; i < n_add; i++) {
innobase_create_index_def(
altered_table, key_info, add[i], FALSE, FALSE,
- indexdef, heap, (const Field **)altered_table->field);
+ indexdef, heap);
if (indexdef->ind_type & DICT_FTS) {
n_fts_add++;
@@ -2071,7 +2050,6 @@ created_clustered:
index->fields = static_cast<index_field_t*>(
mem_heap_alloc(heap, sizeof *index->fields));
- memset(index->fields, 0, sizeof *index->fields);
index->n_fields = 1;
index->fields->col_no = fts_doc_id_col;
index->fields->prefix_len = 0;
@@ -2161,7 +2139,7 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx
/** mapping of old column numbers to new ones, or NULL */
const ulint* col_map;
/** new column names, or NULL if nothing was renamed */
- const char** col_names;
+ const char** col_names;
/** added AUTO_INCREMENT column position, or ULINT_UNDEFINED */
const ulint add_autoinc;
/** default values of ADD COLUMN, or NULL */
@@ -3122,8 +3100,7 @@ prepare_inplace_alter_table_dict(
for (ulint a = 0; a < ctx->num_to_add_index; a++) {
ctx->add_index[a] = row_merge_create_index(
- ctx->trx, ctx->new_table,
- &index_defs[a], ctx->col_names);
+ ctx->trx, ctx->new_table, &index_defs[a]);
add_key_nums[a] = index_defs[a].key_number;
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index ca2c76c31ad..94cd6f29558 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -6363,6 +6363,7 @@ i_s_sys_tables_fill_table_stats(
}
heap = mem_heap_create(1000);
+ rw_lock_s_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
@@ -6389,9 +6390,11 @@ i_s_sys_tables_fill_table_stats(
err_msg);
}
+ rw_lock_s_unlock(&dict_operation_lock);
mem_heap_empty(heap);
/* Get the next record */
+ rw_lock_s_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
rec = dict_getnext_system(&pcur, &mtr);
@@ -6399,6 +6402,7 @@ i_s_sys_tables_fill_table_stats(
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
+ rw_lock_s_unlock(&dict_operation_lock);
mem_heap_free(heap);
DBUG_RETURN(0);
@@ -7690,8 +7694,6 @@ i_s_dict_fill_sys_tablespaces(
{
Field** fields;
ulint atomic_blobs = FSP_FLAGS_HAS_ATOMIC_BLOBS(flags);
- ulint page_size = fsp_flags_get_page_size(flags);
- ulint zip_size = fsp_flags_get_zip_size(flags);
const char* file_format;
const char* row_format;
@@ -7708,13 +7710,11 @@ i_s_dict_fill_sys_tablespaces(
fields = table_to_fill->field;
- OK(fields[SYS_TABLESPACES_SPACE]->store(
- static_cast<double>(space)));
+ OK(fields[SYS_TABLESPACES_SPACE]->store(space, true));
OK(field_store_string(fields[SYS_TABLESPACES_NAME], name));
- OK(fields[SYS_TABLESPACES_FLAGS]->store(
- static_cast<double>(flags)));
+ OK(fields[SYS_TABLESPACES_FLAGS]->store(flags, true));
OK(field_store_string(fields[SYS_TABLESPACES_FILE_FORMAT],
file_format));
@@ -7722,11 +7722,18 @@ i_s_dict_fill_sys_tablespaces(
OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT],
row_format));
- OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store(
- static_cast<double>(page_size)));
+ ulint cflags = fsp_flags_is_valid(flags, space)
+ ? flags : fsp_flags_convert_from_101(flags);
+ if (cflags != ULINT_UNDEFINED) {
+ OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store(
+ fsp_flags_get_page_size(cflags), true));
- OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(
- static_cast<double>(zip_size)));
+ OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(
+ fsp_flags_get_zip_size(cflags), true));
+ } else {
+ fields[SYS_TABLESPACES_PAGE_SIZE]->set_null();
+ fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->set_null();
+ }
OK(schema_table_store_record(thd, table_to_fill));
diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic
index 8f5cee0fd5f..ff72f6ed20f 100644
--- a/storage/xtradb/include/data0type.ic
+++ b/storage/xtradb/include/data0type.ic
@@ -577,7 +577,7 @@ dtype_get_fixed_size_low(
return(len);
#endif /* !UNIV_HOTBACKUP */
/* Treat as variable-length. */
- /* Fall through */
+ /* fall through */
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index a43b04d9d1e..dda8f4d2714 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -619,17 +619,6 @@ dict_table_get_col_name(
ulint col_nr) /*!< in: column number */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/**********************************************************************//**
-Returns a column's name.
-@return column name. NOTE: not guaranteed to stay valid if table is
-modified in any way (columns added, etc.). */
-UNIV_INTERN
-const char*
-dict_table_get_col_name_for_mysql(
-/*==============================*/
- const dict_table_t* table, /*!< in: table */
- const char* col_name)/*!< in: MySQL table column name */
- __attribute__((nonnull, warn_unused_result));
-/**********************************************************************//**
Prints a table data. */
UNIV_INTERN
void
diff --git a/storage/xtradb/include/fts0fts.h b/storage/xtradb/include/fts0fts.h
index 7aa7055640c..cd94956dc55 100644
--- a/storage/xtradb/include/fts0fts.h
+++ b/storage/xtradb/include/fts0fts.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
+Copyright (c) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -429,21 +429,6 @@ fts_update_next_doc_id(
MY_ATTRIBUTE((nonnull(2)));
/******************************************************************//**
-Create a new document id .
-@return DB_SUCCESS if all went well else error */
-UNIV_INTERN
-dberr_t
-fts_create_doc_id(
-/*==============*/
- dict_table_t* table, /*!< in: row is of this
- table. */
- dtuple_t* row, /*!< in/out: add doc id
- value to this row. This is the
- current row that is being
- inserted. */
- mem_heap_t* heap) /*!< in: heap */
- MY_ATTRIBUTE((nonnull));
-/******************************************************************//**
Create a new fts_doc_ids_t.
@return new fts_doc_ids_t. */
UNIV_INTERN
diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h
index 152a51dafc6..af21ef49cb7 100644
--- a/storage/xtradb/include/row0merge.h
+++ b/storage/xtradb/include/row0merge.h
@@ -108,7 +108,6 @@ struct index_field_t {
ulint col_no; /*!< column offset */
ulint prefix_len; /*!< column prefix length, or 0
if indexing the whole column */
- const char* col_name; /*!< column name or NULL */
};
/** Definition of an index being created */
@@ -265,11 +264,7 @@ row_merge_create_index(
/*===================*/
trx_t* trx, /*!< in/out: trx (sets error_state) */
dict_table_t* table, /*!< in: the index is on this table */
- const index_def_t* index_def,
- /*!< in: the index definition */
- const char** col_names);
- /*! in: column names if columns are
- renamed or NULL */
+ const index_def_t* index_def); /*!< in: the index definition */
/*********************************************************************//**
Check if a transaction can use an index.
@return TRUE if index can be used by the transaction else FALSE */
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index 4eb6534161d..22ad34e5e35 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -3736,11 +3736,7 @@ row_merge_create_index(
/*===================*/
trx_t* trx, /*!< in/out: trx (sets error_state) */
dict_table_t* table, /*!< in: the index is on this table */
- const index_def_t* index_def,
- /*!< in: the index definition */
- const char** col_names)
- /*! in: column names if columns are
- renamed or NULL */
+ const index_def_t* index_def) /*!< in: the index definition */
{
dict_index_t* index;
dberr_t err;
@@ -3760,28 +3756,10 @@ row_merge_create_index(
for (i = 0; i < n_fields; i++) {
index_field_t* ifield = &index_def->fields[i];
- const char * col_name;
-
- /*
- Alter table renaming a column and then adding a index
- to this new name e.g ALTER TABLE t
- CHANGE COLUMN b c INT NOT NULL, ADD UNIQUE INDEX (c);
- requires additional check as column names are not yet
- changed when new index definitions are created. Table's
- new column names are on a array of column name pointers
- if any of the column names are changed. */
-
- if (col_names && col_names[i]) {
- col_name = col_names[i];
- } else {
- col_name = ifield->col_name ?
- dict_table_get_col_name_for_mysql(table, ifield->col_name) :
- dict_table_get_col_name(table, ifield->col_no);
- }
dict_mem_index_add_field(
index,
- col_name,
+ dict_table_get_col_name(table, ifield->col_no),
ifield->prefix_len);
}
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 0079fc79a0e..67eb1d7de94 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -569,11 +569,33 @@ next_column:
/* If there is a FTS doc id column and it is not user supplied (
generated by server) then assign it a new doc id. */
- if (prebuilt->table->fts) {
+ if (!prebuilt->table->fts) {
+ return;
+ }
+
+ ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED);
- ut_a(prebuilt->table->fts->doc_col != ULINT_UNDEFINED);
+ doc_id_t doc_id;
- fts_create_doc_id(prebuilt->table, row, prebuilt->heap);
+ if (!DICT_TF2_FLAG_IS_SET(prebuilt->table, DICT_TF2_FTS_HAS_DOC_ID)) {
+ if (prebuilt->table->fts->cache->first_doc_id
+ == FTS_NULL_DOC_ID) {
+ fts_get_next_doc_id(prebuilt->table, &doc_id);
+ }
+ return;
+ }
+
+ dfield_t* fts_doc_id = dtuple_get_nth_field(
+ row, prebuilt->table->fts->doc_col);
+
+ if (fts_get_next_doc_id(prebuilt->table, &doc_id) == DB_SUCCESS) {
+ ut_a(doc_id != FTS_NULL_DOC_ID);
+ ut_ad(sizeof(doc_id) == fts_doc_id->type.len);
+ dfield_set_data(fts_doc_id, prebuilt->ins_upd_rec_buff
+ + prebuilt->mysql_row_len, 8);
+ fts_write_doc_id(fts_doc_id->data, doc_id);
+ } else {
+ dfield_set_null(fts_doc_id);
}
}
@@ -1048,7 +1070,10 @@ row_get_prebuilt_insert_row(
prebuilt->ins_upd_rec_buff = static_cast<byte*>(
mem_heap_alloc(
prebuilt->heap,
- prebuilt->mysql_row_len));
+ DICT_TF2_FLAG_IS_SET(prebuilt->table,
+ DICT_TF2_FTS_HAS_DOC_ID)
+ ? prebuilt->mysql_row_len + 8/* FTS_DOC_ID */
+ : prebuilt->mysql_row_len));
}
dtuple_t* row;
diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc
index d96d6d37844..9cbadc305c0 100644
--- a/storage/xtradb/row/row0sel.cc
+++ b/storage/xtradb/row/row0sel.cc
@@ -2737,6 +2737,7 @@ row_sel_field_store_in_mysql_format_func(
case DATA_SYS:
/* These column types should never be shipped to MySQL. */
ut_ad(0);
+ /* fall through */
case DATA_CHAR:
case DATA_FIXBINARY: