summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-22 09:20:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-22 09:46:51 +0300
commit70505dd45bd36516206eeeb5dcaa28e5f5a1d6dd (patch)
tree14d0c4dba49e36dc0d80c1ba99757b4074781d2d /storage
parent7edadde72eb23e9110db8cea810c023104e9d15e (diff)
parent13a350ac29eeb43153c7bca65b73b5dfa9f8ffb5 (diff)
downloadmariadb-git-70505dd45bd36516206eeeb5dcaa28e5f5a1d6dd.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/CMakeLists.txt2
-rw-r--r--storage/connect/array.cpp2
-rw-r--r--storage/connect/filamdbf.cpp4
-rw-r--r--storage/connect/filamfix.cpp3
-rw-r--r--storage/connect/filamtxt.cpp1
-rwxr-xr-xstorage/connect/filamvct.cpp3
-rw-r--r--storage/connect/filamzip.cpp2
-rw-r--r--storage/connect/filter.cpp3
-rw-r--r--storage/connect/ha_connect.cc8
-rw-r--r--storage/connect/json.cpp4
-rw-r--r--storage/connect/plgdbutl.cpp2
-rw-r--r--storage/connect/reldef.cpp1
-rw-r--r--storage/connect/tabdos.cpp1
-rw-r--r--storage/connect/tabext.h2
-rw-r--r--storage/connect/tabjson.cpp2
-rw-r--r--storage/connect/value.cpp2
-rwxr-xr-xstorage/connect/xindex.cpp2
-rw-r--r--storage/connect/xobject.cpp2
-rw-r--r--storage/csv/ha_tina.cc15
-rw-r--r--storage/federated/ha_federated.cc2
-rw-r--r--storage/heap/hp_create.c4
-rw-r--r--storage/innobase/btr/btr0cur.cc55
-rw-r--r--storage/innobase/fil/fil0fil.cc45
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc1
-rw-r--r--storage/innobase/handler/ha_innodb.cc33
-rw-r--r--storage/innobase/handler/ha_innodb.h13
-rw-r--r--storage/innobase/handler/handler0alter.cc12
-rw-r--r--storage/innobase/handler/i_s.cc232
-rw-r--r--storage/innobase/handler/i_s.h4
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc2
-rw-r--r--storage/innobase/include/btr0cur.h25
-rw-r--r--storage/innobase/include/data0type.ic3
-rw-r--r--storage/innobase/include/fil0fil.h2
-rw-r--r--storage/innobase/include/mach0data.ic14
-rw-r--r--storage/innobase/include/page0zip.ic3
-rw-r--r--storage/innobase/include/trx0rec.h18
-rw-r--r--storage/innobase/include/ut0rnd.ic7
-rw-r--r--storage/innobase/lock/lock0lock.cc21
-rw-r--r--storage/innobase/rem/rem0rec.cc6
-rw-r--r--storage/innobase/row/row0import.cc1
-rw-r--r--storage/innobase/row/row0ins.cc12
-rw-r--r--storage/innobase/row/row0log.cc1
-rw-r--r--storage/innobase/row/row0mysql.cc8
-rw-r--r--storage/innobase/row/row0purge.cc3
-rw-r--r--storage/innobase/row/row0upd.cc22
-rw-r--r--storage/innobase/srv/srv0srv.cc134
-rw-r--r--storage/innobase/trx/trx0rec.cc53
-rw-r--r--storage/innobase/usr/usr0sess.cc1
-rw-r--r--storage/maria/ma_extra.c3
-rw-r--r--storage/maria/ma_recovery.c2
-rw-r--r--storage/myisam/mi_extra.c3
-rw-r--r--storage/myisam/mi_locking.c20
-rw-r--r--storage/sphinx/ha_sphinx.cc7
-rw-r--r--storage/spider/spd_db_conn.cc2
-rw-r--r--storage/spider/spd_table.cc1
-rw-r--r--storage/xtradb/btr/btr0cur.cc72
-rw-r--r--storage/xtradb/buf/buf0buf.cc4
-rw-r--r--storage/xtradb/fil/fil0fil.cc32
-rw-r--r--storage/xtradb/fil/fil0pagecompress.cc5
-rw-r--r--storage/xtradb/handler/ha_innodb.cc58
-rw-r--r--storage/xtradb/handler/ha_innodb.h2
-rw-r--r--storage/xtradb/handler/handler0alter.cc12
-rw-r--r--storage/xtradb/handler/i_s.cc287
-rw-r--r--storage/xtradb/handler/i_s.h4
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.cc5
-rw-r--r--storage/xtradb/include/btr0cur.h25
-rw-r--r--storage/xtradb/include/data0type.ic3
-rw-r--r--storage/xtradb/include/fil0fil.h2
-rw-r--r--storage/xtradb/include/ha_prototypes.h3
-rw-r--r--storage/xtradb/include/mach0data.ic15
-rw-r--r--storage/xtradb/include/os0sync.h9
-rw-r--r--storage/xtradb/include/page0zip.ic4
-rw-r--r--storage/xtradb/include/trx0rec.h11
-rw-r--r--storage/xtradb/include/ut0rnd.ic7
-rw-r--r--storage/xtradb/lock/lock0lock.cc22
-rw-r--r--storage/xtradb/rem/rem0rec.cc6
-rw-r--r--storage/xtradb/row/row0ftsort.cc3
-rw-r--r--storage/xtradb/row/row0import.cc1
-rw-r--r--storage/xtradb/row/row0ins.cc9
-rw-r--r--storage/xtradb/row/row0log.cc2
-rw-r--r--storage/xtradb/row/row0mysql.cc3
-rw-r--r--storage/xtradb/row/row0purge.cc4
-rw-r--r--storage/xtradb/srv/srv0srv.cc139
-rw-r--r--storage/xtradb/sync/sync0sync.cc5
-rw-r--r--storage/xtradb/trx/trx0i_s.cc4
-rw-r--r--storage/xtradb/trx/trx0rec.cc42
-rw-r--r--storage/xtradb/usr/usr0sess.cc3
87 files changed, 794 insertions, 845 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index a602084b5bd..840ccdfb0a8 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -270,8 +270,8 @@ IF(CONNECT_WITH_JDBC)
# Find required libraries and include directories
SET (JAVA_SOURCES JdbcInterface.java)
add_jar(JdbcInterface ${JAVA_SOURCES})
- install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
+ ${CMAKE_CURRENT_BINARY_DIR}/JdbcInterface.jar
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
add_definitions(-DJDBC_SUPPORT)
ELSE()
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp
index 1998ab890e9..88ab85d20eb 100644
--- a/storage/connect/array.cpp
+++ b/storage/connect/array.cpp
@@ -155,6 +155,7 @@ ARRAY::ARRAY(PGLOBAL g, int type, int size, int length, int prec)
switch (type) {
case TYPE_STRING:
Len = length;
+ /* fall through */
case TYPE_SHORT:
case TYPE_INT:
case TYPE_DOUBLE:
@@ -592,6 +593,7 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
switch (Type) {
case TYPE_DOUBLE:
prec = 2;
+ /* fall through */
case TYPE_SHORT:
case TYPE_INT:
case TYPE_DATE:
diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp
index 55feaa02bc4..3ace8864b55 100644
--- a/storage/connect/filamdbf.cpp
+++ b/storage/connect/filamdbf.cpp
@@ -503,7 +503,8 @@ bool DBFFAM::OpenTableFile(PGLOBAL g)
break;
} // endif
- // Selective delete, pass thru
+ // Selective delete
+ /* fall through */
case MODE_UPDATE:
UseTemp = Tdbp->IsUsingTemp(g);
strcpy(opmode, (UseTemp) ? "rb" : "r+b");
@@ -623,6 +624,7 @@ bool DBFFAM::AllocateBuffer(PGLOBAL g)
case 'L': // Large (big) integer
case 'T': // Tiny integer
c = 'N'; // Numeric
+ /* fall through */
case 'N': // Numeric (integer)
case 'F': // Float (double)
descp->Decimals = (uchar)cdp->F.Prec;
diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp
index cd25429318a..dcb677dc848 100644
--- a/storage/connect/filamfix.cpp
+++ b/storage/connect/filamfix.cpp
@@ -919,7 +919,8 @@ bool BGXFAM::OpenTableFile(PGLOBAL g)
break;
} // endif
- // Selective delete, pass thru
+ // Selective delete
+ /* fall through */
case MODE_UPDATE:
UseTemp = Tdbp->IsUsingTemp(g);
oflag |= (UseTemp) ? O_RDONLY : O_RDWR;
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index e53cdcd9ba9..12c0a66ecad 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -561,6 +561,7 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
// Selective delete, pass thru
Bin = true;
+ /* fall through */
case MODE_UPDATE:
if ((UseTemp = Tdbp->IsUsingTemp(g))) {
strcpy(opmode, "r");
diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp
index fdc5433f4a4..71a8dd98c61 100755
--- a/storage/connect/filamvct.cpp
+++ b/storage/connect/filamvct.cpp
@@ -440,6 +440,7 @@ bool VCTFAM::OpenTableFile(PGLOBAL g)
} // endif
// Selective delete, pass thru
+ /* fall through */
case MODE_UPDATE:
UseTemp = Tdbp->IsUsingTemp(g);
strcpy(opmode, (UseTemp) ? "rb" : "r+b");
@@ -1918,6 +1919,7 @@ bool VECFAM::OpenTableFile(PGLOBAL g)
} // endif filter
// Selective delete, pass thru
+ /* fall through */
case MODE_UPDATE:
UseTemp = Tdbp->IsUsingTemp(g);
strcpy(opmode, (UseTemp) ? "rb": "r+b");
@@ -3584,6 +3586,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g)
} // endif
// Selective delete, pass thru
+ /* fall through */
case MODE_UPDATE:
UseTemp = Tdbp->IsUsingTemp(g);
oflag = (UseTemp) ? O_RDONLY : O_RDWR;
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index 3d157da5e87..fa857837427 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -341,7 +341,7 @@ bool ZIPUTIL::OpenTable(PGLOBAL g, MODE mode, char *fn, bool append)
bool ZIPUTIL::addEntry(PGLOBAL g, char *entry)
{
//?? we dont need the stinking time
- zip_fileinfo zi = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ zip_fileinfo zi = { {0, 0, 0, 0, 0, 0}, 0, 0, 0 };
getTime(zi.tmz_date);
target = entry;
diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp
index 262d6b58a70..35840e9b5e3 100644
--- a/storage/connect/filter.cpp
+++ b/storage/connect/filter.cpp
@@ -1193,7 +1193,7 @@ bool FILTER::Convert(PGLOBAL g, bool having)
Arg(0) = pXVOID;
} // endif void
- // pass thru
+ // fall through
case OP_IN:
// For IN operator do optimize if operand is an array
if (GetArgType(1) != TYPE_ARRAY)
@@ -1260,6 +1260,7 @@ bool FILTER::Eval(PGLOBAL g)
} // endif Opm
// For modified operators, pass thru
+ /* fall through */
case OP_IN:
case OP_EXIST:
// For IN operations, special processing is done here
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index f2727ba15f7..508ec1382fd 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -1427,7 +1427,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
pcf->Flags |= U_VAR;
- /* no break */
+ /* fall through */
default:
pcf->Type= MYSQLtoPLG(fp->type(), &v);
break;
@@ -2800,6 +2800,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
case Item_func::LIKE_FUNC: vop= OP_LIKE; break;
case Item_func::ISNOTNULL_FUNC:
neg = true;
+ /* fall through */
case Item_func::ISNULL_FUNC: vop= OP_NULL; break;
case Item_func::IN_FUNC: vop= OP_IN;
case Item_func::BETWEEN:
@@ -4219,7 +4220,8 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
} else
return false;
- /* Fall through to check FILE_ACL */
+ /* check FILE_ACL */
+ /* fall through */
case TAB_ODBC:
case TAB_JDBC:
case TAB_MYSQL:
@@ -5453,7 +5455,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
#endif // JDBC_SUPPORT
case TAB_DBF:
dbf= true;
- // Passthru
+ // fall through
case TAB_CSV:
if (!fn && fnc != FNC_NO)
sprintf(g->Message, "Missing %s file name", topt->type);
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index b473871e9f7..6904295066f 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -533,7 +533,7 @@ PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src)
if (!has_e)
goto err;
- // passthru
+ // fall through
case '-':
if (found_digit)
goto err;
@@ -826,7 +826,7 @@ bool JOUTSTR::Escape(const char *s)
case '\r':
case '\b':
case '\f': WriteChr('\\');
- // passthru
+ // fall through
default:
WriteChr(s[i]);
break;
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index 1910cdcdec8..52c6058393f 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -917,7 +917,7 @@ int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all)
fp->Memory = NULL;
fp->Mode = MODE_ANY;
- // Passthru
+ // fall through
case TYPE_FB_HANDLE:
if (fp->Handle && fp->Handle != INVALID_HANDLE_VALUE)
if (CloseFileHandle(fp->Handle))
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp
index c6878737f1d..1b4691ea1fe 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -128,6 +128,7 @@ int RELDEF::GetSizeCatInfo(PSZ what, PSZ sdef)
switch (toupper(c)) {
case 'M':
n *= 1024;
+ // fall through
case 'K':
n *= 1024;
} // endswitch c
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index d2bb3d7a4af..2da92741e4f 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -1307,6 +1307,7 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp)
} // endif !opm
// if opm, pass thru
+ /* fall through */
case OP_IN:
if (filp->GetArgType(0) == TYPE_COLBLK &&
filp->GetArgType(1) == TYPE_ARRAY) {
diff --git a/storage/connect/tabext.h b/storage/connect/tabext.h
index 2ef20c89f2c..5133bd9dd5f 100644
--- a/storage/connect/tabext.h
+++ b/storage/connect/tabext.h
@@ -7,7 +7,7 @@
/***********************************************************************/
#ifndef __TABEXT_H
-#define __TABEXTF_H
+#define __TABEXT_H
#include "reldef.h"
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 1e11d454cfc..2addcc139fb 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -1530,7 +1530,7 @@ void JSONCOL::WriteColumn(PGLOBAL g)
break;
} // endif Op
- // Passthru
+ // fall through
case TYPE_DATE:
case TYPE_INT:
case TYPE_SHORT:
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index ced690e77c0..7660ee0a630 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -118,7 +118,7 @@ ulonglong CharToNumber(char *p, int n, ulonglong maxval,
maxval++;
if (minus) *minus = true;
} // endif Unsigned
-
+ /* fall through */
case '+':
p++;
break;
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index 15fb71ab88a..ae210cb900c 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -464,7 +464,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp)
if (ApplyFilter(g, filp))
break;
- // passthru
+ // fall through
case RC_NF:
continue;
case RC_EF:
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index a0b7849543d..746de097918 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -405,7 +405,7 @@ bool STRING::Append_quoted(PSZ s)
case '\r':
case '\b':
case '\f': b |= Append('\\');
- // passthru
+ // fall through
default:
b |= Append(*p);
break;
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 308e6f12d73..16706ad73c0 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -300,7 +300,7 @@ static int read_meta_file(File meta_file, ha_rows *rows)
mysql_file_seek(meta_file, 0, MY_SEEK_SET, MYF(0));
if (mysql_file_read(meta_file, (uchar*)meta_buffer, META_BUFFER_SIZE, 0)
!= META_BUFFER_SIZE)
- DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ DBUG_RETURN(my_errno= HA_ERR_CRASHED_ON_USAGE);
/*
Parse out the meta data, we ignore version at the moment
@@ -429,10 +429,13 @@ static int free_share(TINA_SHARE *share)
int result_code= 0;
if (!--share->use_count){
/* Write the meta file. Mark it as crashed if needed. */
- (void)write_meta_file(share->meta_file, share->rows_recorded,
- share->crashed ? TRUE :FALSE);
- if (mysql_file_close(share->meta_file, MYF(0)))
- result_code= 1;
+ if (share->meta_file != -1)
+ {
+ (void)write_meta_file(share->meta_file, share->rows_recorded,
+ share->crashed ? TRUE :FALSE);
+ if (mysql_file_close(share->meta_file, MYF(0)))
+ result_code= 1;
+ }
if (share->tina_write_opened)
{
if (mysql_file_close(share->tina_write_filedes, MYF(0)))
@@ -954,7 +957,7 @@ int ha_tina::open(const char *name, int mode, uint open_options)
if (share->crashed && !(open_options & HA_OPEN_FOR_REPAIR))
{
free_share(share);
- DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ DBUG_RETURN(my_errno ? my_errno : HA_ERR_CRASHED_ON_USAGE);
}
local_data_file_version= share->data_file_version;
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 879a17782aa..ef48665d92a 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2004, 2015, Oracle and/or its affiliates.
+ 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
@@ -2943,6 +2944,7 @@ int ha_federated::extra(ha_extra_function operation)
break;
case HA_EXTRA_PREPARE_FOR_DROP:
table_will_be_deleted = TRUE;
+ break;
default:
/* do nothing */
DBUG_PRINT("info",("unhandled operation: %d", (uint) operation));
diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c
index bb5537c9363..431e992e75b 100644
--- a/storage/heap/hp_create.c
+++ b/storage/heap/hp_create.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, SkySQL Ab.
+ Copyright (c) 2010, 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
@@ -94,7 +94,7 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info,
case HA_KEYTYPE_VARBINARY1:
/* Case-insensitiveness is handled in coll->hash_sort */
keyinfo->seg[j].type= HA_KEYTYPE_VARTEXT1;
- /* fall_through */
+ /* fall through */
case HA_KEYTYPE_VARTEXT1:
keyinfo->flag|= HA_VAR_LENGTH_KEY;
length+= 2;
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index aa24cb5d423..3bef25e945c 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -2813,18 +2813,21 @@ btr_cur_ins_lock_and_undo(
}
if (err != DB_SUCCESS
+ || !(~flags | (BTR_NO_UNDO_LOG_FLAG | BTR_KEEP_SYS_FLAG))
|| !dict_index_is_clust(index) || dict_index_is_ibuf(index)) {
return(err);
}
- err = trx_undo_report_row_operation(flags, TRX_UNDO_INSERT_OP,
- thr, index, entry,
- NULL, 0, NULL, NULL,
- &roll_ptr);
- if (err != DB_SUCCESS) {
-
- return(err);
+ if (flags & BTR_NO_UNDO_LOG_FLAG) {
+ roll_ptr = 0;
+ } else {
+ err = trx_undo_report_row_operation(thr, index, entry,
+ NULL, 0, NULL, NULL,
+ &roll_ptr);
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
}
/* Now we can fill in the roll ptr field in entry */
@@ -2884,15 +2887,17 @@ btr_cur_optimistic_insert(
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
- mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
+ mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction;
if this function returns DB_SUCCESS on
a leaf page of a secondary index in a
@@ -2912,6 +2917,7 @@ btr_cur_optimistic_insert(
ulint rec_size;
dberr_t err;
+ ut_ad(thr || !(~flags & (BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG)));
*big_rec = NULL;
block = btr_cur_get_block(cursor);
@@ -3147,15 +3153,17 @@ btr_cur_pessimistic_insert(
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
dict_index_t* index = cursor->index;
@@ -3166,6 +3174,7 @@ btr_cur_pessimistic_insert(
ulint n_reserved = 0;
ut_ad(dtuple_check_typed(entry));
+ ut_ad(thr || !(~flags & (BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG)));
*big_rec = NULL;
@@ -3353,9 +3362,10 @@ btr_cur_upd_lock_and_undo(
/* Append the info about the update in the undo log */
- return(trx_undo_report_row_operation(
- flags, TRX_UNDO_MODIFY_OP, thr,
- index, NULL, update,
+ return((flags & BTR_NO_UNDO_LOG_FLAG)
+ ? DB_SUCCESS
+ : trx_undo_report_row_operation(
+ thr, index, NULL, update,
cmpl_info, rec, offsets, roll_ptr));
}
@@ -4069,12 +4079,12 @@ btr_cur_pessimistic_update(
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
mem_heap_t* entry_heap,
/*!< in/out: memory heap for allocating
big_rec and the index tuple */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or NULL */
+ be stored externally by the caller */
upd_t* update, /*!< in/out: update vector; this is allowed to
also contain trx id and roll ptr fields.
Non-updated columns that are moved offpage will
@@ -4601,7 +4611,6 @@ undo log record created.
dberr_t
btr_cur_del_mark_set_clust_rec(
/*===========================*/
- ulint flags, /*!< in: undo logging and locking flags */
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
@@ -4637,8 +4646,8 @@ btr_cur_del_mark_set_clust_rec(
return(err);
}
- err = trx_undo_report_row_operation(flags, TRX_UNDO_MODIFY_OP, thr,
- index, entry, NULL, 0, rec, offsets,
+ err = trx_undo_report_row_operation(thr, index,
+ entry, NULL, 0, rec, offsets,
&roll_ptr);
if (err != DB_SUCCESS) {
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index ce417b1e511..b668845e3a4 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -5875,18 +5875,15 @@ fil_iterate(
ut_ad(!srv_read_only_mode);
- /* For old style compressed tables we do a lot of useless copying
- for non-index pages. Unfortunately, it is required by
- buf_zip_decompress() */
-
- ulint read_type = IORequest::READ;
- ulint write_type = IORequest::WRITE;
+ /* TODO: For compressed tables we do a lot of useless
+ copying for non-index pages. Unfortunately, it is
+ required by buf_zip_decompress() */
+ const bool row_compressed
+ = callback.get_page_size().is_compressed();
for (offset = iter.start; offset < iter.end; offset += n_bytes) {
byte* io_buffer = iter.io_buffer;
- const bool row_compressed
- = callback.get_page_size().is_compressed();
block->frame = io_buffer;
@@ -5906,8 +5903,6 @@ fil_iterate(
/* Zip IO is done in the compressed page buffer. */
io_buffer = block->page.zip.data;
- } else {
- io_buffer = iter.io_buffer;
}
/* We have to read the exact number of bytes. Otherwise the
@@ -5920,22 +5915,14 @@ fil_iterate(
ut_ad(n_bytes > 0);
ut_ad(!(n_bytes % iter.page_size));
- dberr_t err = DB_SUCCESS;
- IORequest read_request(read_type);
-
- byte* readptr = io_buffer;
- byte* writeptr = io_buffer;
- bool encrypted = false;
-
+ const bool encrypted = iter.crypt_data != NULL
+ && iter.crypt_data->should_encrypt();
/* Use additional crypt io buffer if tablespace is encrypted */
- if (iter.crypt_data != NULL && iter.crypt_data->should_encrypt()) {
-
- encrypted = true;
- readptr = iter.crypt_io_buffer;
- writeptr = iter.crypt_io_buffer;
- }
-
- err = os_file_read(
+ byte* const readptr = encrypted
+ ? iter.crypt_io_buffer : io_buffer;
+ byte* const writeptr = readptr;
+ IORequest read_request(IORequest::READ);
+ dberr_t err = os_file_read(
read_request, iter.file, readptr, offset,
(ulint) n_bytes);
@@ -5960,9 +5947,9 @@ fil_iterate(
ulint page_type = mach_read_from_2(src+FIL_PAGE_TYPE);
- bool page_compressed =
- (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
- || page_type == FIL_PAGE_PAGE_COMPRESSED);
+ const bool page_compressed
+ = page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
+ || page_type == FIL_PAGE_PAGE_COMPRESSED;
/* If tablespace is encrypted, we need to decrypt
the page. Note that tablespaces are not in
@@ -6107,7 +6094,7 @@ fil_iterate(
block->frame += iter.page_size;
}
- IORequest write_request(write_type);
+ IORequest write_request(IORequest::WRITE);
/* A page was updated in the set, write back to disk.
Note: We don't have the compression algorithm, we write
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index cb3e50745a7..b2b13ed4444 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -155,7 +155,6 @@ fil_compress_page(
switch(comp_method) {
#ifdef HAVE_LZ4
case PAGE_LZ4_ALGORITHM:
-
#ifdef HAVE_LZ4_COMPRESS_DEFAULT
err = LZ4_compress_default((const char *)buf,
(char *)out_buf+header_len, len, write_size);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 495985cb55b..f327ecaa6c6 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2479,25 +2479,16 @@ Thread unsafe, can only be called from the thread owning the THD.
@return SQL statement string */
const char*
innobase_get_stmt_unsafe(
-/*=====================*/
THD* thd,
size_t* length)
{
- LEX_STRING* stmt;
- const char* query=NULL;
-
- stmt = thd ? thd_query_string(thd) : NULL;
- // MySQL 5.7
- //stmt = thd_query_unsafe(thd);
-
- if (stmt && stmt->str) {
+ if (const LEX_STRING *stmt = thd_query_string(thd)) {
*length = stmt->length;
- query = stmt->str;
- } else {
- *length = 0;
+ return stmt->str;
}
- return(query);
+ *length = 0;
+ return NULL;
}
/** Determines the current SQL statement.
@@ -2509,7 +2500,6 @@ into the provided buffer.
@return Length of the SQL statement */
size_t
innobase_get_stmt_safe(
-/*===================*/
THD* thd,
char* buf,
size_t buflen)
@@ -8522,8 +8512,8 @@ ha_innobase::innobase_lock_autoinc(void)
break;
}
}
- /* Fall through to old style locking. */
-
+ /* Use old style locking. */
+ /* fall through */
case AUTOINC_OLD_STYLE_LOCKING:
DBUG_EXECUTE_IF("die_if_autoinc_old_lock_style_used",
ut_ad(0););
@@ -9193,8 +9183,8 @@ calc_row_difference(
}
}
- if (o_len != n_len || (o_len != UNIV_SQL_NULL &&
- 0 != memcmp(o_ptr, n_ptr, o_len))) {
+ if (o_len != n_len || (o_len != 0 && o_len != UNIV_SQL_NULL
+ && 0 != memcmp(o_ptr, n_ptr, o_len))) {
/* The field has changed */
ufield = uvect->fields + n_changed;
@@ -12384,7 +12374,8 @@ create_table_info_t::create_options_are_invalid()
get_row_format_name(row_format));
ret = "ROW_FORMAT";
}
- /* FALLTRHOUGH */
+ /* ROW_FORMAT=DYNAMIC also shuns KEY_BLOCK_SIZE */
+ /* fall through */
case ROW_TYPE_COMPACT:
case ROW_TYPE_REDUNDANT:
if (has_key_block_size) {
@@ -12901,7 +12892,8 @@ index_bad:
break;
}
zip_allowed = false;
- /* fall through to set row_type = DYNAMIC */
+ /* Set ROW_FORMAT = COMPACT */
+ /* fall through */
case ROW_TYPE_NOT_USED:
case ROW_TYPE_FIXED:
case ROW_TYPE_PAGE:
@@ -12909,6 +12901,7 @@ index_bad:
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: assuming ROW_FORMAT=DYNAMIC.");
+ /* fall through */
case ROW_TYPE_DYNAMIC:
innodb_row_format = REC_FORMAT_DYNAMIC;
break;
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index a5e9c533fb0..8412f5ab53d 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -656,14 +656,11 @@ and returns true.
@return true if the index name matches the reserved name */
bool
innobase_index_name_is_reserved(
- THD* thd, /*!< in/out: MySQL connection */
- const KEY* key_info, /*!< in: Indexes to be
- created */
- ulint num_of_keys) /*!< in: Number of indexes to
- be created. */
- MY_ATTRIBUTE((warn_unused_result));
-
-extern const char reserved_file_per_table_space_name[];
+ THD* thd, /*!< in/out: MySQL connection */
+ const KEY* key_info, /*!< in: Indexes to be created */
+ ulint num_of_keys) /*!< in: Number of indexes to
+ be created. */
+ MY_ATTRIBUTE((nonnull(1), warn_unused_result));
#ifdef WITH_WSREP
//extern "C" int wsrep_trx_is_aborting(void *thd_ptr);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index d511214dcdd..e88a3554074 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -2830,10 +2830,10 @@ online_retry_drop_indexes_with_trx(
@param drop_fk constraints being dropped
@param n_drop_fk number of constraints that are being dropped
@return whether the constraint is being dropped */
-inline MY_ATTRIBUTE((warn_unused_result))
+MY_ATTRIBUTE((pure, nonnull(1), warn_unused_result))
+inline
bool
innobase_dropping_foreign(
-/*======================*/
const dict_foreign_t* foreign,
dict_foreign_t** drop_fk,
ulint n_drop_fk)
@@ -2857,10 +2857,10 @@ column that is being dropped or modified to NOT NULL.
@retval true Not allowed (will call my_error())
@retval false Allowed
*/
-static MY_ATTRIBUTE((warn_unused_result))
+MY_ATTRIBUTE((pure, nonnull(1,4), warn_unused_result))
+static
bool
innobase_check_foreigns_low(
-/*========================*/
const dict_table_t* user_table,
dict_foreign_t** drop_fk,
ulint n_drop_fk,
@@ -2957,10 +2957,10 @@ column that is being dropped or modified to NOT NULL.
@retval true Not allowed (will call my_error())
@retval false Allowed
*/
-static MY_ATTRIBUTE((warn_unused_result))
+MY_ATTRIBUTE((pure, nonnull(1,2,3,4), warn_unused_result))
+static
bool
innobase_check_foreigns(
-/*====================*/
Alter_inplace_info* ha_alter_info,
const TABLE* altered_table,
const TABLE* old_table,
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index b423e6eccbc..36ecc0b8a29 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 2007, 2016, Oracle and/or its affiliates.
-Copyrigth (c) 2014, 2017, MariaDB Corporation
+Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2014, 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
@@ -2971,14 +2971,16 @@ i_s_fts_deleted_generic_fill(
fields = table->field;
+ int ret = 0;
+
for (ulint j = 0; j < ib_vector_size(deleted->doc_ids); ++j) {
doc_id_t doc_id;
doc_id = *(doc_id_t*) ib_vector_get_const(deleted->doc_ids, j);
- OK(fields[I_S_FTS_DOC_ID]->store(doc_id, true));
+ BREAK_IF(ret = fields[I_S_FTS_DOC_ID]->store(doc_id, true));
- OK(schema_table_store_record(thd, table));
+ BREAK_IF(ret = schema_table_store_record(thd, table));
}
trx_free_for_background(trx);
@@ -2989,7 +2991,7 @@ i_s_fts_deleted_generic_fill(
rw_lock_s_unlock(dict_operation_lock);
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -3229,13 +3231,13 @@ i_s_fts_index_cache_fill_one_index(
/*===============================*/
fts_index_cache_t* index_cache, /*!< in: FTS index cache */
THD* thd, /*!< in: thread */
+ fts_string_t* conv_str, /*!< in/out: buffer */
TABLE_LIST* tables) /*!< in/out: tables to fill */
{
TABLE* table = (TABLE*) tables->table;
Field** fields;
CHARSET_INFO* index_charset;
const ib_rbt_node_t* rbt_node;
- fts_string_t conv_str;
uint dummy_errors;
char* word_str;
@@ -3244,10 +3246,9 @@ i_s_fts_index_cache_fill_one_index(
fields = table->field;
index_charset = index_cache->charset;
- conv_str.f_len = system_charset_info->mbmaxlen
- * FTS_MAX_WORD_LEN_IN_CHAR;
- conv_str.f_str = static_cast<byte*>(ut_malloc_nokey(conv_str.f_len));
- conv_str.f_n_char = 0;
+ conv_str->f_n_char = 0;
+
+ int ret = 0;
/* Go through each word in the index cache */
for (rbt_node = rbt_first(index_cache->words);
@@ -3259,16 +3260,16 @@ i_s_fts_index_cache_fill_one_index(
/* Convert word from index charset to system_charset_info */
if (index_charset->cset != system_charset_info->cset) {
- conv_str.f_n_char = my_convert(
- reinterpret_cast<char*>(conv_str.f_str),
- static_cast<uint32>(conv_str.f_len),
+ conv_str->f_n_char = my_convert(
+ reinterpret_cast<char*>(conv_str->f_str),
+ static_cast<uint32>(conv_str->f_len),
system_charset_info,
reinterpret_cast<char*>(word->text.f_str),
static_cast<uint32>(word->text.f_len),
index_charset, &dummy_errors);
- ut_ad(conv_str.f_n_char <= conv_str.f_len);
- conv_str.f_str[conv_str.f_n_char] = 0;
- word_str = reinterpret_cast<char*>(conv_str.f_str);
+ ut_ad(conv_str->f_n_char <= conv_str->f_len);
+ conv_str->f_str[conv_str->f_n_char] = 0;
+ word_str = reinterpret_cast<char*>(conv_str->f_str);
} else {
word_str = reinterpret_cast<char*>(word->text.f_str);
}
@@ -3326,9 +3327,7 @@ i_s_fts_index_cache_fill_one_index(
}
}
- ut_free(conv_str.f_str);
-
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
Fill the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED
@@ -3372,18 +3371,27 @@ i_s_fts_index_cache_fill(
ut_a(cache);
+ int ret = 0;
+ fts_string_t conv_str;
+ conv_str.f_len = system_charset_info->mbmaxlen
+ * FTS_MAX_WORD_LEN_IN_CHAR;
+ conv_str.f_str = static_cast<byte*>(ut_malloc_nokey(conv_str.f_len));
+
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache;
index_cache = static_cast<fts_index_cache_t*> (
ib_vector_get(cache->indexes, i));
- i_s_fts_index_cache_fill_one_index(index_cache, thd, tables);
+ BREAK_IF(ret = i_s_fts_index_cache_fill_one_index(
+ index_cache, thd, &conv_str, tables));
}
+ ut_free(conv_str.f_str);
+
dict_table_close(user_table, FALSE, FALSE);
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -3685,8 +3693,6 @@ i_s_fts_index_table_fill_one_fetch(
}
}
- i_s_fts_index_table_free_one_fetch(words);
-
DBUG_RETURN(ret);
}
@@ -3700,12 +3706,12 @@ i_s_fts_index_table_fill_one_index(
/*===============================*/
dict_index_t* index, /*!< in: FTS index */
THD* thd, /*!< in: thread */
+ fts_string_t* conv_str, /*!< in/out: buffer */
TABLE_LIST* tables) /*!< in/out: tables to fill */
{
ib_vector_t* words;
mem_heap_t* heap;
CHARSET_INFO* index_charset;
- fts_string_t conv_str;
dberr_t error;
int ret = 0;
@@ -3718,10 +3724,6 @@ i_s_fts_index_table_fill_one_index(
sizeof(fts_word_t), 256);
index_charset = fts_index_get_charset(index);
- conv_str.f_len = system_charset_info->mbmaxlen
- * FTS_MAX_WORD_LEN_IN_CHAR;
- conv_str.f_str = static_cast<byte*>(ut_malloc_nokey(conv_str.f_len));
- conv_str.f_n_char = 0;
/* Iterate through each auxiliary table as described in
fts_index_selector */
@@ -3759,17 +3761,17 @@ i_s_fts_index_table_fill_one_index(
/* Fill into tables */
ret = i_s_fts_index_table_fill_one_fetch(
- index_charset, thd, tables, words, &conv_str, has_more);
+ index_charset, thd, tables, words, conv_str,
+ has_more);
+ i_s_fts_index_table_free_one_fetch(words);
if (ret != 0) {
- i_s_fts_index_table_free_one_fetch(words);
goto func_exit;
}
} while (has_more);
}
func_exit:
- ut_free(conv_str.f_str);
mem_heap_free(heap);
DBUG_RETURN(ret);
@@ -3811,10 +3813,17 @@ i_s_fts_index_table_fill(
DBUG_RETURN(0);
}
+ int ret = 0;
+ fts_string_t conv_str;
+ conv_str.f_len = system_charset_info->mbmaxlen
+ * FTS_MAX_WORD_LEN_IN_CHAR;
+ conv_str.f_str = static_cast<byte*>(ut_malloc_nokey(conv_str.f_len));
+
for (index = dict_table_get_first_index(user_table);
index; index = dict_table_get_next_index(index)) {
if (index->type & DICT_FTS) {
- i_s_fts_index_table_fill_one_index(index, thd, tables);
+ BREAK_IF(ret = i_s_fts_index_table_fill_one_index(
+ index, thd, &conv_str, tables));
}
}
@@ -3822,7 +3831,9 @@ i_s_fts_index_table_fill(
rw_lock_s_unlock(dict_operation_lock);
- DBUG_RETURN(0);
+ ut_free(conv_str.f_str);
+
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -3988,6 +3999,8 @@ i_s_fts_config_fill(
DBUG_ASSERT(!dict_index_is_online_ddl(index));
}
+ int ret = 0;
+
while (fts_config_key[i]) {
fts_string_t value;
char* key_name;
@@ -4012,13 +4025,14 @@ i_s_fts_config_fill(
ut_free(key_name);
}
- OK(field_store_string(
- fields[FTS_CONFIG_KEY], fts_config_key[i]));
+ BREAK_IF(ret = field_store_string(
+ fields[FTS_CONFIG_KEY], fts_config_key[i]));
- OK(field_store_string(
- fields[FTS_CONFIG_VALUE], (const char*) value.f_str));
+ BREAK_IF(ret = field_store_string(
+ fields[FTS_CONFIG_VALUE],
+ reinterpret_cast<const char*>(value.f_str)));
- OK(schema_table_store_record(thd, table));
+ BREAK_IF(ret = schema_table_store_record(thd, table));
i++;
}
@@ -4031,7 +4045,7 @@ i_s_fts_config_fill(
rw_lock_s_unlock(dict_operation_lock);
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -4889,15 +4903,14 @@ i_s_innodb_buffer_page_fill(
i_s_page_type[page_info->page_type].type_str));
OK(fields[IDX_BUFFER_PAGE_FLUSH_TYPE]->store(
- page_info->flush_type));
+ page_info->flush_type, true));
OK(fields[IDX_BUFFER_PAGE_FIX_COUNT]->store(
- page_info->fix_count));
+ page_info->fix_count, true));
#ifdef BTR_CUR_HASH_ADAPT
- OK(field_store_string(
- fields[IDX_BUFFER_PAGE_HASHED],
- page_info->hashed ? "YES" : "NO"));
+ OK(field_store_string(fields[IDX_BUFFER_PAGE_HASHED],
+ page_info->hashed ? "YES" : "NO"));
#endif /* BTR_CUR_HASH_ADAPT */
OK(fields[IDX_BUFFER_PAGE_NEWEST_MOD]->store(
@@ -4907,7 +4920,7 @@ i_s_innodb_buffer_page_fill(
page_info->oldest_mod, true));
OK(fields[IDX_BUFFER_PAGE_ACCESS_TIME]->store(
- page_info->access_time));
+ page_info->access_time, true));
fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_null();
@@ -4916,32 +4929,36 @@ i_s_innodb_buffer_page_fill(
/* If this is an index page, fetch the index name
and table name */
if (page_info->page_type == I_S_PAGE_TYPE_INDEX) {
- const dict_index_t* index;
+ bool ret = false;
mutex_enter(&dict_sys->mutex);
- index = dict_index_get_if_in_cache_low(
- page_info->index_id);
-
- if (index) {
+ if (const dict_index_t* index =
+ dict_index_get_if_in_cache_low(
+ page_info->index_id)) {
table_name_end = innobase_convert_name(
table_name, sizeof(table_name),
index->table_name,
strlen(index->table_name),
thd);
- OK(fields[IDX_BUFFER_PAGE_TABLE_NAME]->store(
- table_name,
- uint(table_name_end - table_name),
- system_charset_info));
- fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull();
-
- OK(field_store_index_name(
- fields[IDX_BUFFER_PAGE_INDEX_NAME],
- index->name));
+ ret = fields[IDX_BUFFER_PAGE_TABLE_NAME]
+ ->store(table_name,
+ static_cast<uint>(
+ table_name_end
+ - table_name),
+ system_charset_info)
+ || field_store_index_name(
+ fields
+ [IDX_BUFFER_PAGE_INDEX_NAME],
+ index->name);
}
mutex_exit(&dict_sys->mutex);
+
+ OK(ret);
+
+ fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull();
}
OK(fields[IDX_BUFFER_PAGE_NUM_RECS]->store(
@@ -4991,32 +5008,29 @@ i_s_innodb_buffer_page_fill(
switch (page_info->io_fix) {
case BUF_IO_NONE:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_NONE"));
+ state_str = "IO_NONE";
break;
case BUF_IO_READ:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_READ"));
+ state_str = "IO_READ";
break;
case BUF_IO_WRITE:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_WRITE"));
+ state_str = "IO_WRITE";
break;
case BUF_IO_PIN:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_PIN"));
+ state_str = "IO_PIN";
break;
}
+ OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
+ state_str));
+
OK(field_store_string(fields[IDX_BUFFER_PAGE_IS_OLD],
(page_info->is_old) ? "YES" : "NO"));
OK(fields[IDX_BUFFER_PAGE_FREE_CLOCK]->store(
page_info->freed_page_clock, true));
- if (schema_table_store_record(thd, table)) {
- DBUG_RETURN(1);
- }
+ OK(schema_table_store_record(thd, table));
}
DBUG_RETURN(0);
@@ -5572,17 +5586,10 @@ i_s_innodb_buf_page_lru_fill(
ulint num_page) /*!< in: number of page info
cached */
{
- TABLE* table;
- Field** fields;
- mem_heap_t* heap;
-
DBUG_ENTER("i_s_innodb_buf_page_lru_fill");
- table = tables->table;
-
- fields = table->field;
-
- heap = mem_heap_create(1000);
+ TABLE* table = tables->table;
+ Field** fields = table->field;
/* Iterate through the cached array and fill the I_S table rows */
for (ulint i = 0; i < num_page; i++) {
@@ -5619,9 +5626,8 @@ i_s_innodb_buf_page_lru_fill(
page_info->fix_count, true));
#ifdef BTR_CUR_HASH_ADAPT
- OK(field_store_string(
- fields[IDX_BUF_LRU_PAGE_HASHED],
- page_info->hashed ? "YES" : "NO"));
+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_HASHED],
+ page_info->hashed ? "YES" : "NO"));
#endif /* BTR_CUR_HASH_ADAPT */
OK(fields[IDX_BUF_LRU_PAGE_NEWEST_MOD]->store(
@@ -5640,32 +5646,36 @@ i_s_innodb_buf_page_lru_fill(
/* If this is an index page, fetch the index name
and table name */
if (page_info->page_type == I_S_PAGE_TYPE_INDEX) {
- const dict_index_t* index;
+ bool ret = false;
mutex_enter(&dict_sys->mutex);
- index = dict_index_get_if_in_cache_low(
- page_info->index_id);
-
- if (index) {
+ if (const dict_index_t* index =
+ dict_index_get_if_in_cache_low(
+ page_info->index_id)) {
table_name_end = innobase_convert_name(
table_name, sizeof(table_name),
index->table_name,
strlen(index->table_name),
thd);
- OK(fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->store(
- table_name,
- uint(table_name_end - table_name),
- system_charset_info));
- fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull();
-
- OK(field_store_index_name(
- fields[IDX_BUF_LRU_PAGE_INDEX_NAME],
- index->name));
+ ret = fields[IDX_BUF_LRU_PAGE_TABLE_NAME]
+ ->store(table_name,
+ static_cast<uint>(
+ table_name_end
+ - table_name),
+ system_charset_info)
+ || field_store_index_name(
+ fields
+ [IDX_BUF_LRU_PAGE_INDEX_NAME],
+ index->name);
}
mutex_exit(&dict_sys->mutex);
+
+ OK(ret);
+
+ fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull();
}
OK(fields[IDX_BUF_LRU_PAGE_NUM_RECS]->store(
@@ -5675,8 +5685,8 @@ i_s_innodb_buf_page_lru_fill(
page_info->data_size, true));
OK(fields[IDX_BUF_LRU_PAGE_ZIP_SIZE]->store(
- page_info->zip_ssize ?
- 512 << page_info->zip_ssize : 0, true));
+ page_info->zip_ssize
+ ? 512 << page_info->zip_ssize : 0, true));
state = static_cast<enum buf_page_state>(page_info->page_state);
@@ -5705,35 +5715,31 @@ i_s_innodb_buf_page_lru_fill(
switch (page_info->io_fix) {
case BUF_IO_NONE:
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
- "IO_NONE"));
+ state_str = "IO_NONE";
break;
case BUF_IO_READ:
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
- "IO_READ"));
+ state_str = "IO_READ";
break;
case BUF_IO_WRITE:
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
- "IO_WRITE"));
+ state_str = "IO_WRITE";
+ break;
+ case BUF_IO_PIN:
+ state_str = "IO_PIN";
break;
}
+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
+ state_str));
+
OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IS_OLD],
- (page_info->is_old) ? "YES" : "NO"));
+ page_info->is_old ? "YES" : "NO"));
OK(fields[IDX_BUF_LRU_PAGE_FREE_CLOCK]->store(
page_info->freed_page_clock, true));
- if (schema_table_store_record(thd, table)) {
- mem_heap_free(heap);
- DBUG_RETURN(1);
- }
-
- mem_heap_empty(heap);
+ OK(schema_table_store_record(thd, table));
}
- mem_heap_free(heap);
-
DBUG_RETURN(0);
}
diff --git a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h
index 8d34fbf8fbb..e07fe49f7fa 100644
--- a/storage/innobase/handler/i_s.h
+++ b/storage/innobase/handler/i_s.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyrigth (c) 2014, 2017, MariaDB Corporation
+Copyright (c) 2014, 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
@@ -73,6 +73,8 @@ extern struct st_maria_plugin i_s_innodb_sys_semaphore_waits;
DBUG_RETURN(1); \
}
+#define BREAK_IF(expr) if ((expr)) break
+
#define RETURN_IF_INNODB_NOT_STARTED(plugin_name) \
do { \
if (!srv_was_started) { \
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 014d9f1a1a1..b4cbe7d4480 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -3601,7 +3601,7 @@ fail_exit:
if (mode == BTR_MODIFY_PREV) {
err = btr_cur_optimistic_insert(
- BTR_NO_LOCKING_FLAG,
+ BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG,
cursor, &offsets, &offsets_heap,
ibuf_entry, &ins_rec,
&dummy_big_rec, 0, thr, &mtr);
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index fee7f375cb4..3a98280082f 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -244,15 +244,17 @@ btr_cur_optimistic_insert(
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
- mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
+ mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction;
if this function returns DB_SUCCESS on
a leaf page of a secondary index in a
@@ -279,15 +281,17 @@ btr_cur_pessimistic_insert(
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull(2,3,4,5,6,7,10), warn_unused_result));
/*************************************************************//**
@@ -408,12 +412,12 @@ btr_cur_pessimistic_update(
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
mem_heap_t* entry_heap,
/*!< in/out: memory heap for allocating
big_rec and the index tuple */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or NULL */
+ be stored externally by the caller */
upd_t* update, /*!< in/out: update vector; this is allowed to
also contain trx id and roll ptr fields.
Non-updated columns that are moved offpage will
@@ -434,7 +438,6 @@ undo log record created.
dberr_t
btr_cur_del_mark_set_clust_rec(
/*===========================*/
- ulint flags, /*!< in: undo logging and locking flags */
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic
index 9ec85dfaf50..b5a467455b9 100644
--- a/storage/innobase/include/data0type.ic
+++ b/storage/innobase/include/data0type.ic
@@ -527,7 +527,8 @@ dtype_get_fixed_size_low(
return(len);
}
}
- /* fall through for variable-length charsets */
+ /* Treat as variable-length. */
+ /* Fall through */
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index d8b6cf33675..b2e4d35d71e 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1064,7 +1064,7 @@ fil_ibd_create(
ulint size,
fil_encryption_t mode,
uint32_t key_id)
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull(2), warn_unused_result));
/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic
index 34d375aa1e8..c89e4960480 100644
--- a/storage/innobase/include/mach0data.ic
+++ b/storage/innobase/include/mach0data.ic
@@ -827,13 +827,13 @@ mach_swap_byte_order(
dest += len;
switch (len & 0x7) {
- case 0: *--dest = *from++;
- case 7: *--dest = *from++;
- case 6: *--dest = *from++;
- case 5: *--dest = *from++;
- case 4: *--dest = *from++;
- case 3: *--dest = *from++;
- case 2: *--dest = *from++;
+ case 0: *--dest = *from++; /* fall through */
+ case 7: *--dest = *from++; /* fall through */
+ case 6: *--dest = *from++; /* fall through */
+ case 5: *--dest = *from++; /* fall through */
+ case 4: *--dest = *from++; /* fall through */
+ case 3: *--dest = *from++; /* fall through */
+ case 2: *--dest = *from++; /* fall through */
case 1: *--dest = *from;
}
}
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index 5f754e1f993..c5b7b322fa0 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -164,7 +164,8 @@ page_zip_rec_needs_ext(
ulint n_fields,
const page_size_t& page_size)
{
- ut_ad(rec_size > comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES);
+ ut_ad(rec_size
+ > (comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES));
ut_ad(comp || !page_size.is_compressed());
#if UNIV_PAGE_SIZE_MAX > REC_MAX_DATA_SIZE
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index 50304ce3631..3b4a195735b 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -188,28 +188,28 @@ transaction.
dberr_t
trx_undo_report_row_operation(
/*==========================*/
- ulint flags, /*!< in: if BTR_NO_UNDO_LOG_FLAG bit is
- set, does nothing */
- ulint op_type, /*!< in: TRX_UNDO_INSERT_OP or
- TRX_UNDO_MODIFY_OP */
que_thr_t* thr, /*!< in: query thread */
dict_index_t* index, /*!< in: clustered index */
const dtuple_t* clust_entry, /*!< in: in the case of an insert,
index entry to insert into the
- clustered index, otherwise NULL */
+ clustered index; in updates,
+ may contain a clustered index
+ record tuple that also contains
+ virtual columns of the table;
+ otherwise, NULL */
const upd_t* update, /*!< in: in the case of an update,
the update vector, otherwise NULL */
ulint cmpl_info, /*!< in: compiler info on secondary
index updates */
const rec_t* rec, /*!< in: case of an update or delete
marking, the record in the clustered
- index, otherwise NULL */
+ index; NULL if insert */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
inserted undo log record,
0 if BTR_NO_UNDO_LOG
flag was specified */
- MY_ATTRIBUTE((nonnull(3,4,10), warn_unused_result));
+ MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
/** status bit used for trx_undo_prev_version_build() */
@@ -341,10 +341,6 @@ record */
storage fields: used by purge to
free the external storage */
-/* Operation type flags used in trx_undo_report_row_operation */
-#define TRX_UNDO_INSERT_OP 1U
-#define TRX_UNDO_MODIFY_OP 2U
-
#include "trx0rec.ic"
#endif /* trx0rec_h */
diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic
index 503c9482ea3..16dccb545d8 100644
--- a/storage/innobase/include/ut0rnd.ic
+++ b/storage/innobase/include/ut0rnd.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 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
@@ -217,16 +218,22 @@ ut_fold_binary(
switch (len & 0x7) {
case 7:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 6:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 5:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 4:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 3:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 2:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 1:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
}
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 01ffad772dc..a6caa009ef7 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -795,12 +795,19 @@ lock_reset_lock_and_trx_wait(
const char* stmt2=NULL;
size_t stmt_len;
trx_id_t trx_id = 0;
- stmt = innobase_get_stmt_unsafe(lock->trx->mysql_thd, &stmt_len);
+ stmt = lock->trx->mysql_thd
+ ? innobase_get_stmt_unsafe(
+ lock->trx->mysql_thd, &stmt_len)
+ : NULL;
if (lock->trx->lock.wait_lock &&
lock->trx->lock.wait_lock->trx) {
trx_id = lock->trx->lock.wait_lock->trx->id;
- stmt2 = innobase_get_stmt_unsafe(lock->trx->lock.wait_lock->trx->mysql_thd, &stmt_len);
+ stmt2 = lock->trx->lock.wait_lock->trx->mysql_thd
+ ? innobase_get_stmt_unsafe(
+ lock->trx->lock.wait_lock
+ ->trx->mysql_thd, &stmt_len)
+ : NULL;
}
ib::error() <<
@@ -5054,8 +5061,6 @@ lock_rec_unlock(
lock_t* first_lock;
lock_t* lock;
ulint heap_no;
- const char* stmt;
- size_t stmt_len;
ut_ad(trx);
ut_ad(rec);
@@ -5083,13 +5088,15 @@ lock_rec_unlock(
lock_mutex_exit();
trx_mutex_exit(trx);
- stmt = innobase_get_stmt_unsafe(trx->mysql_thd, &stmt_len);
-
{
ib::error err;
err << "Unlock row could not find a " << lock_mode
<< " mode lock on the record. Current statement: ";
- err.write(stmt, stmt_len);
+ size_t stmt_len;
+ if (const char* stmt = innobase_get_stmt_unsafe(
+ trx->mysql_thd, &stmt_len)) {
+ err.write(stmt, stmt_len);
+ }
}
return;
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index 26bb12e8a03..c78df489179 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -1354,8 +1354,10 @@ rec_convert_dtuple_to_rec_comp(
}
}
- memcpy(end, dfield_get_data(field), len);
- end += len;
+ if (len) {
+ memcpy(end, dfield_get_data(field), len);
+ end += len;
+ }
}
if (!num_v) {
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index a2773baa34e..82e17c6fb0a 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1926,6 +1926,7 @@ PageConverter::update_page(
case FIL_PAGE_TYPE_XDES:
err = set_current_xdes(
block->page.id.page_no(), get_frame(block));
+ /* fall through */
case FIL_PAGE_INODE:
case FIL_PAGE_TYPE_TRX_SYS:
case FIL_PAGE_IBUF_FREE_LIST:
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 74a85b23aca..4d13051c985 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -2277,18 +2277,14 @@ for a clustered index!
@retval DB_SUCCESS if no error
@retval DB_DUPLICATE_KEY if error,
@retval DB_LOCK_WAIT if we have to wait for a lock on a possible duplicate
-record
-@retval DB_SUCCESS_LOCKED_REC if an exact match of the record was found
-in online table rebuild (flags & (BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG)) */
+record */
static MY_ATTRIBUTE((nonnull, warn_unused_result))
dberr_t
row_ins_duplicate_error_in_clust(
-/*=============================*/
ulint flags, /*!< in: undo logging and locking flags */
btr_cur_t* cursor, /*!< in: B-tree cursor */
const dtuple_t* entry, /*!< in: entry to insert */
- que_thr_t* thr, /*!< in: query thread */
- mtr_t* mtr) /*!< in: mtr */
+ que_thr_t* thr) /*!< in: query thread */
{
dberr_t err;
rec_t* rec;
@@ -2299,8 +2295,6 @@ row_ins_duplicate_error_in_clust(
ulint* offsets = offsets_;
rec_offs_init(offsets_);
- UT_NOT_USED(mtr);
-
ut_ad(dict_index_is_clust(cursor->index));
/* NOTE: For unique non-clustered indexes there may be any number
@@ -2662,7 +2656,7 @@ row_ins_clust_index_entry_low(
DB_LOCK_WAIT */
err = row_ins_duplicate_error_in_clust(
- flags, cursor, entry, thr, &mtr);
+ flags, cursor, entry, thr);
}
if (err != DB_SUCCESS) {
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 36ad6cdd3d9..710ac196ef7 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -2038,6 +2038,7 @@ row_log_table_apply_update(
When applying the subsequent ROW_T_DELETE, no matching
record will be found. */
+ /* fall through */
case DB_SUCCESS:
ut_ad(row != NULL);
break;
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 4db99024c9c..4230020d12b 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -5082,12 +5082,10 @@ loop:
case DB_INTERRUPTED:
goto func_exit;
default:
- {
- const char* doing = "CHECK TABLE";
- ib::warn() << doing << " on index " << index->name << " of"
+ ib::warn() << "CHECK TABLE on index " << index->name << " of"
" table " << index->table->name << " returned " << ret;
- /* fall through (this error is ignored by CHECK TABLE) */
- }
+ /* (this error is ignored by CHECK TABLE) */
+ /* fall through */
case DB_END_OF_INDEX:
ret = DB_SUCCESS;
func_exit:
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 905a5b297a3..86a9e1259ac 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -537,8 +537,9 @@ row_purge_remove_sec_if_poss_leaf(
success = false;
}
}
- /* fall through (the index entry is still needed,
+ /* (The index entry is still needed,
or the deletion succeeded) */
+ /* fall through */
case ROW_NOT_DELETED_REF:
/* The index entry is still needed. */
case ROW_BUFFERED:
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 18ea3cf3cf8..16cbda1cc2b 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -2603,7 +2603,6 @@ static MY_ATTRIBUTE((nonnull, warn_unused_result))
dberr_t
row_upd_clust_rec_by_insert(
/*========================*/
- ulint flags, /*!< in: undo logging and locking flags */
upd_node_t* node, /*!< in/out: row update node */
dict_index_t* index, /*!< in: clustered index of the record */
que_thr_t* thr, /*!< in: query thread */
@@ -2672,7 +2671,7 @@ row_upd_clust_rec_by_insert(
}
err = btr_cur_del_mark_set_clust_rec(
- flags, btr_cur_get_block(btr_cur), rec, index, offsets,
+ btr_cur_get_block(btr_cur), rec, index, offsets,
thr, node->row, mtr);
if (err != DB_SUCCESS) {
err_exit:
@@ -2913,7 +2912,6 @@ static MY_ATTRIBUTE((nonnull, warn_unused_result))
dberr_t
row_upd_del_mark_clust_rec(
/*=======================*/
- ulint flags, /*!< in: undo logging and locking flags */
upd_node_t* node, /*!< in: row update node */
dict_index_t* index, /*!< in: clustered index */
ulint* offsets,/*!< in/out: rec_get_offsets() for the
@@ -2951,7 +2949,7 @@ row_upd_del_mark_clust_rec(
rec = btr_cur_get_rec(btr_cur);
err = btr_cur_del_mark_set_clust_rec(
- flags, btr_cur_get_block(btr_cur), rec,
+ btr_cur_get_block(btr_cur), rec,
index, offsets, thr, node->row, mtr);
if (err == DB_SUCCESS && referenced) {
@@ -3020,7 +3018,6 @@ row_upd_clust_step(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets;
ibool referenced;
- ulint flags;
ibool foreign = FALSE;
trx_t* trx = thr_get_trx(thr);
@@ -3046,11 +3043,10 @@ row_upd_clust_step(
server or connection lifetime and so REDO information is not needed
on restart for recovery.
Disable locking as temp-tables are not shared across connection. */
- if (dict_table_is_temporary(index->table)) {
- flags = BTR_NO_LOCKING_FLAG;
+ const ulint flags = dict_table_is_temporary(index->table)
+ ? BTR_NO_LOCKING_FLAG : 0;
+ if (flags) {
mtr.set_log_mode(MTR_LOG_NO_REDO);
- } else {
- flags = 0;
}
/* If the restoration does not succeed, then the same
@@ -3118,9 +3114,9 @@ row_upd_clust_step(
offsets = rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap);
- if (!node->has_clust_rec_x_lock) {
+ if (!flags && !node->has_clust_rec_x_lock) {
err = lock_clust_rec_modify_check_and_lock(
- flags, btr_pcur_get_block(pcur),
+ 0, btr_pcur_get_block(pcur),
rec, index, offsets, thr);
if (err != DB_SUCCESS) {
mtr_commit(&mtr);
@@ -3136,7 +3132,7 @@ row_upd_clust_step(
if (node->is_delete) {
err = row_upd_del_mark_clust_rec(
- flags, node, index, offsets, thr, referenced, foreign, &mtr);
+ node, index, offsets, thr, referenced, foreign, &mtr);
if (err == DB_SUCCESS) {
node->state = UPD_NODE_UPDATE_ALL_SEC;
@@ -3182,7 +3178,7 @@ row_upd_clust_step(
externally! */
err = row_upd_clust_rec_by_insert(
- flags, node, index, thr, referenced, foreign, &mtr);
+ node, index, thr, referenced, foreign, &mtr);
if (err != DB_SUCCESS) {
goto exit_func;
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index e6fa0aa502c..51d3abb2baa 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -539,16 +539,16 @@ UNIV_INTERN ulong srv_buf_dump_status_frequency;
/** Acquire the system_mutex. */
#define srv_sys_mutex_enter() do { \
- mutex_enter(&srv_sys->mutex); \
+ mutex_enter(&srv_sys.mutex); \
} while (0)
/** Test if the system mutex is owned. */
-#define srv_sys_mutex_own() (mutex_own(&srv_sys->mutex) \
+#define srv_sys_mutex_own() (mutex_own(&srv_sys.mutex) \
&& !srv_read_only_mode)
/** Release the system mutex. */
#define srv_sys_mutex_exit() do { \
- mutex_exit(&srv_sys->mutex); \
+ mutex_exit(&srv_sys.mutex); \
} while (0)
#define fetch_lock_wait_timeout(trx) \
@@ -640,7 +640,7 @@ struct srv_sys_t{
ulint n_sys_threads; /*!< size of the sys_threads
array */
- srv_slot_t* sys_threads; /*!< server thread table;
+ srv_slot_t sys_threads[32 + 1]; /*!< server thread table;
os_event_set() and
os_event_reset() on
sys_threads[]->event are
@@ -657,7 +657,7 @@ struct srv_sys_t{
activity */
};
-static srv_sys_t* srv_sys;
+static srv_sys_t srv_sys;
/** Event to signal srv_monitor_thread. Not protected by a mutex.
Set after setting srv_print_innodb_monitor. */
@@ -682,10 +682,10 @@ and/or load it during startup. */
char srv_buffer_pool_dump_at_shutdown = TRUE;
char srv_buffer_pool_load_at_startup = TRUE;
-/** Slot index in the srv_sys->sys_threads array for the purge thread. */
+/** Slot index in the srv_sys.sys_threads array for the purge thread. */
static const ulint SRV_PURGE_SLOT = 1;
-/** Slot index in the srv_sys->sys_threads array for the master thread. */
+/** Slot index in the srv_sys.sys_threads array for the master thread. */
static const ulint SRV_MASTER_SLOT = 0;
#ifdef HAVE_PSI_STAGE_INTERFACE
@@ -825,21 +825,21 @@ srv_reserve_slot(
switch (type) {
case SRV_MASTER:
- slot = &srv_sys->sys_threads[SRV_MASTER_SLOT];
+ slot = &srv_sys.sys_threads[SRV_MASTER_SLOT];
break;
case SRV_PURGE:
- slot = &srv_sys->sys_threads[SRV_PURGE_SLOT];
+ slot = &srv_sys.sys_threads[SRV_PURGE_SLOT];
break;
case SRV_WORKER:
/* Find an empty slot, skip the master and purge slots. */
- for (slot = &srv_sys->sys_threads[2];
+ for (slot = &srv_sys.sys_threads[2];
slot->in_use;
++slot) {
- ut_a(slot < &srv_sys->sys_threads[
- srv_sys->n_sys_threads]);
+ ut_a(slot < &srv_sys.sys_threads[
+ srv_sys.n_sys_threads]);
}
break;
@@ -855,7 +855,7 @@ srv_reserve_slot(
ut_ad(srv_slot_get_type(slot) == type);
- my_atomic_addlint(&srv_sys->n_threads_active[type], 1);
+ my_atomic_addlint(&srv_sys.n_threads_active[type], 1);
srv_sys_mutex_exit();
@@ -885,13 +885,13 @@ srv_suspend_thread_low(
case SRV_MASTER:
/* We have only one master thread and it
should be the first entry always. */
- ut_a(srv_sys->n_threads_active[type] == 1);
+ ut_a(srv_sys.n_threads_active[type] == 1);
break;
case SRV_PURGE:
/* We have only one purge coordinator thread
and it should be the second entry always. */
- ut_a(srv_sys->n_threads_active[type] == 1);
+ ut_a(srv_sys.n_threads_active[type] == 1);
break;
case SRV_WORKER:
@@ -902,7 +902,7 @@ srv_suspend_thread_low(
ut_a(!slot->suspended);
slot->suspended = TRUE;
- if (my_atomic_addlint(&srv_sys->n_threads_active[type], -1) < 0) {
+ if (my_atomic_addlint(&srv_sys.n_threads_active[type], -1) < 0) {
ut_error;
}
@@ -959,7 +959,7 @@ srv_resume_thread(srv_slot_t* slot, int64_t sig_count = 0, bool wait = true,
ut_ad(slot->suspended);
slot->suspended = FALSE;
- my_atomic_addlint(&srv_sys->n_threads_active[slot->type], 1);
+ my_atomic_addlint(&srv_sys.n_threads_active[slot->type], 1);
srv_sys_mutex_exit();
return(timeout);
}
@@ -981,8 +981,8 @@ srv_release_threads(enum srv_thread_type type, ulint n)
srv_sys_mutex_enter();
- for (ulint i = 0; i < srv_sys->n_sys_threads; i++) {
- srv_slot_t* slot = &srv_sys->sys_threads[i];
+ for (ulint i = 0; i < srv_sys.n_sys_threads; i++) {
+ srv_slot_t* slot = &srv_sys.sys_threads[i];
if (!slot->in_use || srv_slot_get_type(slot) != type) {
continue;
@@ -1002,7 +1002,7 @@ srv_release_threads(enum srv_thread_type type, ulint n)
should be the first entry always. */
ut_a(n == 1);
ut_a(i == SRV_MASTER_SLOT);
- ut_a(srv_sys->n_threads_active[type] == 0);
+ ut_a(srv_sys.n_threads_active[type] == 0);
break;
case SRV_PURGE:
@@ -1011,12 +1011,12 @@ srv_release_threads(enum srv_thread_type type, ulint n)
ut_a(n == 1);
ut_a(i == SRV_PURGE_SLOT);
ut_a(srv_n_purge_threads > 0);
- ut_a(srv_sys->n_threads_active[type] == 0);
+ ut_a(srv_sys.n_threads_active[type] == 0);
break;
case SRV_WORKER:
ut_a(srv_n_purge_threads > 1);
- ut_a(srv_sys->n_threads_active[type]
+ ut_a(srv_sys.n_threads_active[type]
< srv_n_purge_threads - 1);
break;
}
@@ -1052,32 +1052,19 @@ static
void
srv_init()
{
- ulint n_sys_threads = 0;
- ulint srv_sys_sz = sizeof(*srv_sys);
-
mutex_create(LATCH_ID_SRV_INNODB_MONITOR, &srv_innodb_monitor_mutex);
- if (!srv_read_only_mode) {
-
- /* Number of purge threads + master thread */
- n_sys_threads = srv_n_purge_threads + 1;
-
- srv_sys_sz += n_sys_threads * sizeof(*srv_sys->sys_threads);
- }
-
- srv_sys = static_cast<srv_sys_t*>(ut_zalloc_nokey(srv_sys_sz));
-
- srv_sys->n_sys_threads = n_sys_threads;
+ srv_sys.n_sys_threads = srv_read_only_mode
+ ? 0
+ : srv_n_purge_threads + 1/* purge coordinator */;
if (!srv_read_only_mode) {
- mutex_create(LATCH_ID_SRV_SYS, &srv_sys->mutex);
+ mutex_create(LATCH_ID_SRV_SYS, &srv_sys.mutex);
- mutex_create(LATCH_ID_SRV_SYS_TASKS, &srv_sys->tasks_mutex);
+ mutex_create(LATCH_ID_SRV_SYS_TASKS, &srv_sys.tasks_mutex);
- srv_sys->sys_threads = (srv_slot_t*) &srv_sys[1];
-
- for (ulint i = 0; i < srv_sys->n_sys_threads; ++i) {
- srv_slot_t* slot = &srv_sys->sys_threads[i];
+ for (ulint i = 0; i < srv_sys.n_sys_threads; ++i) {
+ srv_slot_t* slot = &srv_sys.sys_threads[i];
slot->event = os_event_create(0);
@@ -1092,7 +1079,7 @@ srv_init()
buf_flush_event = os_event_create("buf_flush_event");
- UT_LIST_INIT(srv_sys->tasks, &que_thr_t::queue);
+ UT_LIST_INIT(srv_sys.tasks, &que_thr_t::queue);
}
srv_buf_resize_event = os_event_create(0);
@@ -1136,7 +1123,7 @@ void
srv_free(void)
/*==========*/
{
- if (!srv_sys) {
+ if (!srv_buf_resize_event) {
return;
}
@@ -1144,13 +1131,11 @@ srv_free(void)
mutex_free(&page_zip_stat_per_index_mutex);
if (!srv_read_only_mode) {
- mutex_free(&srv_sys->mutex);
- mutex_free(&srv_sys->tasks_mutex);
-
- for (ulint i = 0; i < srv_sys->n_sys_threads; ++i) {
- srv_slot_t* slot = &srv_sys->sys_threads[i];
+ mutex_free(&srv_sys.mutex);
+ mutex_free(&srv_sys.tasks_mutex);
- os_event_destroy(slot->event);
+ for (ulint i = 0; i < srv_sys.n_sys_threads; ++i) {
+ os_event_destroy(srv_sys.sys_threads[i].event);
}
os_event_destroy(srv_error_event);
@@ -1161,18 +1146,11 @@ srv_free(void)
os_event_destroy(srv_buf_resize_event);
-#ifdef UNIV_DEBUG
- os_event_destroy(srv_master_thread_disabled_event);
- srv_master_thread_disabled_event = NULL;
-#endif /* UNIV_DEBUG */
+ ut_d(os_event_destroy(srv_master_thread_disabled_event));
dict_ind_free();
trx_i_s_cache_free(trx_i_s_cache);
-
- ut_free(srv_sys);
-
- srv_sys = 0;
}
/*********************************************************************//**
@@ -2020,7 +1998,7 @@ void
srv_inc_activity_count(void)
/*========================*/
{
- srv_sys->activity_count.inc();
+ srv_sys.activity_count.inc();
}
/**********************************************************************//**
@@ -2041,7 +2019,7 @@ srv_get_active_thread_type(void)
srv_sys_mutex_enter();
for (ulint i = SRV_WORKER; i <= SRV_MASTER; ++i) {
- if (srv_sys->n_threads_active[i] != 0) {
+ if (srv_sys.n_threads_active[i] != 0) {
ret = static_cast<srv_thread_type>(i);
break;
}
@@ -2076,12 +2054,12 @@ srv_active_wake_master_thread_low()
srv_inc_activity_count();
- if (my_atomic_loadlint(&srv_sys->n_threads_active[SRV_MASTER]) == 0) {
+ if (my_atomic_loadlint(&srv_sys.n_threads_active[SRV_MASTER]) == 0) {
srv_slot_t* slot;
srv_sys_mutex_enter();
- slot = &srv_sys->sys_threads[SRV_MASTER_SLOT];
+ slot = &srv_sys.sys_threads[SRV_MASTER_SLOT];
/* Only if the master thread has been started. */
@@ -2101,7 +2079,7 @@ srv_wake_purge_thread_if_not_active()
ut_ad(!srv_sys_mutex_own());
if (purge_sys->state == PURGE_STATE_RUN
- && !my_atomic_loadlint(&srv_sys->n_threads_active[SRV_PURGE])
+ && !my_atomic_loadlint(&srv_sys.n_threads_active[SRV_PURGE])
&& my_atomic_loadlint(&trx_sys->rseg_history_len)) {
srv_release_threads(SRV_PURGE, 1);
@@ -2124,7 +2102,7 @@ ulint
srv_get_activity_count(void)
/*========================*/
{
- return(srv_sys->activity_count);
+ return(srv_sys.activity_count);
}
/*******************************************************************//**
@@ -2135,7 +2113,7 @@ srv_check_activity(
/*===============*/
ulint old_activity_count) /*!< in: old activity count */
{
- return(srv_sys->activity_count != old_activity_count);
+ return(srv_sys.activity_count != old_activity_count);
}
/********************************************************************//**
@@ -2555,7 +2533,7 @@ DECLARE_THREAD(srv_master_thread)(
srv_main_thread_id = os_thread_pf(os_thread_get_curr_id());
slot = srv_reserve_slot(SRV_MASTER);
- ut_a(slot == srv_sys->sys_threads);
+ ut_a(slot == srv_sys.sys_threads);
last_print_time = ut_time();
loop:
@@ -2650,18 +2628,18 @@ srv_task_execute(void)
ut_ad(!srv_read_only_mode);
ut_a(srv_force_recovery < SRV_FORCE_NO_BACKGROUND);
- mutex_enter(&srv_sys->tasks_mutex);
+ mutex_enter(&srv_sys.tasks_mutex);
- if (UT_LIST_GET_LEN(srv_sys->tasks) > 0) {
+ if (UT_LIST_GET_LEN(srv_sys.tasks) > 0) {
- thr = UT_LIST_GET_FIRST(srv_sys->tasks);
+ thr = UT_LIST_GET_FIRST(srv_sys.tasks);
ut_a(que_node_get_type(thr->child) == QUE_NODE_PURGE);
- UT_LIST_REMOVE(srv_sys->tasks, thr);
+ UT_LIST_REMOVE(srv_sys.tasks, thr);
}
- mutex_exit(&srv_sys->tasks_mutex);
+ mutex_exit(&srv_sys.tasks_mutex);
if (thr != NULL) {
@@ -2699,7 +2677,7 @@ DECLARE_THREAD(srv_worker_thread)(
slot = srv_reserve_slot(SRV_WORKER);
ut_a(srv_n_purge_threads > 1);
- ut_a(my_atomic_loadlint(&srv_sys->n_threads_active[SRV_WORKER])
+ ut_a(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER])
< static_cast<lint>(srv_n_purge_threads));
/* We need to ensure that the worker threads exit after the
@@ -3041,11 +3019,11 @@ srv_que_task_enqueue_low(
que_thr_t* thr) /*!< in: query thread */
{
ut_ad(!srv_read_only_mode);
- mutex_enter(&srv_sys->tasks_mutex);
+ mutex_enter(&srv_sys.tasks_mutex);
- UT_LIST_ADD_LAST(srv_sys->tasks, thr);
+ UT_LIST_ADD_LAST(srv_sys.tasks, thr);
- mutex_exit(&srv_sys->tasks_mutex);
+ mutex_exit(&srv_sys.tasks_mutex);
srv_release_threads(SRV_WORKER, 1);
}
@@ -3061,11 +3039,11 @@ srv_get_task_queue_length(void)
ut_ad(!srv_read_only_mode);
- mutex_enter(&srv_sys->tasks_mutex);
+ mutex_enter(&srv_sys.tasks_mutex);
- n_tasks = UT_LIST_GET_LEN(srv_sys->tasks);
+ n_tasks = UT_LIST_GET_LEN(srv_sys.tasks);
- mutex_exit(&srv_sys->tasks_mutex);
+ mutex_exit(&srv_sys.tasks_mutex);
return(n_tasks);
}
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index 47d24b63114..6d3ade289bb 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation
+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
@@ -1839,22 +1839,22 @@ transaction.
dberr_t
trx_undo_report_row_operation(
/*==========================*/
- ulint flags, /*!< in: if BTR_NO_UNDO_LOG_FLAG bit is
- set, does nothing */
- ulint op_type, /*!< in: TRX_UNDO_INSERT_OP or
- TRX_UNDO_MODIFY_OP */
que_thr_t* thr, /*!< in: query thread */
dict_index_t* index, /*!< in: clustered index */
const dtuple_t* clust_entry, /*!< in: in the case of an insert,
index entry to insert into the
- clustered index, otherwise NULL */
+ clustered index; in updates,
+ may contain a clustered index
+ record tuple that also contains
+ virtual columns of the table;
+ otherwise, NULL */
const upd_t* update, /*!< in: in the case of an update,
the update vector, otherwise NULL */
ulint cmpl_info, /*!< in: compiler info on secondary
index updates */
- const rec_t* rec, /*!< in: in case of an update or delete
+ const rec_t* rec, /*!< in: case of an update or delete
marking, the record in the clustered
- index, otherwise NULL */
+ index; NULL if insert */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
inserted undo log record,
@@ -1870,18 +1870,9 @@ trx_undo_report_row_operation(
#endif /* UNIV_DEBUG */
ut_a(dict_index_is_clust(index));
+ ut_ad(!update || rec);
ut_ad(!rec || rec_offs_validate(rec, index, offsets));
ut_ad(!srv_read_only_mode);
- ut_ad(op_type == TRX_UNDO_INSERT_OP || op_type == TRX_UNDO_MODIFY_OP);
- ut_ad((op_type != TRX_UNDO_INSERT_OP)
- || (clust_entry && !update && !rec));
-
- if (flags & BTR_NO_UNDO_LOG_FLAG) {
-
- *roll_ptr = 0;
-
- return(DB_SUCCESS);
- }
trx = thr_get_trx(thr);
@@ -1902,7 +1893,7 @@ trx_undo_report_row_operation(
not listed there. */
trx->mod_tables.insert(index->table);
- pundo = op_type == TRX_UNDO_INSERT_OP
+ pundo = !rec
? &trx->rsegs.m_redo.insert_undo
: &trx->rsegs.m_redo.update_undo;
rseg = trx->rsegs.m_redo.rseg;
@@ -1913,7 +1904,7 @@ trx_undo_report_row_operation(
if (*pundo) {
err = DB_SUCCESS;
- } else if (op_type == TRX_UNDO_INSERT_OP || is_temp) {
+ } else if (!rec || is_temp) {
err = trx_undo_assign_undo(trx, rseg, pundo, TRX_UNDO_INSERT);
} else {
err = trx_undo_assign_undo(trx, rseg, pundo, TRX_UNDO_UPDATE);
@@ -1937,23 +1928,14 @@ trx_undo_report_row_operation(
buf_block_dbg_add_level(undo_block, SYNC_TRX_UNDO_PAGE);
do {
- page_t* undo_page;
- ulint offset;
-
- undo_page = buf_block_get_frame(undo_block);
ut_ad(page_no == undo_block->page.id.page_no());
-
- switch (op_type) {
- case TRX_UNDO_INSERT_OP:
- offset = trx_undo_page_report_insert(
- undo_page, trx, index, clust_entry, &mtr);
- break;
- default:
- ut_ad(op_type == TRX_UNDO_MODIFY_OP);
- offset = trx_undo_page_report_modify(
+ page_t* undo_page = buf_block_get_frame(undo_block);
+ ulint offset = !rec
+ ? trx_undo_page_report_insert(
+ undo_page, trx, index, clust_entry, &mtr)
+ : trx_undo_page_report_modify(
undo_page, trx, index, rec, offsets, update,
cmpl_info, clust_entry, &mtr);
- }
if (UNIV_UNLIKELY(offset == 0)) {
/* The record did not fit on the page. We erase the
@@ -2007,8 +1989,7 @@ trx_undo_report_row_operation(
mutex_exit(&trx->undo_mutex);
*roll_ptr = trx_undo_build_roll_ptr(
- op_type == TRX_UNDO_INSERT_OP,
- rseg->id, page_no, offset);
+ !rec, rseg->id, page_no, offset);
return(DB_SUCCESS);
}
diff --git a/storage/innobase/usr/usr0sess.cc b/storage/innobase/usr/usr0sess.cc
index 85eca604d80..55ce9500e5c 100644
--- a/storage/innobase/usr/usr0sess.cc
+++ b/storage/innobase/usr/usr0sess.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 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
diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c
index 0cf5b2822b1..1db81a0ee1b 100644
--- a/storage/maria/ma_extra.c
+++ b/storage/maria/ma_extra.c
@@ -157,6 +157,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
if (info->s->data_file_type != DYNAMIC_RECORD)
break;
/* Remove read/write cache if dynamic rows */
+ /* fall through */
case HA_EXTRA_NO_CACHE:
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{
@@ -313,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 trough */
+ /* Fall through */
case HA_EXTRA_PREPARE_FOR_RENAME:
{
my_bool do_flush= MY_TEST(function != HA_EXTRA_PREPARE_FOR_DROP);
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 08d306a89be..9f142cb61c9 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -3061,7 +3061,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 trough*/
+ /* Fall through */
case LOGREC_REDO_INSERT_ROW_HEAD:
case LOGREC_REDO_INSERT_ROW_TAIL:
case LOGREC_REDO_PURGE_ROW_HEAD:
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index 3d6049c0172..1487592d2d6 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -150,6 +150,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (info->s->data_file_type != DYNAMIC_RECORD)
break;
/* Remove read/write cache if dynamic rows */
+ /* fall through */
case HA_EXTRA_NO_CACHE:
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{
@@ -262,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 trough */
+ /* Fall through */
case HA_EXTRA_PREPARE_FOR_RENAME:
DBUG_ASSERT(!share->temporary);
mysql_mutex_lock(&THR_LOCK_myisam);
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 531b800c63e..1921926463e 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -29,7 +29,7 @@ static void mi_update_status_with_lock(MI_INFO *info);
int mi_lock_database(MI_INFO *info, int lock_type)
{
- int error;
+ int error, mark_crashed= 0;
uint count;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("mi_lock_database");
@@ -52,6 +52,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
error= 0;
+ DBUG_EXECUTE_IF ("mi_lock_database_failure", error= EINVAL;);
mysql_mutex_lock(&share->intern_lock);
if (share->kfile >= 0) /* May only be false on windows */
{
@@ -75,17 +76,15 @@ int mi_lock_database(MI_INFO *info, int lock_type)
&share->dirty_part_map,
FLUSH_KEEP))
{
- error=my_errno;
+ mark_crashed= error=my_errno;
mi_print_error(info->s, HA_ERR_CRASHED);
- mi_mark_crashed(info); /* Mark that table must be checked */
}
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{
if (end_io_cache(&info->rec_cache))
{
- error=my_errno;
+ mark_crashed= error=my_errno;
mi_print_error(info->s, HA_ERR_CRASHED);
- mi_mark_crashed(info);
}
}
if (!count)
@@ -110,22 +109,19 @@ int mi_lock_database(MI_INFO *info, int lock_type)
share->state.unique= info->last_unique= info->this_unique;
share->state.update_count= info->last_loop= ++info->this_loop;
if (mi_state_info_write(share->kfile, &share->state, 1))
- error=my_errno;
+ mark_crashed= error=my_errno;
share->changed=0;
if (myisam_flush)
{
if (mysql_file_sync(share->kfile, MYF(0)))
- error= my_errno;
+ mark_crashed= error= my_errno;
if (mysql_file_sync(info->dfile, MYF(0)))
- error= my_errno;
+ mark_crashed= error= my_errno;
}
else
share->not_flushed=1;
if (error)
- {
mi_print_error(info->s, HA_ERR_CRASHED);
- mi_mark_crashed(info);
- }
}
if (info->lock_type != F_EXTRA_LCK)
{
@@ -260,6 +256,8 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
#endif
mysql_mutex_unlock(&share->intern_lock);
+ if (mark_crashed)
+ mi_mark_crashed(info);
DBUG_RETURN(error);
} /* mi_lock_database */
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 541ccf62260..650bc93cf67 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -216,7 +216,9 @@ enum ESphGroupBy
SPH_GROUPBY_WEEK = 1, ///< group by week
SPH_GROUPBY_MONTH = 2, ///< group by month
SPH_GROUPBY_YEAR = 3, ///< group by year
- SPH_GROUPBY_ATTR = 4 ///< group by attribute value
+ SPH_GROUPBY_ATTR = 4, ///< group by attribute value
+ SPH_GROUPBY_ATTRPAIR = 5, ///< group by sequential attrs pair (rendered redundant by 64bit attrs support; removed)
+ SPH_GROUPBY_MULTIPLE = 6 ///< group by on multiple attribute values
};
/// known attribute types
@@ -911,7 +913,7 @@ bool sphinx_show_status ( THD * thd )
}
// show last error or warning (either in addition to stats, or on their own)
- if ( pTls && pTls->m_pHeadTable && pTls->m_pHeadTable->m_tStats.m_sLastMessage && pTls->m_pHeadTable->m_tStats.m_sLastMessage[0] )
+ if ( pTls && pTls->m_pHeadTable && pTls->m_pHeadTable->m_tStats.m_sLastMessage[0] )
{
const char * sMessageType = pTls->m_pHeadTable->m_tStats.m_bLastError ? "error" : "warning";
@@ -1563,6 +1565,7 @@ bool CSphSEQuery::ParseField ( char * sField )
{ "month:", SPH_GROUPBY_MONTH },
{ "year:", SPH_GROUPBY_YEAR },
{ "attr:", SPH_GROUPBY_ATTR },
+ { "multi:", SPH_GROUPBY_MULTIPLE }
};
int i;
diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc
index 5b2071b5f1e..bb5711de007 100644
--- a/storage/spider/spd_db_conn.cc
+++ b/storage/spider/spd_db_conn.cc
@@ -1846,8 +1846,8 @@ int spider_db_append_key_where_internal(
#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000
case HA_READ_PREFIX_LAST:
result_list->desc_flg = TRUE;
- /* fall through */
#endif
+ /* fall through */
case HA_READ_KEY_EXACT:
if (sql_kind == SPIDER_SQL_KIND_SQL)
{
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 7724eb067e9..56931f47f24 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -516,7 +516,6 @@ int spider_free_share_alloc(
) {
int roop_count;
DBUG_ENTER("spider_free_share_alloc");
- if (share->dbton_bitmap)
{
for (roop_count = SPIDER_DBTON_SIZE - 1; roop_count >= 0; roop_count--)
{
diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc
index 1ea1ec0696b..ffd7ebc7504 100644
--- a/storage/xtradb/btr/btr0cur.cc
+++ b/storage/xtradb/btr/btr0cur.cc
@@ -1329,18 +1329,21 @@ btr_cur_ins_lock_and_undo(
index, thr, mtr, inherit);
if (err != DB_SUCCESS
+ || !(~flags | (BTR_NO_UNDO_LOG_FLAG | BTR_KEEP_SYS_FLAG))
|| !dict_index_is_clust(index) || dict_index_is_ibuf(index)) {
return(err);
}
- err = trx_undo_report_row_operation(flags, TRX_UNDO_INSERT_OP,
- thr, index, entry,
- NULL, 0, NULL, NULL,
- &roll_ptr);
- if (err != DB_SUCCESS) {
-
- return(err);
+ if (flags & BTR_NO_UNDO_LOG_FLAG) {
+ roll_ptr = 0;
+ } else {
+ err = trx_undo_report_row_operation(thr, index, entry,
+ NULL, 0, NULL, NULL,
+ &roll_ptr);
+ if (err != DB_SUCCESS) {
+ return(err);
+ }
}
/* Now we can fill in the roll ptr field in entry */
@@ -1389,15 +1392,17 @@ btr_cur_optimistic_insert(
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
- mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
+ mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction;
if this function returns DB_SUCCESS on
a leaf page of a secondary index in a
@@ -1418,6 +1423,7 @@ btr_cur_optimistic_insert(
ulint rec_size;
dberr_t err;
+ ut_ad(thr || !(~flags & (BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG)));
*big_rec = NULL;
block = btr_cur_get_block(cursor);
@@ -1427,7 +1433,10 @@ btr_cur_optimistic_insert(
page = buf_block_get_frame(block);
index = cursor->index;
- ut_ad((thr && thr_get_trx(thr)->fake_changes)
+ const bool fake_changes = (~flags & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG))
+ && thr_get_trx(thr)->fake_changes;
+ ut_ad(fake_changes
|| mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(!dict_index_is_online_ddl(index)
|| dict_index_is_clust(index)
@@ -1568,7 +1577,7 @@ fail_err:
goto fail_err;
}
- if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) {
+ if (UNIV_UNLIKELY(fake_changes)) {
/* skip CHANGE, LOG */
*big_rec = big_rec_vec;
return(err); /* == DB_SUCCESS */
@@ -1686,15 +1695,17 @@ btr_cur_pessimistic_insert(
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
dict_index_t* index = cursor->index;
@@ -1706,13 +1717,17 @@ btr_cur_pessimistic_insert(
ulint n_reserved = 0;
ut_ad(dtuple_check_typed(entry));
+ ut_ad(thr || !(~flags & (BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG)));
*big_rec = NULL;
- ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr,
+ const bool fake_changes = (~flags & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG))
+ && thr_get_trx(thr)->fake_changes;
+ ut_ad(fake_changes || mtr_memo_contains(mtr,
dict_index_get_lock(btr_cur_get_index(cursor)),
MTR_MEMO_X_LOCK));
- ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, btr_cur_get_block(cursor),
+ ut_ad(fake_changes || mtr_memo_contains(mtr, btr_cur_get_block(cursor),
MTR_MEMO_PAGE_X_FIX));
ut_ad(!dict_index_is_online_ddl(index)
|| dict_index_is_clust(index)
@@ -1773,7 +1788,7 @@ btr_cur_pessimistic_insert(
}
}
- if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) {
+ if (UNIV_UNLIKELY(fake_changes)) {
/* skip CHANGE, LOG */
if (n_reserved > 0) {
fil_space_release_free_extents(index->space,
@@ -1871,7 +1886,9 @@ btr_cur_upd_lock_and_undo(
const rec_t* rec;
dberr_t err;
- if (UNIV_UNLIKELY(thr_get_trx(thr)->fake_changes)) {
+ ut_ad((thr != NULL) || (flags & BTR_NO_LOCKING_FLAG));
+
+ if (!(flags & BTR_NO_LOCKING_FLAG) && thr_get_trx(thr)->fake_changes) {
/* skip LOCK, UNDO */
return(DB_SUCCESS);
}
@@ -1906,9 +1923,10 @@ btr_cur_upd_lock_and_undo(
/* Append the info about the update in the undo log */
- return(trx_undo_report_row_operation(
- flags, TRX_UNDO_MODIFY_OP, thr,
- index, NULL, update,
+ return((flags & BTR_NO_UNDO_LOG_FLAG)
+ ? DB_SUCCESS
+ : trx_undo_report_row_operation(
+ thr, index, NULL, update,
cmpl_info, rec, offsets, roll_ptr));
}
@@ -2659,12 +2677,12 @@ btr_cur_pessimistic_update(
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
mem_heap_t* entry_heap,
/*!< in/out: memory heap for allocating
big_rec and the index tuple */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or NULL */
+ be stored externally by the caller */
const upd_t* update, /*!< in: update vector; this is allowed also
contain trx id and roll ptr fields, but
the values in update vector have no effect */
@@ -3239,7 +3257,7 @@ btr_cur_del_mark_set_clust_rec(
return(err);
}
- err = trx_undo_report_row_operation(0, TRX_UNDO_MODIFY_OP, thr,
+ err = trx_undo_report_row_operation(thr,
index, NULL, NULL, 0, rec, offsets,
&roll_ptr);
if (err != DB_SUCCESS) {
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index c57dab79ef7..67c265cb827 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1510,8 +1510,6 @@ buf_pool_init_instance(
buf_pool->chunks = chunk =
(buf_chunk_t*) mem_zalloc(sizeof *chunk);
- UT_LIST_INIT(buf_pool->free);
-
if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) {
mem_free(chunk);
mem_free(buf_pool);
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index e39be46840c..f94b8acc715 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -2063,8 +2063,6 @@ fil_init(
fil_system->spaces = hash_create(hash_size);
fil_system->name_hash = hash_create(hash_size);
- UT_LIST_INIT(fil_system->LRU);
-
fil_system->max_n_open = max_n_open;
fil_space_crypt_init();
@@ -2791,14 +2789,12 @@ fil_op_log_parse_or_replay(
} else if (log_flags & MLOG_FILE_FLAG_TEMP) {
/* Temporary table, do nothing */
} else {
- const char* path = NULL;
-
/* Create the database directory for name, if it does
not exist yet */
fil_create_directory_for_tablename(name);
if (fil_create_new_single_table_tablespace(
- space_id, name, path, flags,
+ space_id, name, NULL, flags,
DICT_TF2_USE_TABLESPACE,
FIL_IBD_FILE_INITIAL_SIZE,
FIL_ENCRYPTION_DEFAULT,
@@ -6929,15 +6925,15 @@ fil_iterate(
/* TODO: For compressed tables we do a lot of useless
copying for non-index pages. Unfortunately, it is
required by buf_zip_decompress() */
+ const bool row_compressed = callback.get_zip_size() > 0;
for (offset = iter.start; offset < iter.end; offset += n_bytes) {
byte* io_buffer = iter.io_buffer;
- bool row_compressed = false;
block->frame = io_buffer;
- if (callback.get_zip_size() > 0) {
+ if (row_compressed) {
page_zip_des_init(&block->page.zip);
page_zip_set_size(&block->page.zip, iter.page_size);
block->page.zip.data = block->frame + UNIV_PAGE_SIZE;
@@ -6946,9 +6942,6 @@ fil_iterate(
/* Zip IO is done in the compressed page buffer. */
io_buffer = block->page.zip.data;
- row_compressed = true;
- } else {
- io_buffer = iter.io_buffer;
}
/* We have to read the exact number of bytes. Otherwise the
@@ -6961,16 +6954,12 @@ fil_iterate(
ut_ad(n_bytes > 0);
ut_ad(!(n_bytes % iter.page_size));
- byte* readptr = io_buffer;
- byte* writeptr = io_buffer;
- bool encrypted = false;
-
+ const bool encrypted = iter.crypt_data != NULL
+ && iter.crypt_data->should_encrypt();
/* Use additional crypt io buffer if tablespace is encrypted */
- if (iter.crypt_data != NULL && iter.crypt_data->should_encrypt()) {
- encrypted = true;
- readptr = iter.crypt_io_buffer;
- writeptr = iter.crypt_io_buffer;
- }
+ byte* const readptr = encrypted
+ ? iter.crypt_io_buffer : io_buffer;
+ byte* const writeptr = readptr;
if (!os_file_read(iter.file, readptr, offset, (ulint) n_bytes)) {
@@ -6993,8 +6982,9 @@ fil_iterate(
ulint page_type = mach_read_from_2(src+FIL_PAGE_TYPE);
- bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
- page_type == FIL_PAGE_PAGE_COMPRESSED);
+ const bool page_compressed
+ = page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
+ || page_type == FIL_PAGE_PAGE_COMPRESSED;
/* If tablespace is encrypted, we need to decrypt
the page. Note that tablespaces are not in
diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc
index 8b2449983df..c377c19dd0d 100644
--- a/storage/xtradb/fil/fil0pagecompress.cc
+++ b/storage/xtradb/fil/fil0pagecompress.cc
@@ -163,8 +163,13 @@ fil_compress_page(
switch(comp_method) {
#ifdef HAVE_LZ4
case PAGE_LZ4_ALGORITHM:
+#ifdef HAVE_LZ4_COMPRESS_DEFAULT
+ err = LZ4_compress_default((const char *)buf,
+ (char *)out_buf+header_len, len, write_size);
+#else
err = LZ4_compress_limitedOutput((const char *)buf,
(char *)out_buf+header_len, len, write_size);
+#endif /* HAVE_LZ4_COMPRESS_DEFAULT */
write_size = err;
if (err == 0) {
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 4353bc1d288..cd2d84b4245 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -877,17 +877,6 @@ innobase_purge_changed_page_bitmaps(
ulonglong lsn) __attribute__((unused)); /*!< in: LSN to purge files up to */
-/*****************************************************************//**
-Check whether this is a fake change transaction.
-@return TRUE if a fake change transaction */
-static
-my_bool
-innobase_is_fake_change(
-/*====================*/
- handlerton *hton, /*!< in: InnoDB handlerton */
- THD* thd) __attribute__((unused)); /*!< in: MySQL thread handle of the user for
- whom the transaction is being committed */
-
/** Get the list of foreign keys referencing a specified table
table.
@param thd The thread handle
@@ -2596,16 +2585,11 @@ innobase_get_stmt(
THD* thd, /*!< in: MySQL thread handle */
size_t* length) /*!< out: length of the SQL statement */
{
- const char* query = NULL;
- LEX_STRING *stmt = NULL;
- if (thd) {
- stmt = thd_query_string(thd);
- if (stmt) {
- *length = stmt->length;
- query = stmt->str;
- }
+ if (const LEX_STRING *stmt = thd_query_string(thd)) {
+ *length = stmt->length;
+ return stmt->str;
}
- return (query);
+ return NULL;
}
/**********************************************************************//**
@@ -4609,22 +4593,6 @@ innobase_purge_changed_page_bitmaps(
}
/*****************************************************************//**
-Check whether this is a fake change transaction.
-@return TRUE if a fake change transaction */
-static
-my_bool
-innobase_is_fake_change(
-/*====================*/
- handlerton *hton MY_ATTRIBUTE((unused)),
- /*!< in: InnoDB handlerton */
- THD* thd) /*!< in: MySQL thread handle of the user for
- whom the transaction is being committed */
-{
- trx_t* trx = check_trx_exists(thd);
- return UNIV_UNLIKELY(trx->fake_changes);
-}
-
-/*****************************************************************//**
Commits a transaction in an InnoDB database. */
static
void
@@ -8572,8 +8540,8 @@ ha_innobase::innobase_lock_autoinc(void)
break;
}
}
- /* Fall through to old style locking. */
-
+ /* Use old style locking. */
+ /* fall through */
case AUTOINC_OLD_STYLE_LOCKING:
DBUG_EXECUTE_IF("die_if_autoinc_old_lock_style_used",
ut_ad(0););
@@ -9150,8 +9118,8 @@ calc_row_difference(
}
}
- if (o_len != n_len || (o_len != UNIV_SQL_NULL &&
- 0 != memcmp(o_ptr, n_ptr, o_len))) {
+ if (o_len != n_len || (o_len != 0 && o_len != UNIV_SQL_NULL
+ && 0 != memcmp(o_ptr, n_ptr, o_len))) {
/* The field has changed */
ufield = uvect->fields + n_changed;
@@ -11875,7 +11843,8 @@ create_options_are_invalid(
case ROW_TYPE_DYNAMIC:
CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE(use_tablespace);
CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
- /* fall through since dynamic also shuns KBS */
+ /* ROW_FORMAT=DYNAMIC also shuns KEY_BLOCK_SIZE */
+ /* fall through */
case ROW_TYPE_COMPACT:
case ROW_TYPE_REDUNDANT:
if (kbs_specified) {
@@ -12285,7 +12254,8 @@ index_bad:
break; /* Correct row_format */
}
zip_allowed = FALSE;
- /* fall through to set row_format = COMPACT */
+ /* Set ROW_FORMAT = COMPACT */
+ /* fall through */
case ROW_TYPE_NOT_USED:
case ROW_TYPE_FIXED:
case ROW_TYPE_PAGE:
@@ -12294,6 +12264,7 @@ index_bad:
thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: assuming ROW_FORMAT=COMPACT.");
+ /* fall through */
case ROW_TYPE_DEFAULT:
/* If we fell through, set row format to Compact. */
row_format = ROW_TYPE_COMPACT;
@@ -15078,7 +15049,8 @@ fill_foreign_key_list(THD* thd,
{
ut_ad(mutex_own(&dict_sys->mutex));
- for (dict_foreign_set::iterator it = table->referenced_set.begin();
+ for (dict_foreign_set::const_iterator it
+ = table->referenced_set.begin();
it != table->referenced_set.end(); ++it) {
dict_foreign_t* foreign = *it;
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 62b80c492a1..426136e4d51 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -540,7 +540,7 @@ innobase_index_name_is_reserved(
const KEY* key_info, /*!< in: Indexes to be created */
ulint num_of_keys) /*!< in: Number of indexes to
be created. */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((nonnull(1), warn_unused_result));
/*****************************************************************//**
#ifdef WITH_WSREP
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 898db72be2e..957e23d608a 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -2307,10 +2307,10 @@ online_retry_drop_indexes_with_trx(
@param drop_fk constraints being dropped
@param n_drop_fk number of constraints that are being dropped
@return whether the constraint is being dropped */
-inline MY_ATTRIBUTE((pure, nonnull, warn_unused_result))
+MY_ATTRIBUTE((pure, nonnull(1), warn_unused_result))
+inline
bool
innobase_dropping_foreign(
-/*======================*/
const dict_foreign_t* foreign,
dict_foreign_t** drop_fk,
ulint n_drop_fk)
@@ -2334,10 +2334,10 @@ column that is being dropped or modified to NOT NULL.
@retval true Not allowed (will call my_error())
@retval false Allowed
*/
-static MY_ATTRIBUTE((pure, nonnull, warn_unused_result))
+MY_ATTRIBUTE((pure, nonnull(1,4), warn_unused_result))
+static
bool
innobase_check_foreigns_low(
-/*========================*/
const dict_table_t* user_table,
dict_foreign_t** drop_fk,
ulint n_drop_fk,
@@ -2434,10 +2434,10 @@ column that is being dropped or modified to NOT NULL.
@retval true Not allowed (will call my_error())
@retval false Allowed
*/
-static MY_ATTRIBUTE((pure, nonnull, warn_unused_result))
+MY_ATTRIBUTE((pure, nonnull(1,2,3,4), warn_unused_result))
+static
bool
innobase_check_foreigns(
-/*====================*/
Alter_inplace_info* ha_alter_info,
const TABLE* altered_table,
const TABLE* old_table,
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 086d5642dbb..9cef04c4244 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 2007, 2016, Oracle and/or its affiliates.
-Copyrigth (c) 2014, 2017, MariaDB Corporation
+Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2014, 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
@@ -2966,14 +2966,16 @@ i_s_fts_deleted_generic_fill(
fields = table->field;
+ int ret = 0;
+
for (ulint j = 0; j < ib_vector_size(deleted->doc_ids); ++j) {
doc_id_t doc_id;
doc_id = *(doc_id_t*) ib_vector_get_const(deleted->doc_ids, j);
- OK(fields[I_S_FTS_DOC_ID]->store((longlong) doc_id, true));
+ BREAK_IF(ret = fields[I_S_FTS_DOC_ID]->store(doc_id, true));
- OK(schema_table_store_record(thd, table));
+ BREAK_IF(ret = schema_table_store_record(thd, table));
}
trx_free_for_background(trx);
@@ -2984,7 +2986,7 @@ i_s_fts_deleted_generic_fill(
rw_lock_s_unlock(&dict_operation_lock);
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -3222,13 +3224,13 @@ i_s_fts_index_cache_fill_one_index(
/*===============================*/
fts_index_cache_t* index_cache, /*!< in: FTS index cache */
THD* thd, /*!< in: thread */
+ fts_string_t* conv_str, /*!< in/out: buffer */
TABLE_LIST* tables) /*!< in/out: tables to fill */
{
TABLE* table = (TABLE*) tables->table;
Field** fields;
CHARSET_INFO* index_charset;
const ib_rbt_node_t* rbt_node;
- fts_string_t conv_str;
uint dummy_errors;
char* word_str;
@@ -3237,10 +3239,9 @@ i_s_fts_index_cache_fill_one_index(
fields = table->field;
index_charset = index_cache->charset;
- conv_str.f_len = system_charset_info->mbmaxlen
- * FTS_MAX_WORD_LEN_IN_CHAR;
- conv_str.f_str = static_cast<byte*>(ut_malloc(conv_str.f_len));
- conv_str.f_n_char = 0;
+ conv_str->f_n_char = 0;
+
+ int ret = 0;
/* Go through each word in the index cache */
for (rbt_node = rbt_first(index_cache->words);
@@ -3252,16 +3253,16 @@ i_s_fts_index_cache_fill_one_index(
/* Convert word from index charset to system_charset_info */
if (index_charset->cset != system_charset_info->cset) {
- conv_str.f_n_char = my_convert(
- reinterpret_cast<char*>(conv_str.f_str),
- static_cast<uint32>(conv_str.f_len),
+ conv_str->f_n_char = my_convert(
+ reinterpret_cast<char*>(conv_str->f_str),
+ static_cast<uint32>(conv_str->f_len),
system_charset_info,
reinterpret_cast<char*>(word->text.f_str),
static_cast<uint32>(word->text.f_len),
index_charset, &dummy_errors);
- ut_ad(conv_str.f_n_char <= conv_str.f_len);
- conv_str.f_str[conv_str.f_n_char] = 0;
- word_str = reinterpret_cast<char*>(conv_str.f_str);
+ ut_ad(conv_str->f_n_char <= conv_str->f_len);
+ conv_str->f_str[conv_str->f_n_char] = 0;
+ word_str = reinterpret_cast<char*>(conv_str->f_str);
} else {
word_str = reinterpret_cast<char*>(word->text.f_str);
}
@@ -3319,9 +3320,7 @@ i_s_fts_index_cache_fill_one_index(
}
}
- ut_free(conv_str.f_str);
-
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
Fill the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED
@@ -3365,18 +3364,27 @@ i_s_fts_index_cache_fill(
ut_a(cache);
+ int ret = 0;
+ fts_string_t conv_str;
+ conv_str.f_len = system_charset_info->mbmaxlen
+ * FTS_MAX_WORD_LEN_IN_CHAR;
+ conv_str.f_str = static_cast<byte*>(ut_malloc(conv_str.f_len));
+
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache;
index_cache = static_cast<fts_index_cache_t*> (
ib_vector_get(cache->indexes, i));
- i_s_fts_index_cache_fill_one_index(index_cache, thd, tables);
+ BREAK_IF(ret = i_s_fts_index_cache_fill_one_index(
+ index_cache, thd, &conv_str, tables));
}
+ ut_free(conv_str.f_str);
+
dict_table_close(user_table, FALSE, FALSE);
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -3679,8 +3687,6 @@ i_s_fts_index_table_fill_one_fetch(
}
}
- i_s_fts_index_table_free_one_fetch(words);
-
DBUG_RETURN(ret);
}
@@ -3694,13 +3700,13 @@ i_s_fts_index_table_fill_one_index(
/*===============================*/
dict_index_t* index, /*!< in: FTS index */
THD* thd, /*!< in: thread */
+ fts_string_t* conv_str, /*!< in/out: buffer */
TABLE_LIST* tables) /*!< in/out: tables to fill */
{
ib_vector_t* words;
mem_heap_t* heap;
fts_string_t word;
CHARSET_INFO* index_charset;
- fts_string_t conv_str;
dberr_t error;
int ret = 0;
@@ -3717,10 +3723,6 @@ i_s_fts_index_table_fill_one_index(
word.f_n_char = 0;
index_charset = fts_index_get_charset(index);
- conv_str.f_len = system_charset_info->mbmaxlen
- * FTS_MAX_WORD_LEN_IN_CHAR;
- conv_str.f_str = static_cast<byte*>(ut_malloc(conv_str.f_len));
- conv_str.f_n_char = 0;
/* Iterate through each auxiliary table as described in
fts_index_selector */
@@ -3754,17 +3756,17 @@ i_s_fts_index_table_fill_one_index(
/* Fill into tables */
ret = i_s_fts_index_table_fill_one_fetch(
- index_charset, thd, tables, words, &conv_str, has_more);
+ index_charset, thd, tables, words, conv_str,
+ has_more);
+ i_s_fts_index_table_free_one_fetch(words);
if (ret != 0) {
- i_s_fts_index_table_free_one_fetch(words);
goto func_exit;
}
} while (has_more);
}
func_exit:
- ut_free(conv_str.f_str);
mem_heap_free(heap);
DBUG_RETURN(ret);
@@ -3806,10 +3808,17 @@ i_s_fts_index_table_fill(
DBUG_RETURN(0);
}
+ int ret = 0;
+ fts_string_t conv_str;
+ conv_str.f_len = system_charset_info->mbmaxlen
+ * FTS_MAX_WORD_LEN_IN_CHAR;
+ conv_str.f_str = static_cast<byte*>(ut_malloc(conv_str.f_len));
+
for (index = dict_table_get_first_index(user_table);
index; index = dict_table_get_next_index(index)) {
if (index->type & DICT_FTS) {
- i_s_fts_index_table_fill_one_index(index, thd, tables);
+ BREAK_IF(ret = i_s_fts_index_table_fill_one_index(
+ index, thd, &conv_str, tables));
}
}
@@ -3817,7 +3826,9 @@ i_s_fts_index_table_fill(
rw_lock_s_unlock(&dict_operation_lock);
- DBUG_RETURN(0);
+ ut_free(conv_str.f_str);
+
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -3982,6 +3993,8 @@ i_s_fts_config_fill(
DBUG_ASSERT(!dict_index_is_online_ddl(index));
}
+ int ret = 0;
+
while (fts_config_key[i]) {
fts_string_t value;
char* key_name;
@@ -4006,13 +4019,14 @@ i_s_fts_config_fill(
ut_free(key_name);
}
- OK(field_store_string(
- fields[FTS_CONFIG_KEY], fts_config_key[i]));
+ BREAK_IF(ret = field_store_string(
+ fields[FTS_CONFIG_KEY], fts_config_key[i]));
- OK(field_store_string(
- fields[FTS_CONFIG_VALUE], (const char*) value.f_str));
+ BREAK_IF(ret = field_store_string(
+ fields[FTS_CONFIG_VALUE],
+ reinterpret_cast<const char*>(value.f_str)));
- OK(schema_table_store_record(thd, table));
+ BREAK_IF(ret = schema_table_store_record(thd, table));
i++;
}
@@ -4025,7 +4039,7 @@ i_s_fts_config_fill(
rw_lock_s_unlock(&dict_operation_lock);
- DBUG_RETURN(0);
+ DBUG_RETURN(ret);
}
/*******************************************************************//**
@@ -4864,34 +4878,29 @@ i_s_innodb_buffer_page_fill(
state_str = NULL;
OK(fields[IDX_BUFFER_POOL_ID]->store(
- static_cast<double>(page_info->pool_id)));
+ page_info->pool_id, true));
OK(fields[IDX_BUFFER_BLOCK_ID]->store(
- static_cast<double>(page_info->block_id)));
+ page_info->block_id, true));
OK(fields[IDX_BUFFER_PAGE_SPACE]->store(
- static_cast<double>(page_info->space_id)));
+ page_info->space_id, true));
OK(fields[IDX_BUFFER_PAGE_NUM]->store(
- static_cast<double>(page_info->page_num)));
+ page_info->page_num, true));
OK(field_store_string(
fields[IDX_BUFFER_PAGE_TYPE],
i_s_page_type[page_info->page_type].type_str));
OK(fields[IDX_BUFFER_PAGE_FLUSH_TYPE]->store(
- page_info->flush_type));
+ page_info->flush_type, true));
OK(fields[IDX_BUFFER_PAGE_FIX_COUNT]->store(
- page_info->fix_count));
+ page_info->fix_count, true));
- if (page_info->hashed) {
- OK(field_store_string(
- fields[IDX_BUFFER_PAGE_HASHED], "YES"));
- } else {
- OK(field_store_string(
- fields[IDX_BUFFER_PAGE_HASHED], "NO"));
- }
+ OK(field_store_string(fields[IDX_BUFFER_PAGE_HASHED],
+ page_info->hashed ? "YES" : "NO"));
OK(fields[IDX_BUFFER_PAGE_NEWEST_MOD]->store(
(longlong) page_info->newest_mod, true));
@@ -4900,7 +4909,7 @@ i_s_innodb_buffer_page_fill(
(longlong) page_info->oldest_mod, true));
OK(fields[IDX_BUFFER_PAGE_ACCESS_TIME]->store(
- page_info->access_time));
+ page_info->access_time, true));
fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_null();
@@ -4909,44 +4918,48 @@ i_s_innodb_buffer_page_fill(
/* If this is an index page, fetch the index name
and table name */
if (page_info->page_type == I_S_PAGE_TYPE_INDEX) {
- const dict_index_t* index;
+ bool ret = false;
mutex_enter(&dict_sys->mutex);
- index = dict_index_get_if_in_cache_low(
- page_info->index_id);
-
- if (index) {
+ if (const dict_index_t* index =
+ dict_index_get_if_in_cache_low(
+ page_info->index_id)) {
table_name_end = innobase_convert_name(
table_name, sizeof(table_name),
index->table_name,
strlen(index->table_name),
thd, TRUE);
- OK(fields[IDX_BUFFER_PAGE_TABLE_NAME]->store(
- table_name,
- static_cast<uint>(table_name_end - table_name),
- system_charset_info));
- fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull();
-
- OK(field_store_index_name(
- fields[IDX_BUFFER_PAGE_INDEX_NAME],
- index->name));
+ ret = fields[IDX_BUFFER_PAGE_TABLE_NAME]
+ ->store(table_name,
+ static_cast<uint>(
+ table_name_end
+ - table_name),
+ system_charset_info)
+ || field_store_index_name(
+ fields
+ [IDX_BUFFER_PAGE_INDEX_NAME],
+ index->name);
}
mutex_exit(&dict_sys->mutex);
+
+ OK(ret);
+
+ fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull();
}
OK(fields[IDX_BUFFER_PAGE_NUM_RECS]->store(
- page_info->num_recs));
+ page_info->num_recs, true));
OK(fields[IDX_BUFFER_PAGE_DATA_SIZE]->store(
- page_info->data_size));
+ page_info->data_size, true));
OK(fields[IDX_BUFFER_PAGE_ZIP_SIZE]->store(
- page_info->zip_ssize
- ? (UNIV_ZIP_SIZE_MIN >> 1) << page_info->zip_ssize
- : 0));
+ page_info->zip_ssize
+ ? (UNIV_ZIP_SIZE_MIN >> 1) << page_info->zip_ssize
+ : 0, true));
#if BUF_PAGE_STATE_BITS > 3
# error "BUF_PAGE_STATE_BITS > 3, please ensure that all 1<<BUF_PAGE_STATE_BITS values are checked for"
@@ -4984,32 +4997,29 @@ i_s_innodb_buffer_page_fill(
switch (page_info->io_fix) {
case BUF_IO_NONE:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_NONE"));
+ state_str = "IO_NONE";
break;
case BUF_IO_READ:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_READ"));
+ state_str = "IO_READ";
break;
case BUF_IO_WRITE:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_WRITE"));
+ state_str = "IO_WRITE";
break;
case BUF_IO_PIN:
- OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
- "IO_PIN"));
+ state_str = "IO_PIN";
break;
}
+ OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
+ state_str));
+
OK(field_store_string(fields[IDX_BUFFER_PAGE_IS_OLD],
(page_info->is_old) ? "YES" : "NO"));
OK(fields[IDX_BUFFER_PAGE_FREE_CLOCK]->store(
page_info->freed_page_clock));
- if (schema_table_store_record(thd, table)) {
- DBUG_RETURN(1);
- }
+ OK(schema_table_store_record(thd, table));
}
DBUG_RETURN(0);
@@ -5550,17 +5560,10 @@ i_s_innodb_buf_page_lru_fill(
ulint num_page) /*!< in: number of page info
cached */
{
- TABLE* table;
- Field** fields;
- mem_heap_t* heap;
-
DBUG_ENTER("i_s_innodb_buf_page_lru_fill");
- table = tables->table;
-
- fields = table->field;
-
- heap = mem_heap_create(1000);
+ TABLE* table = tables->table;
+ Field** fields = table->field;
/* Iterate through the cached array and fill the I_S table rows */
for (ulint i = 0; i < num_page; i++) {
@@ -5575,43 +5578,37 @@ i_s_innodb_buf_page_lru_fill(
page_info = info_array + i;
OK(fields[IDX_BUF_LRU_POOL_ID]->store(
- static_cast<double>(page_info->pool_id)));
-
+ page_info->pool_id, true));
OK(fields[IDX_BUF_LRU_POS]->store(
- static_cast<double>(page_info->block_id)));
+ page_info->block_id, true));
OK(fields[IDX_BUF_LRU_PAGE_SPACE]->store(
- static_cast<double>(page_info->space_id)));
+ page_info->space_id, true));
OK(fields[IDX_BUF_LRU_PAGE_NUM]->store(
- static_cast<double>(page_info->page_num)));
+ page_info->page_num, true));
OK(field_store_string(
- fields[IDX_BUF_LRU_PAGE_TYPE],
- i_s_page_type[page_info->page_type].type_str));
+ fields[IDX_BUF_LRU_PAGE_TYPE],
+ i_s_page_type[page_info->page_type].type_str));
OK(fields[IDX_BUF_LRU_PAGE_FLUSH_TYPE]->store(
- static_cast<double>(page_info->flush_type)));
+ page_info->flush_type, true));
OK(fields[IDX_BUF_LRU_PAGE_FIX_COUNT]->store(
- static_cast<double>(page_info->fix_count)));
+ page_info->fix_count, true));
- if (page_info->hashed) {
- OK(field_store_string(
- fields[IDX_BUF_LRU_PAGE_HASHED], "YES"));
- } else {
- OK(field_store_string(
- fields[IDX_BUF_LRU_PAGE_HASHED], "NO"));
- }
+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_HASHED],
+ page_info->hashed ? "YES" : "NO"));
OK(fields[IDX_BUF_LRU_PAGE_NEWEST_MOD]->store(
- page_info->newest_mod, true));
+ page_info->newest_mod, true));
OK(fields[IDX_BUF_LRU_PAGE_OLDEST_MOD]->store(
- page_info->oldest_mod, true));
+ page_info->oldest_mod, true));
OK(fields[IDX_BUF_LRU_PAGE_ACCESS_TIME]->store(
- page_info->access_time));
+ page_info->access_time, true));
fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_null();
@@ -5620,43 +5617,47 @@ i_s_innodb_buf_page_lru_fill(
/* If this is an index page, fetch the index name
and table name */
if (page_info->page_type == I_S_PAGE_TYPE_INDEX) {
- const dict_index_t* index;
+ bool ret = false;
mutex_enter(&dict_sys->mutex);
- index = dict_index_get_if_in_cache_low(
- page_info->index_id);
-
- if (index) {
+ if (const dict_index_t* index =
+ dict_index_get_if_in_cache_low(
+ page_info->index_id)) {
table_name_end = innobase_convert_name(
table_name, sizeof(table_name),
index->table_name,
strlen(index->table_name),
thd, TRUE);
- OK(fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->store(
- table_name,
- static_cast<uint>(table_name_end - table_name),
- system_charset_info));
- fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull();
-
- OK(field_store_index_name(
- fields[IDX_BUF_LRU_PAGE_INDEX_NAME],
- index->name));
+ ret = fields[IDX_BUF_LRU_PAGE_TABLE_NAME]
+ ->store(table_name,
+ static_cast<uint>(
+ table_name_end
+ - table_name),
+ system_charset_info)
+ || field_store_index_name(
+ fields
+ [IDX_BUF_LRU_PAGE_INDEX_NAME],
+ index->name);
}
mutex_exit(&dict_sys->mutex);
+
+ OK(ret);
+
+ fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull();
}
OK(fields[IDX_BUF_LRU_PAGE_NUM_RECS]->store(
- page_info->num_recs));
+ page_info->num_recs, true));
OK(fields[IDX_BUF_LRU_PAGE_DATA_SIZE]->store(
- page_info->data_size));
+ page_info->data_size, true));
OK(fields[IDX_BUF_LRU_PAGE_ZIP_SIZE]->store(
- page_info->zip_ssize ?
- 512 << page_info->zip_ssize : 0));
+ page_info->zip_ssize
+ ? 512 << page_info->zip_ssize : 0, true));
state = static_cast<enum buf_page_state>(page_info->page_state);
@@ -5685,35 +5686,31 @@ i_s_innodb_buf_page_lru_fill(
switch (page_info->io_fix) {
case BUF_IO_NONE:
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
- "IO_NONE"));
+ state_str = "IO_NONE";
break;
case BUF_IO_READ:
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
- "IO_READ"));
+ state_str = "IO_READ";
break;
case BUF_IO_WRITE:
- OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
- "IO_WRITE"));
+ state_str = "IO_WRITE";
+ break;
+ case BUF_IO_PIN:
+ state_str = "IO_PIN";
break;
}
+ OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
+ state_str));
+
OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IS_OLD],
- (page_info->is_old) ? "YES" : "NO"));
+ page_info->is_old ? "YES" : "NO"));
OK(fields[IDX_BUF_LRU_PAGE_FREE_CLOCK]->store(
- page_info->freed_page_clock));
-
- if (schema_table_store_record(thd, table)) {
- mem_heap_free(heap);
- DBUG_RETURN(1);
- }
+ page_info->freed_page_clock, true));
- mem_heap_empty(heap);
+ OK(schema_table_store_record(thd, table));
}
- mem_heap_free(heap);
-
DBUG_RETURN(0);
}
diff --git a/storage/xtradb/handler/i_s.h b/storage/xtradb/handler/i_s.h
index 55ef6e7ea42..4bb3ea33462 100644
--- a/storage/xtradb/handler/i_s.h
+++ b/storage/xtradb/handler/i_s.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2013, Oracle and/or its affiliates. All Rights Reserved.
-Copyrigth (c) 2014, 2015, MariaDB Corporation
+Copyrigth (c) 2014, 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
@@ -77,6 +77,8 @@ extern struct st_mysql_plugin i_s_innodb_changed_page_bitmaps;
DBUG_RETURN(1); \
}
+#define BREAK_IF(expr) if ((expr)) break
+
#define RETURN_IF_INNODB_NOT_STARTED(plugin_name) \
do { \
if (!srv_was_started) { \
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc
index e66568565e1..0445bb557e1 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.cc
+++ b/storage/xtradb/ibuf/ibuf0ibuf.cc
@@ -2963,8 +2963,7 @@ ibuf_get_volume_buffered_hash(
fold = ut_fold_binary(data, len);
hash += (fold / (CHAR_BIT * sizeof *hash)) % size;
- bitmask = static_cast<ulint>(
- 1 << (fold % (CHAR_BIT * sizeof(*hash))));
+ bitmask = static_cast<ulint>(1) << (fold % (CHAR_BIT * sizeof(*hash)));
if (*hash & bitmask) {
@@ -3733,7 +3732,7 @@ fail_exit:
if (mode == BTR_MODIFY_PREV) {
err = btr_cur_optimistic_insert(
- BTR_NO_LOCKING_FLAG,
+ BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG,
cursor, &offsets, &offsets_heap,
ibuf_entry, &ins_rec,
&dummy_big_rec, 0, thr, &mtr);
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index 960bd55d3d9..e478b33bf8e 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 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
@@ -220,15 +221,17 @@ btr_cur_optimistic_insert(
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
- mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
+ mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction;
if this function returns DB_SUCCESS on
a leaf page of a secondary index in a
@@ -256,15 +259,17 @@ btr_cur_pessimistic_insert(
cursor stays valid */
ulint** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
succeed */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or
- NULL */
+ be stored externally by the caller */
ulint n_ext, /*!< in: number of externally stored columns */
- que_thr_t* thr, /*!< in: query thread or NULL */
+ que_thr_t* thr, /*!< in/out: query thread; can be NULL if
+ !(~flags
+ & (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG)) */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull(2,3,4,5,6,7,10), warn_unused_result));
/*************************************************************//**
@@ -392,12 +397,12 @@ btr_cur_pessimistic_update(
ulint** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
- that can be emptied, or NULL */
+ that can be emptied */
mem_heap_t* entry_heap,
/*!< in/out: memory heap for allocating
big_rec and the index tuple */
big_rec_t** big_rec,/*!< out: big rec vector whose fields have to
- be stored externally by the caller, or NULL */
+ be stored externally by the caller */
const upd_t* update, /*!< in: update vector; this is allowed also
contain trx id and roll ptr fields, but
the values in update vector have no effect */
diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic
index 555852474aa..8f5cee0fd5f 100644
--- a/storage/xtradb/include/data0type.ic
+++ b/storage/xtradb/include/data0type.ic
@@ -576,7 +576,8 @@ dtype_get_fixed_size_low(
#else /* !UNIV_HOTBACKUP */
return(len);
#endif /* !UNIV_HOTBACKUP */
- /* fall through for variable-length charsets */
+ /* Treat as variable-length. */
+ /* Fall through */
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 2f03d2aa0f5..6b8f164f291 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -1006,7 +1006,7 @@ fil_create_new_single_table_tablespace(
must be >= FIL_IBD_FILE_INITIAL_SIZE */
fil_encryption_t mode, /*!< in: encryption mode */
ulint key_id) /*!< in: encryption key_id */
- __attribute__((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((nonnull(2), warn_unused_result));
#ifndef UNIV_HOTBACKUP
/** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations.
(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index a161ec8c06c..b053be9e61d 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2006, 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
@@ -144,7 +145,7 @@ enum durability_properties
thd_requested_durability(
/*=====================*/
const THD* thd) /*!< in: thread handle */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ MY_ATTRIBUTE((warn_unused_result));
/******************************************************************//**
Returns true if the transaction this thread is processing has edited
diff --git a/storage/xtradb/include/mach0data.ic b/storage/xtradb/include/mach0data.ic
index 3904d96c09f..3b1cf9c0378 100644
--- a/storage/xtradb/include/mach0data.ic
+++ b/storage/xtradb/include/mach0data.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2009, 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
@@ -779,13 +780,13 @@ mach_swap_byte_order(
dest += len;
switch (len & 0x7) {
- case 0: *--dest = *from++;
- case 7: *--dest = *from++;
- case 6: *--dest = *from++;
- case 5: *--dest = *from++;
- case 4: *--dest = *from++;
- case 3: *--dest = *from++;
- case 2: *--dest = *from++;
+ case 0: *--dest = *from++; /* fall through */
+ case 7: *--dest = *from++; /* fall through */
+ case 6: *--dest = *from++; /* fall through */
+ case 5: *--dest = *from++; /* fall through */
+ case 4: *--dest = *from++; /* fall through */
+ case 3: *--dest = *from++; /* fall through */
+ case 2: *--dest = *from++; /* fall through */
case 1: *--dest = *from;
}
}
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index 62f651413e1..ce03f6a2124 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -959,7 +959,14 @@ struct MY_ALIGNED(CACHE_LINE_SIZE) simple_counter
{
compile_time_assert(!atomic || sizeof(Type) == sizeof(ulint));
if (atomic) {
- return os_atomic_increment_ulint(&m_counter, i);
+ /* GCC would perform a type check in this code
+ also in case the template is instantiated with
+ simple_counter<Type=not_ulint, atomic=false>.
+ On Solaris, os_atomic_increment_ulint() maps
+ to atomic_add_long_nv(), which expects the
+ parameter to be correctly typed. */
+ return os_atomic_increment_ulint(
+ reinterpret_cast<ulint*>(&m_counter), i);
} else {
return m_counter += i;
}
diff --git a/storage/xtradb/include/page0zip.ic b/storage/xtradb/include/page0zip.ic
index 6c7d8cd32c7..9a583086925 100644
--- a/storage/xtradb/include/page0zip.ic
+++ b/storage/xtradb/include/page0zip.ic
@@ -2,6 +2,7 @@
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+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
@@ -172,7 +173,8 @@ page_zip_rec_needs_ext(
ignored if zip_size == 0 */
ulint zip_size) /*!< in: compressed page size in bytes, or 0 */
{
- ut_ad(rec_size > comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES);
+ ut_ad(rec_size
+ > (comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES));
ut_ad(ut_is_2pow(zip_size));
ut_ad(comp || !zip_size);
diff --git a/storage/xtradb/include/trx0rec.h b/storage/xtradb/include/trx0rec.h
index 359937e3583..a6e202d04e4 100644
--- a/storage/xtradb/include/trx0rec.h
+++ b/storage/xtradb/include/trx0rec.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 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
@@ -212,10 +213,6 @@ UNIV_INTERN
dberr_t
trx_undo_report_row_operation(
/*==========================*/
- ulint flags, /*!< in: if BTR_NO_UNDO_LOG_FLAG bit is
- set, does nothing */
- ulint op_type, /*!< in: TRX_UNDO_INSERT_OP or
- TRX_UNDO_MODIFY_OP */
que_thr_t* thr, /*!< in: query thread */
dict_index_t* index, /*!< in: clustered index */
const dtuple_t* clust_entry, /*!< in: in the case of an insert,
@@ -233,7 +230,7 @@ trx_undo_report_row_operation(
inserted undo log record,
0 if BTR_NO_UNDO_LOG
flag was specified */
- MY_ATTRIBUTE((nonnull(3,4,10), warn_unused_result));
+ MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
/******************************************************************//**
Copies an undo record to heap. This function can be called if we know that
the undo log record exists.
@@ -313,10 +310,6 @@ record */
storage fields: used by purge to
free the external storage */
-/* Operation type flags used in trx_undo_report_row_operation */
-#define TRX_UNDO_INSERT_OP 1
-#define TRX_UNDO_MODIFY_OP 2
-
#ifndef UNIV_NONINL
#include "trx0rec.ic"
#endif
diff --git a/storage/xtradb/include/ut0rnd.ic b/storage/xtradb/include/ut0rnd.ic
index 024c59e553b..987dfac03c1 100644
--- a/storage/xtradb/include/ut0rnd.ic
+++ b/storage/xtradb/include/ut0rnd.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2009, 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
@@ -237,16 +238,22 @@ ut_fold_binary(
switch (len & 0x7) {
case 7:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 6:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 5:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 4:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 3:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 2:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
+ /* fall through */
case 1:
fold = ut_fold_ulint_pair(fold, (ulint)(*str++));
}
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index 717fbf02536..71612f66fcd 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -921,12 +921,18 @@ lock_reset_lock_and_trx_wait(
const char* stmt2=NULL;
size_t stmt_len;
trx_id_t trx_id = 0;
- stmt = innobase_get_stmt(lock->trx->mysql_thd, &stmt_len);
+ stmt = lock->trx->mysql_thd
+ ? innobase_get_stmt(lock->trx->mysql_thd, &stmt_len)
+ : NULL;
if (lock->trx->lock.wait_lock &&
lock->trx->lock.wait_lock->trx) {
trx_id = lock->trx->lock.wait_lock->trx->id;
- stmt2 = innobase_get_stmt(lock->trx->lock.wait_lock->trx->mysql_thd, &stmt_len);
+ stmt2 = lock->trx->lock.wait_lock->trx->mysql_thd
+ ? innobase_get_stmt(
+ lock->trx->lock.wait_lock
+ ->trx->mysql_thd, &stmt_len)
+ : NULL;
}
ib_logf(IB_LOG_LEVEL_INFO,
@@ -5636,13 +5642,11 @@ lock_rec_unlock(
trx_mutex_exit(trx);
stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: unlock row could not"
- " find a %lu mode lock on the record\n",
- (ulong) lock_mode);
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: current statement: %.*s\n",
+
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "unlock row could not find a %u mode lock on the record;"
+ " statement=%.*s",
+ lock_mode,
(int) stmt_len, stmt);
return;
diff --git a/storage/xtradb/rem/rem0rec.cc b/storage/xtradb/rem/rem0rec.cc
index 6770748c38b..c62e8c90434 100644
--- a/storage/xtradb/rem/rem0rec.cc
+++ b/storage/xtradb/rem/rem0rec.cc
@@ -1293,8 +1293,10 @@ rec_convert_dtuple_to_rec_comp(
}
}
- memcpy(end, dfield_get_data(field), len);
- end += len;
+ if (len) {
+ memcpy(end, dfield_get_data(field), len);
+ end += len;
+ }
}
}
diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc
index 4542aa31a6c..7ffcc59dc5f 100644
--- a/storage/xtradb/row/row0ftsort.cc
+++ b/storage/xtradb/row/row0ftsort.cc
@@ -249,9 +249,6 @@ row_fts_psort_info_init(
each parallel sort thread. Each "sort bucket" holds records for
a particular "FTS index partition" */
for (j = 0; j < fts_sort_pll_degree; j++) {
-
- UT_LIST_INIT(psort_info[j].fts_doc_list);
-
for (i = 0; i < FTS_NUM_AUX_INDEX; i++) {
psort_info[j].merge_file[i] =
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index 81d6fda9e53..2f7aece665a 100644
--- a/storage/xtradb/row/row0import.cc
+++ b/storage/xtradb/row/row0import.cc
@@ -1995,6 +1995,7 @@ PageConverter::update_page(
case FIL_PAGE_TYPE_XDES:
err = set_current_xdes(
buf_block_get_page_no(block), get_frame(block));
+ /* fall through */
case FIL_PAGE_INODE:
case FIL_PAGE_TYPE_TRX_SYS:
case FIL_PAGE_IBUF_FREE_LIST:
diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc
index f4f96d32c50..6072b303d3a 100644
--- a/storage/xtradb/row/row0ins.cc
+++ b/storage/xtradb/row/row0ins.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 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
@@ -2166,14 +2167,10 @@ for a clustered index!
@retval DB_SUCCESS if no error
@retval DB_DUPLICATE_KEY if error,
@retval DB_LOCK_WAIT if we have to wait for a lock on a possible duplicate
-record
-@retval DB_SUCCESS_LOCKED_REC if an exact match of the record was found
-in online table rebuild (flags & (BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG)) */
+record */
static MY_ATTRIBUTE((nonnull, warn_unused_result))
dberr_t
row_ins_duplicate_error_in_clust(
-/*=============================*/
- ulint flags, /*!< in: undo logging and locking flags */
btr_cur_t* cursor, /*!< in: B-tree cursor */
const dtuple_t* entry, /*!< in: entry to insert */
que_thr_t* thr, /*!< in: query thread */
@@ -2454,7 +2451,7 @@ row_ins_clust_index_entry_low(
DB_LOCK_WAIT */
err = row_ins_duplicate_error_in_clust(
- flags, &cursor, entry, thr, &mtr);
+ &cursor, entry, thr, &mtr);
}
if (err != DB_SUCCESS) {
diff --git a/storage/xtradb/row/row0log.cc b/storage/xtradb/row/row0log.cc
index 666b59b42db..3cb909632dc 100644
--- a/storage/xtradb/row/row0log.cc
+++ b/storage/xtradb/row/row0log.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 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
@@ -1880,6 +1881,7 @@ row_log_table_apply_update(
When applying the subsequent ROW_T_DELETE, no matching
record will be found. */
+ /* fall through */
case DB_SUCCESS:
ut_ad(row != NULL);
break;
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 463981f51dd..59568f5c91b 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -5542,7 +5542,8 @@ loop:
fputs(" InnoDB: Warning: CHECK TABLE on ", stderr);
dict_index_name_print(stderr, prebuilt->trx, index);
fprintf(stderr, " returned %lu\n", ret);
- /* fall through (this error is ignored by CHECK TABLE) */
+ /* (this error is ignored by CHECK TABLE) */
+ /* fall through */
case DB_END_OF_INDEX:
func_exit:
mem_free(buf);
diff --git a/storage/xtradb/row/row0purge.cc b/storage/xtradb/row/row0purge.cc
index 8a1dbd6f69f..333677edf21 100644
--- a/storage/xtradb/row/row0purge.cc
+++ b/storage/xtradb/row/row0purge.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 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
@@ -488,8 +489,9 @@ row_purge_remove_sec_if_poss_leaf(
success = false;
}
}
- /* fall through (the index entry is still needed,
+ /* (The index entry is still needed,
or the deletion succeeded) */
+ /* fall through */
case ROW_NOT_DELETED_REF:
/* The index entry is still needed. */
case ROW_BUFFERED:
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index bf4b9124da7..b02a3b8f27e 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -450,7 +450,7 @@ UNIV_INTERN my_bool srv_cleaner_thread_priority = FALSE;
UNIV_INTERN my_bool srv_master_thread_priority = FALSE;
/* The number of purge threads to use.*/
-UNIV_INTERN ulong srv_n_purge_threads = 1;
+UNIV_INTERN ulong srv_n_purge_threads;
/* the number of pages to purge in one batch */
UNIV_INTERN ulong srv_purge_batch_size = 20;
@@ -689,16 +689,16 @@ UNIV_INTERN ulong srv_buf_dump_status_frequency = 0;
/** Acquire the system_mutex. */
#define srv_sys_mutex_enter() do { \
- mutex_enter(&srv_sys->mutex); \
+ mutex_enter(&srv_sys.mutex); \
} while (0)
/** Test if the system mutex is owned. */
-#define srv_sys_mutex_own() (mutex_own(&srv_sys->mutex) \
+#define srv_sys_mutex_own() (mutex_own(&srv_sys.mutex) \
&& !srv_read_only_mode)
/** Release the system mutex. */
#define srv_sys_mutex_exit() do { \
- mutex_exit(&srv_sys->mutex); \
+ mutex_exit(&srv_sys.mutex); \
} while (0)
#define fetch_lock_wait_timeout(trx) \
@@ -793,7 +793,7 @@ struct srv_sys_t{
ulint n_sys_threads; /*!< size of the sys_threads
array */
- srv_slot_t* sys_threads; /*!< server thread table;
+ srv_slot_t sys_threads[32 + 1]; /*!< server thread table;
os_event_set() and
os_event_reset() on
sys_threads[]->event are
@@ -817,7 +817,7 @@ struct srv_sys_t{
UNIV_INTERN ib_mutex_t server_mutex;
#endif /* !HAVE_ATOMIC_BUILTINS */
-static srv_sys_t* srv_sys = NULL;
+static srv_sys_t srv_sys;
/** Event to signal srv_monitor_thread. Not protected by a mutex.
Set after setting srv_print_innodb_monitor. */
@@ -839,10 +839,10 @@ and/or load it during startup. */
UNIV_INTERN char srv_buffer_pool_dump_at_shutdown = FALSE;
UNIV_INTERN char srv_buffer_pool_load_at_startup = FALSE;
-/** Slot index in the srv_sys->sys_threads array for the purge thread. */
+/** Slot index in the srv_sys.sys_threads array for the purge thread. */
static const ulint SRV_PURGE_SLOT = 1;
-/** Slot index in the srv_sys->sys_threads array for the master thread. */
+/** Slot index in the srv_sys.sys_threads array for the master thread. */
static const ulint SRV_MASTER_SLOT = 0;
UNIV_INTERN os_event_t srv_checkpoint_completed_event;
@@ -952,21 +952,21 @@ srv_reserve_slot(
switch (type) {
case SRV_MASTER:
- slot = &srv_sys->sys_threads[SRV_MASTER_SLOT];
+ slot = &srv_sys.sys_threads[SRV_MASTER_SLOT];
break;
case SRV_PURGE:
- slot = &srv_sys->sys_threads[SRV_PURGE_SLOT];
+ slot = &srv_sys.sys_threads[SRV_PURGE_SLOT];
break;
case SRV_WORKER:
/* Find an empty slot, skip the master and purge slots. */
- for (slot = &srv_sys->sys_threads[2];
+ for (slot = &srv_sys.sys_threads[2];
slot->in_use;
++slot) {
- ut_a(slot < &srv_sys->sys_threads[
- srv_sys->n_sys_threads]);
+ ut_a(slot < &srv_sys.sys_threads[
+ srv_sys.n_sys_threads]);
}
break;
@@ -982,7 +982,7 @@ srv_reserve_slot(
ut_ad(srv_slot_get_type(slot) == type);
- ++srv_sys->n_threads_active[type];
+ ++srv_sys.n_threads_active[type];
srv_sys_mutex_exit();
@@ -1012,27 +1012,27 @@ srv_suspend_thread_low(
case SRV_MASTER:
/* We have only one master thread and it
should be the first entry always. */
- ut_a(srv_sys->n_threads_active[type] == 1);
+ ut_a(srv_sys.n_threads_active[type] == 1);
break;
case SRV_PURGE:
/* We have only one purge coordinator thread
and it should be the second entry always. */
- ut_a(srv_sys->n_threads_active[type] == 1);
+ ut_a(srv_sys.n_threads_active[type] == 1);
break;
case SRV_WORKER:
ut_a(srv_n_purge_threads > 1);
- ut_a(srv_sys->n_threads_active[type] > 0);
+ ut_a(srv_sys.n_threads_active[type] > 0);
break;
}
ut_a(!slot->suspended);
slot->suspended = TRUE;
- ut_a(srv_sys->n_threads_active[type] > 0);
+ ut_a(srv_sys.n_threads_active[type] > 0);
- srv_sys->n_threads_active[type]--;
+ srv_sys.n_threads_active[type]--;
return(os_event_reset(slot->event));
}
@@ -1087,7 +1087,7 @@ srv_resume_thread(srv_slot_t* slot, ib_int64_t sig_count = 0, bool wait = true,
ut_ad(slot->suspended);
slot->suspended = FALSE;
- ++srv_sys->n_threads_active[slot->type];
+ ++srv_sys.n_threads_active[slot->type];
srv_sys_mutex_exit();
return(timeout);
}
@@ -1109,8 +1109,8 @@ srv_release_threads(enum srv_thread_type type, ulint n)
srv_sys_mutex_enter();
- for (ulint i = 0; i < srv_sys->n_sys_threads; i++) {
- srv_slot_t* slot = &srv_sys->sys_threads[i];
+ for (ulint i = 0; i < srv_sys.n_sys_threads; i++) {
+ srv_slot_t* slot = &srv_sys.sys_threads[i];
if (!slot->in_use || srv_slot_get_type(slot) != type) {
continue;
@@ -1130,7 +1130,7 @@ srv_release_threads(enum srv_thread_type type, ulint n)
should be the first entry always. */
ut_a(n == 1);
ut_a(i == SRV_MASTER_SLOT);
- ut_a(srv_sys->n_threads_active[type] == 0);
+ ut_a(srv_sys.n_threads_active[type] == 0);
break;
case SRV_PURGE:
@@ -1139,12 +1139,12 @@ srv_release_threads(enum srv_thread_type type, ulint n)
ut_a(n == 1);
ut_a(i == SRV_PURGE_SLOT);
ut_a(srv_n_purge_threads > 0);
- ut_a(srv_sys->n_threads_active[type] == 0);
+ ut_a(srv_sys.n_threads_active[type] == 0);
break;
case SRV_WORKER:
ut_a(srv_n_purge_threads > 1);
- ut_a(srv_sys->n_threads_active[type]
+ ut_a(srv_sys.n_threads_active[type]
< srv_n_purge_threads - 1);
break;
}
@@ -1182,9 +1182,6 @@ void
srv_init(void)
/*==========*/
{
- ulint n_sys_threads = 0;
- ulint srv_sys_sz = sizeof(*srv_sys);
-
#ifndef HAVE_ATOMIC_BUILTINS
mutex_create(server_mutex_key, &server_mutex, SYNC_ANY_LATCH);
#endif /* !HAVE_ATOMIC_BUILTINS */
@@ -1192,29 +1189,19 @@ srv_init(void)
mutex_create(srv_innodb_monitor_mutex_key,
&srv_innodb_monitor_mutex, SYNC_NO_ORDER_CHECK);
- if (!srv_read_only_mode) {
-
- /* Number of purge threads + master thread */
- n_sys_threads = srv_n_purge_threads + 1;
-
- srv_sys_sz += n_sys_threads * sizeof(*srv_sys->sys_threads);
- }
-
- srv_sys = static_cast<srv_sys_t*>(mem_zalloc(srv_sys_sz));
-
- srv_sys->n_sys_threads = n_sys_threads;
+ srv_sys.n_sys_threads = srv_read_only_mode
+ ? 0
+ : srv_n_purge_threads + 1/* purge coordinator */;
if (!srv_read_only_mode) {
- mutex_create(srv_sys_mutex_key, &srv_sys->mutex, SYNC_THREADS);
+ mutex_create(srv_sys_mutex_key, &srv_sys.mutex, SYNC_THREADS);
mutex_create(srv_sys_tasks_mutex_key,
- &srv_sys->tasks_mutex, SYNC_ANY_LATCH);
-
- srv_sys->sys_threads = (srv_slot_t*) &srv_sys[1];
+ &srv_sys.tasks_mutex, SYNC_ANY_LATCH);
- for (ulint i = 0; i < srv_sys->n_sys_threads; ++i) {
- srv_slot_t* slot = &srv_sys->sys_threads[i];
+ for (ulint i = 0; i < srv_sys.n_sys_threads; ++i) {
+ srv_slot_t* slot = &srv_sys.sys_threads[i];
slot->event = os_event_create();
@@ -1234,8 +1221,6 @@ srv_init(void)
if (srv_track_changed_pages) {
os_event_set(srv_redo_log_tracked_event);
}
-
- UT_LIST_INIT(srv_sys->tasks);
}
/* page_zip_stat_per_index_mutex is acquired from:
@@ -1283,8 +1268,8 @@ srv_free(void)
if (!srv_read_only_mode) {
- for (ulint i = 0; i < srv_sys->n_sys_threads; i++)
- os_event_free(srv_sys->sys_threads[i].event);
+ for (ulint i = 0; i < srv_sys.n_sys_threads; i++)
+ os_event_free(srv_sys.sys_threads[i].event);
os_event_free(srv_error_event);
srv_error_event = NULL;
@@ -1296,8 +1281,8 @@ srv_free(void)
srv_checkpoint_completed_event = NULL;
os_event_free(srv_redo_log_tracked_event);
srv_redo_log_tracked_event = NULL;
- mutex_free(&srv_sys->mutex);
- mutex_free(&srv_sys->tasks_mutex);
+ mutex_free(&srv_sys.mutex);
+ mutex_free(&srv_sys.tasks_mutex);
}
#ifdef WITH_INNODB_DISALLOW_WRITES
@@ -1311,10 +1296,10 @@ srv_free(void)
mutex_free(&srv_innodb_monitor_mutex);
mutex_free(&page_zip_stat_per_index_mutex);
- mem_free(srv_sys);
- srv_sys = NULL;
-
trx_i_s_cache_free(trx_i_s_cache);
+
+ /* This is needed for Mariabackup. */
+ memset(&srv_sys, 0, sizeof srv_sys);
}
/*********************************************************************//**
@@ -2452,9 +2437,9 @@ srv_inc_activity_count(
is caused by the background
change buffer merge */
{
- srv_sys->activity_count.inc();
+ srv_sys.activity_count.inc();
if (ibuf_merge_activity)
- srv_sys->ibuf_merge_activity_count.inc();
+ srv_sys.ibuf_merge_activity_count.inc();
}
/**********************************************************************//**
@@ -2476,7 +2461,7 @@ srv_get_active_thread_type(void)
srv_sys_mutex_enter();
for (ulint i = SRV_WORKER; i <= SRV_MASTER; ++i) {
- if (srv_sys->n_threads_active[i] != 0) {
+ if (srv_sys.n_threads_active[i] != 0) {
ret = static_cast<srv_thread_type>(i);
break;
}
@@ -2695,12 +2680,12 @@ srv_active_wake_master_thread(void)
srv_inc_activity_count();
- if (srv_sys->n_threads_active[SRV_MASTER] == 0) {
+ if (srv_sys.n_threads_active[SRV_MASTER] == 0) {
srv_slot_t* slot;
srv_sys_mutex_enter();
- slot = &srv_sys->sys_threads[SRV_MASTER_SLOT];
+ slot = &srv_sys.sys_threads[SRV_MASTER_SLOT];
/* Only if the master thread has been started. */
@@ -2727,7 +2712,7 @@ srv_wake_purge_thread_if_not_active(void)
ut_ad(!srv_sys_mutex_own());
if (purge_sys->state == PURGE_STATE_RUN
- && srv_sys->n_threads_active[SRV_PURGE] == 0) {
+ && srv_sys.n_threads_active[SRV_PURGE] == 0) {
srv_release_threads(SRV_PURGE, 1);
}
@@ -2756,7 +2741,7 @@ ulint
srv_get_activity_count(void)
/*========================*/
{
- return(srv_sys->activity_count);
+ return(srv_sys.activity_count);
}
/** Get current server ibuf merge activity count.
@@ -2765,7 +2750,7 @@ static
ulint
srv_get_ibuf_merge_activity_count(void)
{
- return(srv_sys->ibuf_merge_activity_count);
+ return(srv_sys.ibuf_merge_activity_count);
}
/*******************************************************************//**
@@ -2784,14 +2769,14 @@ srv_check_activity(
ULINT_UNDEFINED */
ulint old_ibuf_merge_activity_count)
{
- ulint new_activity_count = srv_sys->activity_count;
+ ulint new_activity_count = srv_sys.activity_count;
if (old_ibuf_merge_activity_count == ULINT_UNDEFINED)
return(new_activity_count != old_activity_count);
/* If we care about ibuf merge activity, then the server is considered
idle if all activity, if any, was due to ibuf merge. */
ulint new_ibuf_merge_activity_count
- = srv_sys->ibuf_merge_activity_count;
+ = srv_sys.ibuf_merge_activity_count;
ut_ad(new_ibuf_merge_activity_count <= new_activity_count);
ut_ad(new_ibuf_merge_activity_count >= old_ibuf_merge_activity_count);
@@ -3188,7 +3173,7 @@ DECLARE_THREAD(srv_master_thread)(
srv_main_thread_id = os_thread_pf(os_thread_get_curr_id());
slot = srv_reserve_slot(SRV_MASTER);
- ut_a(slot == srv_sys->sys_threads);
+ ut_a(slot == srv_sys.sys_threads);
last_print_time = ut_time();
loop:
@@ -3284,18 +3269,18 @@ srv_task_execute(void)
ut_ad(!srv_read_only_mode);
ut_a(srv_force_recovery < SRV_FORCE_NO_BACKGROUND);
- mutex_enter(&srv_sys->tasks_mutex);
+ mutex_enter(&srv_sys.tasks_mutex);
- if (UT_LIST_GET_LEN(srv_sys->tasks) > 0) {
+ if (UT_LIST_GET_LEN(srv_sys.tasks) > 0) {
- thr = UT_LIST_GET_FIRST(srv_sys->tasks);
+ thr = UT_LIST_GET_FIRST(srv_sys.tasks);
ut_a(que_node_get_type(thr->child) == QUE_NODE_PURGE);
- UT_LIST_REMOVE(queue, srv_sys->tasks, thr);
+ UT_LIST_REMOVE(queue, srv_sys.tasks, thr);
}
- mutex_exit(&srv_sys->tasks_mutex);
+ mutex_exit(&srv_sys.tasks_mutex);
if (thr != NULL) {
@@ -3345,7 +3330,7 @@ DECLARE_THREAD(srv_worker_thread)(
srv_sys_mutex_enter();
- ut_a(srv_sys->n_threads_active[SRV_WORKER] < srv_n_purge_threads);
+ ut_a(srv_sys.n_threads_active[SRV_WORKER] < srv_n_purge_threads);
srv_sys_mutex_exit();
@@ -3685,11 +3670,11 @@ srv_que_task_enqueue_low(
que_thr_t* thr) /*!< in: query thread */
{
ut_ad(!srv_read_only_mode);
- mutex_enter(&srv_sys->tasks_mutex);
+ mutex_enter(&srv_sys.tasks_mutex);
- UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr);
+ UT_LIST_ADD_LAST(queue, srv_sys.tasks, thr);
- mutex_exit(&srv_sys->tasks_mutex);
+ mutex_exit(&srv_sys.tasks_mutex);
srv_release_threads(SRV_WORKER, 1);
}
@@ -3706,11 +3691,11 @@ srv_get_task_queue_length(void)
ut_ad(!srv_read_only_mode);
- mutex_enter(&srv_sys->tasks_mutex);
+ mutex_enter(&srv_sys.tasks_mutex);
- n_tasks = UT_LIST_GET_LEN(srv_sys->tasks);
+ n_tasks = UT_LIST_GET_LEN(srv_sys.tasks);
- mutex_exit(&srv_sys->tasks_mutex);
+ mutex_exit(&srv_sys.tasks_mutex);
return(n_tasks);
}
diff --git a/storage/xtradb/sync/sync0sync.cc b/storage/xtradb/sync/sync0sync.cc
index 6692eef9fb0..37ac3c56fff 100644
--- a/storage/xtradb/sync/sync0sync.cc
+++ b/storage/xtradb/sync/sync0sync.cc
@@ -1236,6 +1236,7 @@ sync_thread_add_level(
upgrading in innobase_start_or_create_for_mysql(). */
break;
}
+ /* fall through */
case SYNC_MEM_POOL:
case SYNC_MEM_HASH:
case SYNC_RECV:
@@ -1299,9 +1300,9 @@ sync_thread_add_level(
}
}
ut_ad(found_current);
-
- /* fallthrough */
}
+
+ /* fall through */
case SYNC_BUF_FLUSH_LIST:
case SYNC_BUF_LRU_LIST:
case SYNC_BUF_FREE_LIST:
diff --git a/storage/xtradb/trx/trx0i_s.cc b/storage/xtradb/trx/trx0i_s.cc
index eacd9212d2f..0c9618d98eb 100644
--- a/storage/xtradb/trx/trx0i_s.cc
+++ b/storage/xtradb/trx/trx0i_s.cc
@@ -507,7 +507,9 @@ fill_trx_row(
row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd);
- stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
+ stmt = trx->mysql_thd
+ ? innobase_get_stmt(trx->mysql_thd, &stmt_len)
+ : NULL;
if (stmt != NULL) {
char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
diff --git a/storage/xtradb/trx/trx0rec.cc b/storage/xtradb/trx/trx0rec.cc
index 74a63b60286..8c0904dd57b 100644
--- a/storage/xtradb/trx/trx0rec.cc
+++ b/storage/xtradb/trx/trx0rec.cc
@@ -1186,10 +1186,6 @@ UNIV_INTERN
dberr_t
trx_undo_report_row_operation(
/*==========================*/
- ulint flags, /*!< in: if BTR_NO_UNDO_LOG_FLAG bit is
- set, does nothing */
- ulint op_type, /*!< in: TRX_UNDO_INSERT_OP or
- TRX_UNDO_MODIFY_OP */
que_thr_t* thr, /*!< in: query thread */
dict_index_t* index, /*!< in: clustered index */
const dtuple_t* clust_entry, /*!< in: in the case of an insert,
@@ -1223,16 +1219,8 @@ trx_undo_report_row_operation(
ut_a(dict_index_is_clust(index));
ut_ad(!rec || rec_offs_validate(rec, index, offsets));
- if (flags & BTR_NO_UNDO_LOG_FLAG) {
-
- *roll_ptr = 0;
-
- return(DB_SUCCESS);
- }
-
ut_ad(thr);
- ut_ad((op_type != TRX_UNDO_INSERT_OP)
- || (clust_entry && !update && !rec));
+ ut_ad(!clust_entry || (!update && !rec));
trx = thr_get_trx(thr);
@@ -1253,8 +1241,7 @@ trx_undo_report_row_operation(
/* If the undo log is not assigned yet, assign one */
- switch (op_type) {
- case TRX_UNDO_INSERT_OP:
+ if (clust_entry) {
undo = trx->insert_undo;
if (undo == NULL) {
@@ -1270,10 +1257,7 @@ trx_undo_report_row_operation(
ut_ad(err == DB_SUCCESS);
}
- break;
- default:
- ut_ad(op_type == TRX_UNDO_MODIFY_OP);
-
+ } else {
undo = trx->update_undo;
if (undo == NULL) {
@@ -1297,23 +1281,15 @@ trx_undo_report_row_operation(
buf_block_dbg_add_level(undo_block, SYNC_TRX_UNDO_PAGE);
do {
- page_t* undo_page;
- ulint offset;
-
- undo_page = buf_block_get_frame(undo_block);
ut_ad(page_no == buf_block_get_page_no(undo_block));
- switch (op_type) {
- case TRX_UNDO_INSERT_OP:
- offset = trx_undo_page_report_insert(
- undo_page, trx, index, clust_entry, &mtr);
- break;
- default:
- ut_ad(op_type == TRX_UNDO_MODIFY_OP);
- offset = trx_undo_page_report_modify(
+ page_t* undo_page = buf_block_get_frame(undo_block);
+ ulint offset = clust_entry
+ ? trx_undo_page_report_insert(
+ undo_page, trx, index, clust_entry, &mtr)
+ : trx_undo_page_report_modify(
undo_page, trx, index, rec, offsets, update,
cmpl_info, &mtr);
- }
if (UNIV_UNLIKELY(offset == 0)) {
/* The record did not fit on the page. We erase the
@@ -1364,7 +1340,7 @@ trx_undo_report_row_operation(
mutex_exit(&trx->undo_mutex);
*roll_ptr = trx_undo_build_roll_ptr(
- op_type == TRX_UNDO_INSERT_OP,
+ clust_entry != NULL,
rseg->id, page_no, offset);
return(DB_SUCCESS);
}
diff --git a/storage/xtradb/usr/usr0sess.cc b/storage/xtradb/usr/usr0sess.cc
index ab7ba6bea09..e1bd71ff1a0 100644
--- a/storage/xtradb/usr/usr0sess.cc
+++ b/storage/xtradb/usr/usr0sess.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2011, 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
@@ -48,8 +49,6 @@ sess_open(void)
sess->trx = trx_allocate_for_background();
sess->trx->sess = sess;
- UT_LIST_INIT(sess->graphs);
-
return(sess);
}