summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/archive/ha_archive.cc2
-rw-r--r--storage/connect/ha_connect.cc31
-rw-r--r--storage/connect/mysql-test/connect/r/infoschema-9739.result12
-rw-r--r--storage/connect/mysql-test/connect/r/tbl.result45
-rw-r--r--storage/connect/mysql-test/connect/t/infoschema-9739.test9
-rw-r--r--storage/connect/mysql-test/connect/t/tbl.test45
-rw-r--r--storage/connect/odbconn.cpp9
-rw-r--r--storage/connect/plgcnx.h2
-rw-r--r--storage/connect/tabdos.cpp2
-rw-r--r--storage/connect/tabmysql.cpp4
-rw-r--r--storage/connect/tabodbc.cpp4
-rw-r--r--storage/connect/tabtbl.cpp4
-rw-r--r--storage/connect/tabtbl.h3
-rw-r--r--storage/connect/value.cpp33
-rw-r--r--storage/csv/ha_tina.h2
-rw-r--r--storage/federated/ha_federated.cc2
-rw-r--r--storage/federatedx/ha_federatedx.cc2
-rw-r--r--storage/innobase/fil/fil0crypt.cc37
-rw-r--r--storage/innobase/fil/fil0fil.cc8
-rw-r--r--storage/innobase/fts/fts0fts.cc2
-rw-r--r--storage/innobase/fts/fts0opt.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/handler/i_s.cc77
-rw-r--r--storage/innobase/include/fil0crypt.h1
-rw-r--r--storage/innobase/include/fts0priv.ic4
-rw-r--r--storage/innobase/include/log0recv.h12
-rw-r--r--storage/innobase/include/os0file.h7
-rw-r--r--storage/innobase/log/log0crypt.cc41
-rw-r--r--storage/innobase/log/log0log.cc21
-rw-r--r--storage/innobase/log/log0recv.cc32
-rw-r--r--storage/innobase/os/os0file.cc66
-rw-r--r--storage/innobase/row/row0merge.cc2
-rw-r--r--storage/innobase/ut/crc32_power8/crc32.S51
-rw-r--r--storage/maria/ma_packrec.c2
-rw-r--r--storage/mroonga/mrn_table.cpp8
-rw-r--r--storage/myisam/ha_myisam.cc2
-rw-r--r--storage/myisam/mi_packrec.c2
-rw-r--r--storage/myisam/myisamlog.c2
-rw-r--r--storage/oqgraph/graphcore.cc6
-rw-r--r--storage/oqgraph/ha_oqgraph.cc6
-rw-r--r--storage/spider/spd_copy_tables.cc20
-rw-r--r--storage/spider/spd_direct_sql.cc20
-rw-r--r--storage/spider/spd_table.cc34
-rw-r--r--storage/tokudb/PerconaFT/buildheader/CMakeLists.txt4
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result4
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test4
-rw-r--r--storage/xtradb/fil/fil0crypt.cc37
-rw-r--r--storage/xtradb/fil/fil0fil.cc5
-rw-r--r--storage/xtradb/fts/fts0fts.cc2
-rw-r--r--storage/xtradb/fts/fts0opt.cc2
-rw-r--r--storage/xtradb/handler/ha_innodb.cc41
-rw-r--r--storage/xtradb/handler/i_s.cc81
-rw-r--r--storage/xtradb/handler/xtradb_i_s.cc6
-rw-r--r--storage/xtradb/include/fil0crypt.h1
-rw-r--r--storage/xtradb/include/fts0priv.ic4
-rw-r--r--storage/xtradb/include/log0recv.h3
-rw-r--r--storage/xtradb/log/log0crypt.cc41
-rw-r--r--storage/xtradb/log/log0log.cc36
-rw-r--r--storage/xtradb/log/log0online.cc2
-rw-r--r--storage/xtradb/log/log0recv.cc37
-rw-r--r--storage/xtradb/os/os0file.cc24
-rw-r--r--storage/xtradb/row/row0sel.cc6
-rw-r--r--storage/xtradb/ut/crc32_power8/crc32.S51
63 files changed, 708 insertions, 361 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index bbce62e0641..c322c8eee54 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -56,7 +56,7 @@
meta file is first opened it is marked as dirty. It is opened when the table
itself is opened for writing. When the table is closed the new count for rows
is written to the meta file and the file is marked as clean. If the meta file
- is opened and it is marked as dirty, it is assumed that a crash occured. At
+ is opened and it is marked as dirty, it is assumed that a crash occurred. At
this point an error occurs and the user is told to rebuild the file.
A rebuild scans the rows and rewrites the meta file. If corruption is found
in the data file then the meta file is not repaired.
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 03364ccd01e..d96d7455d8b 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -169,9 +169,9 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.04.0005 January 24, 2016";
+ char version[]= "Version 1.04.0006 March 12, 2016";
#if defined(__WIN__)
- char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__;
+ char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
@@ -5159,7 +5159,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
fncn= topt->catfunc;
fnc= GetFuncID(fncn);
sep= topt->separator;
- spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep;
+ spc= (!sep) ? ',' : *sep;
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
hdr= (int)topt->header;
tbl= topt->tablist;
@@ -5226,7 +5226,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
goto err;
} // endif rc
-
if (!tab) {
if (ttp == TAB_TBL) {
// Make tab the first table of the list
@@ -5295,8 +5294,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_CSV:
if (!fn && fnc != FNC_NO)
sprintf(g->Message, "Missing %s file name", topt->type);
- else
- ok= true;
+ else if (sep && strlen(sep) > 1)
+ sprintf(g->Message, "Invalid separator %s", sep);
+ else
+ ok= true;
break;
case TAB_MYSQL:
@@ -5977,7 +5978,19 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(rc);
} // endif lrecl
- } // endif type
+ } // endif type JSON
+
+ if (type == TAB_CSV) {
+ const char *sep = options->separator;
+
+ if (sep && strlen(sep) > 1) {
+ sprintf(g->Message, "Invalid separator %s", sep);
+ my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
+ rc= HA_ERR_INTERNAL_ERROR;
+ DBUG_RETURN(rc);
+ } // endif sep
+
+ } // endif type CSV
// Check column types
for (field= table_arg->field; *field; field++) {
@@ -6765,7 +6778,7 @@ maria_declare_plugin(connect)
0x0104, /* version number (1.04) */
NULL, /* status variables */
connect_system_variables, /* system variables */
- "1.04.0005", /* string version */
- MariaDB_PLUGIN_MATURITY_BETA /* maturity */
+ "1.04.0006", /* string version */
+ MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
}
maria_declare_plugin_end;
diff --git a/storage/connect/mysql-test/connect/r/infoschema-9739.result b/storage/connect/mysql-test/connect/r/infoschema-9739.result
new file mode 100644
index 00000000000..bcebec1d0e0
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/infoschema-9739.result
@@ -0,0 +1,12 @@
+Warnings:
+Warning 1105 No file name. Table will use t1.xml
+create table t1 (i int) engine=Connect table_type=XML;
+Warnings:
+Warning 1105 No file name. Table will use t1.xml
+select * from information_schema.tables where create_options like '%table_type=XML%';
+TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1296 Got error 174 'File t1.xml not found' from CONNECT
+drop table t1;
diff --git a/storage/connect/mysql-test/connect/r/tbl.result b/storage/connect/mysql-test/connect/r/tbl.result
index bc77516c22d..f51b4dfa57f 100644
--- a/storage/connect/mysql-test/connect/r/tbl.result
+++ b/storage/connect/mysql-test/connect/r/tbl.result
@@ -44,8 +44,8 @@ ta message
1 Testing
2 myisam table
3 t4
-CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=PORT';
-select * from total;
+CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=PORT';
+SELECT * FROM total;
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -59,15 +59,15 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2';
tabname ta message
t2 1 Testing
t2 2 NULL
t2 3 t2
-select * from total where tabname = 't2' and ta = 3;
+SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
tabname ta message
t2 3 t2
-select * from total where tabname in ('t1','t4');
+SELECT * FROM total WHERE tabname IN ('t1','t4');
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -75,11 +75,11 @@ t1 3 t1
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where ta = 3 and tabname in ('t1','t2');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2');
tabname ta message
t1 3 t1
t2 3 t2
-select * from total where tabname <> 't2';
+SELECT * FROM total WHERE tabname <> 't2';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -90,12 +90,12 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname != 't2' and ta = 3;
+SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
tabname ta message
t1 3 t1
t3 3 t3
t4 3 t4
-select * from total where tabname not in ('t2','t3');
+SELECT * FROM total WHERE tabname NOT IN ('t2','t3');
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -103,11 +103,11 @@ t1 3 t1
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where ta = 3 and tabname in ('t2','t3');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3');
tabname ta message
t2 3 t2
t3 3 t3
-select * from total where ta = 3 or tabname in ('t2','t4');
+SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4');
tabname ta message
t1 3 t1
t2 1 Testing
@@ -117,7 +117,7 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where not tabname = 't2';
+SELECT * FROM total WHERE NOT tabname = 't2';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -128,7 +128,7 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname = 't2' or tabname = 't1';
+SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -141,3 +141,22 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
+#
+# Checking thread TBL tables
+#
+CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
+SELECT * FROM t1;
+v
+11
+CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
+SELECT * FROM t2;
+v
+22
+CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
+SELECT * FROM total order by v desc;
+v
+22
+11
+DROP TABLE total;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/storage/connect/mysql-test/connect/t/infoschema-9739.test b/storage/connect/mysql-test/connect/t/infoschema-9739.test
new file mode 100644
index 00000000000..e9eb7fb796e
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/infoschema-9739.test
@@ -0,0 +1,9 @@
+#
+# MDEV-9739 Assertion `m_status == DA_ERROR || m_status == DA_OK' failed in Diagnostics_area::message() ; connect.xml* tests fail in buildbot
+#
+
+--source have_libxml2.inc
+
+create table t1 (i int) engine=Connect table_type=XML;
+select * from information_schema.tables where create_options like '%table_type=XML%';
+drop table t1;
diff --git a/storage/connect/mysql-test/connect/t/tbl.test b/storage/connect/mysql-test/connect/t/tbl.test
index 43c506c9403..3dc4b2e64b0 100644
--- a/storage/connect/mysql-test/connect/t/tbl.test
+++ b/storage/connect/mysql-test/connect/t/tbl.test
@@ -31,23 +31,40 @@ INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4');
SELECT * FROM t4;
--replace_result $PORT PORT
---eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=$PORT'
-
-select * from total;
-select * from total where tabname = 't2';
-select * from total where tabname = 't2' and ta = 3;
-select * from total where tabname in ('t1','t4');
-select * from total where ta = 3 and tabname in ('t1','t2');
-select * from total where tabname <> 't2';
-select * from total where tabname != 't2' and ta = 3;
-select * from total where tabname not in ('t2','t3');
-select * from total where ta = 3 and tabname in ('t2','t3');
-select * from total where ta = 3 or tabname in ('t2','t4');
-select * from total where not tabname = 't2';
-select * from total where tabname = 't2' or tabname = 't1';
+--eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=$PORT'
+
+SELECT * FROM total;
+SELECT * FROM total WHERE tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
+SELECT * FROM total WHERE tabname IN ('t1','t4');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2');
+SELECT * FROM total WHERE tabname <> 't2';
+SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
+SELECT * FROM total WHERE tabname NOT IN ('t2','t3');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3');
+SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4');
+SELECT * FROM total WHERE NOT tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
+
+--echo #
+--echo # Checking thread TBL tables
+--echo #
+CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
+SELECT * FROM t1;
+
+CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
+SELECT * FROM t2;
+
+--replace_result $PORT PORT
+--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
+SELECT * FROM total order by v desc;
+
+DROP TABLE total;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index cb21a8bda15..55ccbdbada1 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -1758,7 +1758,9 @@ bool ODBConn::BindParam(ODBCCOL *colp)
SQLLEN *strlen = colp->GetStrLen();
SQLRETURN rc;
+#if 0
try {
+ // This function is often not or badly implemented by data sources
rc = SQLDescribeParam(m_hstmt, n, &sqlt, &colsize, &dec, &nul);
if (!Check(rc))
@@ -1766,11 +1768,12 @@ bool ODBConn::BindParam(ODBCCOL *colp)
} catch(DBX *x) {
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
+#endif // 0
colsize = colp->GetPrecision();
sqlt = GetSQLType(buftype);
- dec = IsTypeChar(buftype) ? 0 : colp->GetScale();
- nul = SQL_NULLABLE_UNKNOWN;
- } // end try/catch
+ dec = IsTypeNum(buftype) ? colp->GetScale() : 0;
+ nul = colp->IsNullable() ? SQL_NULLABLE : SQL_NO_NULLS;
+//} // end try/catch
buf = colp->GetBuffer(0);
len = IsTypeChar(buftype) ? colp->GetBuflen() : 0;
diff --git a/storage/connect/plgcnx.h b/storage/connect/plgcnx.h
index a1208f9b885..1b341bc5275 100644
--- a/storage/connect/plgcnx.h
+++ b/storage/connect/plgcnx.h
@@ -25,7 +25,7 @@ enum FNRC {RC_LICENSE = 7, /* PLGConnect prompt for license key */
RC_SUCCESS = 0, /* Successful function (must be 0) */
RC_MEMORY = -1, /* Storage allocation error */
RC_TRUNCATED = -2, /* Result has been truncated */
- RC_TIMEOUT = -3, /* Connection timeout occured */
+ RC_TIMEOUT = -3, /* Connection timeout occurred */
RC_TOOBIG = -4, /* Data is too big for connection */
RC_KEY = -5, /* Null ptr to key in Connect */
/* or bad key in other functions */
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index 7906f6c9219..98633f49d23 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -184,7 +184,7 @@ bool DOSDEF::GetOptFileName(PGLOBAL g, char *filename)
} // end of GetOptFileName
/***********************************************************************/
-/* After an optimize error occured, remove all set optimize values. */
+/* After an optimize error occurred, remove all set optimize values. */
/***********************************************************************/
void DOSDEF::RemoveOptValues(PGLOBAL g)
{
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 5a8bb17bd50..47497f465e3 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
Delayed = !!GetIntCatInfo("Delayed", 0);
} else {
// MYSQL access from a PROXY table
- Database = GetStringCatInfo(g, "Database", Schema ? Schema : (char*)"*");
+ Database = GetStringCatInfo(g, "Database", Schema ? Schema : PlugDup(g, "*"));
Isview = GetBoolCatInfo("View", false);
// We must get other connection parms from the calling table
@@ -806,7 +806,7 @@ int TDBMYSQL::GetMaxSize(PGLOBAL g)
else if (!Cardinality(NULL))
MaxSize = 10; // To make MySQL happy
else if ((MaxSize = Cardinality(g)) < 0)
- MaxSize = 12; // So we can see an error occured
+ MaxSize = 12; // So we can see an error occurred
} // endif MaxSize
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 501a814721d..c555f2a5abb 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2000-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2000-2016 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -818,7 +818,7 @@ int TDBODBC::GetMaxSize(PGLOBAL g)
else if (!Cardinality(NULL))
MaxSize = 10; // To make MySQL happy
else if ((MaxSize = Cardinality(g)) < 0)
- MaxSize = 12; // So we can see an error occured
+ MaxSize = 12; // So we can see an error occurred
} // endif MaxSize
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index 6b72c715517..36849146746 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void)
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
- Tdbp = (PTDBASE)Tablist->GetTo_Tdb();
+ Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL;
Crp = 0;
} // end of ResetDB
@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
/* Table already open, replace it at its beginning. */
/*******************************************************************/
ResetDB();
- return Tdbp->OpenDB(g); // Re-open fist table
+ return (Tdbp) ? Tdbp->OpenDB(g) : false; // Re-open fist table
} // endif use
#if 0
diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h
index 9d3f297f9e7..3a5ec45d025 100644
--- a/storage/connect/tabtbl.h
+++ b/storage/connect/tabtbl.h
@@ -138,7 +138,8 @@ class DllExport TDBTBM : public TDBTBL {
virtual void ResetDB(void);
// Database routines
- virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary
+ virtual int Cardinality(PGLOBAL g) { return 10; }
+ virtual int GetMaxSize(PGLOBAL g) { return 10; } // Temporary
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index f9597cb842b..64d0e13e8c4 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -989,7 +989,7 @@ uchar TYPVAL<uchar>::MinMaxVal(bool b)
{return (b) ? UINT_MAX8 : 0;}
/***********************************************************************/
-/* SafeAdd: adds a value and test whether overflow/underflow occured. */
+/* SafeAdd: adds a value and test whether overflow/underflow occurred. */
/***********************************************************************/
template <class TYPE>
TYPE TYPVAL<TYPE>::SafeAdd(TYPE n1, TYPE n2)
@@ -1017,7 +1017,7 @@ inline double TYPVAL<double>::SafeAdd(double n1, double n2)
} // end of SafeAdd
/***********************************************************************/
-/* SafeMult: multiply values and test whether overflow occured. */
+/* SafeMult: multiply values and test whether overflow occurred. */
/***********************************************************************/
template <class TYPE>
TYPE TYPVAL<TYPE>::SafeMult(TYPE n1, TYPE n2)
@@ -1344,10 +1344,13 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
/***********************************************************************/
bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
{
- bool rc;
+ bool rc = false;
- if (p && n > 0) {
- rc = n > Len;
+ if (!p || n == 0) {
+ Reset();
+ Null = Nullable;
+ } else if (p != Strp) {
+ rc = n > Len;
if ((n = MY_MIN(n, Len))) {
strncpy(Strp, p, n);
@@ -1366,10 +1369,6 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
Reset();
Null = false;
- } else {
- rc = false;
- Reset();
- Null = Nullable;
} // endif p
return rc;
@@ -1380,12 +1379,12 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
/***********************************************************************/
void TYPVAL<PSZ>::SetValue_psz(PSZ s)
{
- if (s) {
- strncpy(Strp, s, Len);
+ if (!s) {
+ Reset();
+ Null = Nullable;
+ } else if (s != Strp) {
+ strncpy(Strp, s, Len);
Null = false;
- } else {
- Reset();
- Null = Nullable;
} // endif s
} // end of SetValue_psz
@@ -1643,7 +1642,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
assert(np == 1 || np == 2);
if (np == 2)
- strncpy(Strp, p[0], Len);
+ SetValue_psz(p[0]);
if ((i = Len - (signed)strlen(Strp)) > 0)
strncat(Strp, p[np - 1], i);
@@ -1651,11 +1650,11 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
break;
case OP_MIN:
assert(np == 2);
- strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
+ SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
break;
case OP_MAX:
assert(np == 2);
- strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
+ SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
break;
default:
// sprintf(g->Message, MSG(BAD_EXP_OPER), op);
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index 000b46b2bb2..127c6053a53 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -71,7 +71,7 @@ class ha_tina: public handler
File update_temp_file;
String buffer;
/*
- The chain contains "holes" in the file, occured because of
+ The chain contains "holes" in the file, occurred because of
deletes/updates. It is used in rnd_end() to get rid of them
in the end of the query.
*/
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 0bf4d766d64..478a8f1cfaa 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -2016,7 +2016,7 @@ void ha_federated::start_bulk_insert(ha_rows rows, uint flags)
@return Operation status
@retval 0 No error
- @retval != 0 Error occured at remote server. Also sets my_errno.
+ @retval != 0 Error occurred at remote server. Also sets my_errno.
*/
int ha_federated::end_bulk_insert()
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 5834e70c2e5..890d1bff292 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -2157,7 +2157,7 @@ void ha_federatedx::start_bulk_insert(ha_rows rows, uint flags)
@return Operation status
@retval 0 No error
- @retval != 0 Error occured at remote server. Also sets my_errno.
+ @retval != 0 Error occurred at remote server. Also sets my_errno.
*/
int ha_federatedx::end_bulk_insert()
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 03020896542..ceffa950739 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
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
@@ -662,7 +662,7 @@ fil_space_encrypt(
return src_frame;
}
- ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+ ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, zip_size, dst_frame);
@@ -712,21 +712,37 @@ fil_space_decrypt(
ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
-
+ ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
+ ulint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
*err = DB_SUCCESS;
if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) {
return false;
}
- ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+ if (crypt_data == NULL) {
+ if (!(space == 0 && offset == 0) && key_version != 0) {
+ /* FIL_PAGE_FILE_FLUSH_LSN field i.e.
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ should be only defined for the
+ first page in a system tablespace
+ data file (ibdata*, not *.ibd), if not
+ clear it. */
+#ifdef UNIV_DEBUG
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Page on space %lu offset %lu has key_version %u"
+ " when it shoud be undefined.",
+ space, offset, key_version);
+#endif
+ mach_write_to_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0);
+ }
+ return false;
+ }
- /* read space & offset & lsn */
- ulint space = mach_read_from_4(
- src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- ulint offset = mach_read_from_4(
- src_frame + FIL_PAGE_OFFSET);
- ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
+ ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+
+ /* read space & lsn */
ulint header_len = FIL_PAGE_DATA;
if (page_compressed) {
@@ -2506,6 +2522,7 @@ fil_space_crypt_get_status(
mutex_enter(&crypt_data->mutex);
status->keyserver_requests = crypt_data->keyserver_requests;
status->min_key_version = crypt_data->min_key_version;
+ status->key_id = crypt_data->key_id;
if (crypt_data->rotate_state.active_threads > 0 ||
crypt_data->rotate_state.flushing) {
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 928c72cf546..d918b21d779 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates.
-Copyright (c) 2013, 2015, MariaDB Corporation.
+Copyright (c) 2013, 2016, 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
@@ -3207,10 +3207,12 @@ fil_create_link_file(
}
link_filepath = fil_make_isl_name(tablename);
-
+ /* Note that OS_FILE_READ_WRITE_CACHED used here to avoid
+ unnecessary errors on O_DIRECT, link files are not really
+ a data files. */
file = os_file_create_simple_no_error_handling(
innodb_file_data_key, link_filepath,
- OS_FILE_CREATE, OS_FILE_READ_WRITE, &success, 0);
+ OS_FILE_CREATE, OS_FILE_READ_WRITE_CACHED, &success, 0);
if (!success) {
/* The following call will print an error message */
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index cc4a4f9f1a8..ee06f9432b8 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -6274,7 +6274,7 @@ fts_fake_hex_to_dec(
#ifdef _WIN32
ret = sscanf(tmp_id, "%016llu", &dec_id);
#else
- ret = sscanf(tmp_id, "%016"PRIu64, &dec_id);
+ ret = sscanf(tmp_id, "%016" PRIu64, &dec_id);
#endif /* _WIN32 */
ut_ad(ret == 1);
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 2a0aa4daf12..00b3b4682c3 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -598,7 +598,7 @@ fts_zip_read_word(
/* Finished decompressing block. */
if (zip->zp->avail_in == 0) {
- /* Free the block thats been decompressed. */
+ /* Free the block that's been decompressed. */
if (zip->pos > 0) {
ulint prev = zip->pos - 1;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 9b70c4127f9..5edb6dc5190 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -19927,7 +19927,7 @@ maria_declare_plugin(innobase)
innodb_status_variables_export,/* status variables */
innobase_system_variables, /* system variables */
INNODB_VERSION_STR, /* string version */
- MariaDB_PLUGIN_MATURITY_BETA /* maturity */
+ MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
i_s_innodb_trx,
i_s_innodb_locks,
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index ef69e7df29d..0bb10f435af 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates.
-Copyrigth (c) 2014, 2015, MariaDB Corporation
+Copyrigth (c) 2014, 2016, 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
@@ -783,7 +783,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_trx =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
@@ -1043,7 +1043,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_locks =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
@@ -1226,7 +1226,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/*******************************************************************//**
@@ -1562,7 +1562,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset =
@@ -1612,7 +1612,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic tables
@@ -1912,7 +1912,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset =
@@ -1962,7 +1962,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
@@ -2205,7 +2205,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset =
@@ -2255,7 +2255,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */
@@ -2779,7 +2779,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_metrics =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */
static ST_FIELD_INFO i_s_stopword_fields_info[] =
@@ -2892,7 +2892,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_default_stopword =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED
@@ -3060,7 +3060,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_deleted =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/*******************************************************************//**
@@ -3143,7 +3143,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_being_deleted =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and
@@ -3432,7 +3432,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_cache =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/*******************************************************************//**
@@ -3867,7 +3867,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_table =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */
@@ -4065,7 +4065,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_config =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */
@@ -4614,7 +4614,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */
@@ -5326,7 +5326,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] =
@@ -5873,7 +5873,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page_lru =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/*******************************************************************//**
@@ -6167,7 +6167,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_TABLESTATS ***********************************************/
@@ -6457,7 +6457,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_INDEXES **************************************************/
@@ -6709,7 +6709,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_COLUMNS **************************************************/
@@ -6946,7 +6946,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_FIELDS ***************************************************/
@@ -7156,7 +7156,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_FOREIGN ********************************************/
@@ -7381,7 +7381,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_FOREIGN_COLS ********************************************/
@@ -7598,7 +7598,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_TABLESPACES ********************************************/
@@ -7866,7 +7866,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablespaces =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_DATAFILES ************************************************/
@@ -8055,7 +8055,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_datafiles =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** TABLESPACES_ENCRYPTION ********************************************/
@@ -8134,6 +8134,15 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+#define TABLESPACES_ENCRYPTION_CURRENT_KEY_ID 8
+ {STRUCT_FLD(field_name, "CURRENT_KEY_ID"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
END_OF_ST_FIELD_INFO
};
@@ -8172,6 +8181,8 @@ i_s_dict_fill_tablespaces_encryption(
status.min_key_version));
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION]->store(
status.current_key_version));
+ OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
+ status.key_id));
if (status.rotating) {
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store(
@@ -8338,7 +8349,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA)
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA)
};
/** TABLESPACES_SCRUBBING ********************************************/
@@ -8637,7 +8648,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA)
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA)
};
/** INNODB_MUTEXES *********************************************/
@@ -8851,7 +8862,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_mutexes =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_SEMAPHORE_WAITS ************************************************/
@@ -9128,5 +9139,5 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_semaphore_waits =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index aa601f28e25..fdc413e7520 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -333,6 +333,7 @@ struct fil_space_crypt_status_t {
uint min_key_version; /*!< min key version */
uint current_key_version;/*!< current key version */
uint keyserver_requests;/*!< no of key requests to key server */
+ ulint key_id; /*!< current key_id */
bool rotating; /*!< is key rotation ongoing */
bool flushing; /*!< is flush at end of rotation ongoing */
ulint rotate_next_page_number; /*!< next page if key rotating */
diff --git a/storage/innobase/include/fts0priv.ic b/storage/innobase/include/fts0priv.ic
index 2d07c60f980..ec61691870b 100644
--- a/storage/innobase/include/fts0priv.ic
+++ b/storage/innobase/include/fts0priv.ic
@@ -53,7 +53,7 @@ fts_write_object_id(
/* Use this to construct old(5.6.14 and 5.7.3) windows
ambiguous aux table names */
DBUG_EXECUTE_IF("innodb_test_wrong_windows_fts_aux_table_name",
- return(sprintf(str, "%016"PRIu64, id)););
+ return(sprintf(str, "%016" PRIu64, id)););
DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name",
return(sprintf(str, UINT64PFx, id)););
@@ -66,7 +66,7 @@ fts_write_object_id(
// FIXME: Use ut_snprintf(), so does following one.
return(sprintf(str, "%016llu", id));
#else /* _WIN32 */
- return(sprintf(str, "%016"PRIu64, id));
+ return(sprintf(str, "%016" PRIu64, id));
#endif /* _WIN32 */
}
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index e4a06fcc532..292953854f7 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -498,6 +498,18 @@ use these free frames to read in pages when we start applying the
log records to the database. */
extern ulint recv_n_pool_free_frames;
+/******************************************************//**
+Checks the 4-byte checksum to the trailer checksum field of a log
+block. We also accept a log block in the old format before
+InnoDB-3.23.52 where the checksum field contains the log block number.
+@return TRUE if ok, or if the log block may be in the format of InnoDB
+version predating 3.23.52 */
+ibool
+log_block_checksum_is_ok_or_old_format(
+/*===================================*/
+ const byte* block, /*!< in: pointer to a log block */
+ bool print_err); /*!< in print error ? */
+
#ifndef UNIV_NONINL
#include "log0recv.ic"
#endif
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index c610e1790eb..dff5ebd524c 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -128,7 +128,10 @@ enum os_file_create_t {
#define OS_FILE_READ_ONLY 333
#define OS_FILE_READ_WRITE 444
#define OS_FILE_READ_ALLOW_DELETE 555 /* for mysqlbackup */
-
+#define OS_FILE_READ_WRITE_CACHED 666 /* OS_FILE_READ_WRITE but never
+ O_DIRECT. Only for
+ os_file_create_simple_no_error_handling
+ currently. */
/* Options for file_create */
#define OS_FILE_AIO 61
#define OS_FILE_NORMAL 62
@@ -542,7 +545,7 @@ UNIV_INTERN
void
os_file_set_nocache(
/*================*/
- int fd, /*!< in: file descriptor to alter */
+ os_file_t fd, /*!< in: file descriptor to alter */
const char* file_name, /*!< in: file name, used in the
diagnostic message */
const char* operation_name);/*!< in: "open" or "create"; used in the
diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc
index e90533c2e76..852148899e9 100644
--- a/storage/innobase/log/log0crypt.cc
+++ b/storage/innobase/log/log0crypt.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
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
@@ -36,6 +36,8 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "my_crypt.h"
+/* Used for debugging */
+// #define DEBUG_CRYPT 1
#define UNENCRYPTED_KEY_VER 0
/* If true, enable redo log encryption. */
@@ -97,16 +99,24 @@ get_crypt_info(
{
/* so that no one is modifying array while we search */
ut_ad(mutex_own(&(log_sys->mutex)));
+ size_t items = crypt_info.size();
/* a log block only stores 4-bytes of checkpoint no */
checkpoint_no &= 0xFFFFFFFF;
- for (size_t i = 0; i < crypt_info.size(); i++) {
+ for (size_t i = 0; i < items; i++) {
struct crypt_info_t* it = &crypt_info[i];
if (it->checkpoint_no == checkpoint_no) {
return it;
}
}
+
+ /* If checkpoint contains more than one key and we did not
+ find the correct one use the first one. */
+ if (items) {
+ return (&crypt_info[0]);
+ }
+
return NULL;
}
@@ -131,7 +141,8 @@ log_blocks_crypt(
const byte* block, /*!< in: blocks before encrypt/decrypt*/
ulint size, /*!< in: size of block */
byte* dst_block, /*!< out: blocks after encrypt/decrypt */
- int what) /*!< in: encrypt or decrypt*/
+ int what, /*!< in: encrypt or decrypt*/
+ const crypt_info_t* crypt_info) /*!< in: crypt info or NULL */
{
byte *log_block = (byte*)block;
Crypt_result rc = MY_AES_OK;
@@ -146,7 +157,8 @@ log_blocks_crypt(
lsn_t log_block_start_lsn = log_block_get_start_lsn(
lsn, log_block_no);
- const crypt_info_t* info = get_crypt_info(log_block);
+ const crypt_info_t* info = crypt_info == NULL ? get_crypt_info(log_block) :
+ crypt_info;
#ifdef DEBUG_CRYPT
fprintf(stderr,
"%s %lu chkpt: %lu key: %u lsn: %lu\n",
@@ -156,12 +168,21 @@ log_blocks_crypt(
info ? info->key_version : 0,
log_block_start_lsn);
#endif
+ /* If no key is found from checkpoint assume the log_block
+ to be unencrypted. If checkpoint contains the encryption key
+ compare log_block current checksum, if checksum matches,
+ block can't be encrypted. */
if (info == NULL ||
- info->key_version == UNENCRYPTED_KEY_VER) {
+ info->key_version == UNENCRYPTED_KEY_VER ||
+ (log_block_checksum_is_ok_or_old_format(log_block, false) &&
+ what == ENCRYPTION_FLAG_DECRYPT)) {
memcpy(dst_block, log_block, OS_FILE_LOG_BLOCK_SIZE);
goto next;
}
+ ut_ad(what == ENCRYPTION_FLAG_DECRYPT ? !log_block_checksum_is_ok_or_old_format(log_block, false) :
+ log_block_checksum_is_ok_or_old_format(log_block, false));
+
// Assume log block header is not encrypted
memcpy(dst_block, log_block, LOG_BLOCK_HDR_SIZE);
@@ -292,7 +313,7 @@ log_blocks_encrypt(
const ulint size, /*!< in: size of blocks, must be multiple of a log block */
byte* dst_block) /*!< out: blocks after encryption */
{
- return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT);
+ return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT, NULL);
}
/*********************************************************************//**
@@ -355,14 +376,16 @@ log_encrypt_before_write(
return;
}
- if (info->key_version == UNENCRYPTED_KEY_VER) {
+ /* If the key is not encrypted or user has requested not to
+ encrypt, do not change log block. */
+ if (info->key_version == UNENCRYPTED_KEY_VER || !srv_encrypt_log) {
return;
}
byte* dst_frame = (byte*)malloc(size);
//encrypt log blocks content
- Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT);
+ Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL);
if (result == MY_AES_OK) {
ut_ad(block[0] == dst_frame[0]);
@@ -388,7 +411,7 @@ log_decrypt_after_read(
byte* dst_frame = (byte*)malloc(size);
// decrypt log blocks content
- Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT);
+ Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL);
if (result == MY_AES_OK) {
memcpy(frame, dst_frame, size);
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index fd3646a1691..31104b395c1 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
-Copyright (c) 2013, SkySQL Ab. All Rights Reserved.
+Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -52,6 +52,9 @@ Created 12/9/1995 Heikki Tuuri
#include "trx0roll.h"
#include "srv0mon.h"
+/* Used for debugging */
+// #define DEBUG_CRYPT 1
+
/*
General philosophy of InnoDB redo-logs:
@@ -2358,8 +2361,24 @@ loop:
(ulint) (source_offset % UNIV_PAGE_SIZE),
len, buf, NULL, 0);
+#ifdef DEBUG_CRYPT
+ fprintf(stderr, "BEFORE DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx offset %lu\n",
+ log_block_get_hdr_no(buf),
+ log_block_get_checkpoint_no(buf),
+ log_block_calc_checksum(buf),
+ log_block_get_checksum(buf), source_offset);
+#endif
+
log_decrypt_after_read(buf, len);
+#ifdef DEBUG_CRYPT
+ fprintf(stderr, "AFTER DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx\n",
+ log_block_get_hdr_no(buf),
+ log_block_get_checkpoint_no(buf),
+ log_block_calc_checksum(buf),
+ log_block_get_checksum(buf));
+#endif
+
start_lsn += len;
buf += len;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index c84e8277f07..2304f4885c2 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved.
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
@@ -923,11 +923,11 @@ block. We also accept a log block in the old format before
InnoDB-3.23.52 where the checksum field contains the log block number.
@return TRUE if ok, or if the log block may be in the format of InnoDB
version predating 3.23.52 */
-static
ibool
log_block_checksum_is_ok_or_old_format(
/*===================================*/
- const byte* block) /*!< in: pointer to a log block */
+ const byte* block, /*!< in: pointer to a log block */
+ bool print_err) /*!< in print error ? */
{
#ifdef UNIV_LOG_DEBUG
return(TRUE);
@@ -950,11 +950,13 @@ log_block_checksum_is_ok_or_old_format(
return(TRUE);
}
- fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n",
- log_block_get_hdr_no(block),
- log_block_get_checkpoint_no(block),
- log_block_calc_checksum(block),
- log_block_get_checksum(block));
+ if (print_err) {
+ fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n",
+ log_block_get_hdr_no(block),
+ log_block_get_checkpoint_no(block),
+ log_block_calc_checksum(block),
+ log_block_get_checksum(block));
+ }
return(FALSE);
}
@@ -2664,6 +2666,7 @@ recv_scan_log_recs(
ibool finished;
ulint data_len;
ibool more_data;
+ bool maybe_encrypted=false;
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -2678,6 +2681,8 @@ recv_scan_log_recs(
*err = DB_SUCCESS;
do {
+ log_crypt_err_t log_crypt_err;
+
no = log_block_get_hdr_no(log_block);
/*
fprintf(stderr, "Log block header no %lu\n", no);
@@ -2686,12 +2691,11 @@ recv_scan_log_recs(
log_block_convert_lsn_to_no(scanned_lsn));
*/
if (no != log_block_convert_lsn_to_no(scanned_lsn)
- || !log_block_checksum_is_ok_or_old_format(log_block)) {
- log_crypt_err_t log_crypt_err;
+ || !log_block_checksum_is_ok_or_old_format(log_block, true)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn)
&& !log_block_checksum_is_ok_or_old_format(
- log_block)) {
+ log_block, true)) {
fprintf(stderr,
"InnoDB: Log block no %lu at"
" lsn " LSN_PF " has\n"
@@ -2705,12 +2709,14 @@ recv_scan_log_recs(
log_block));
}
+ maybe_encrypted = log_crypt_block_maybe_encrypted(log_block,
+ &log_crypt_err);
+
/* Garbage or an incompletely written log block */
finished = TRUE;
- if (log_crypt_block_maybe_encrypted(log_block,
- &log_crypt_err)) {
+ if (maybe_encrypted) {
/* Log block maybe encrypted finish processing*/
log_crypt_print_error(log_crypt_err);
*err = DB_ERROR;
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index dd6b066c647..3a0bd1fc328 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2015, MariaDB Corporation.
+Copyright (c) 2013, 2016, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -1350,7 +1350,8 @@ os_file_create_simple_func(
access = GENERIC_READ;
- } else if (access_type == OS_FILE_READ_WRITE) {
+ } else if (access_type == OS_FILE_READ_WRITE
+ || access_type == OS_FILE_READ_WRITE_CACHED) {
access = GENERIC_READ | GENERIC_WRITE;
} else {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -1454,7 +1455,8 @@ os_file_create_simple_func(
#ifdef USE_FILE_LOCK
if (!srv_read_only_mode
&& *success
- && access_type == OS_FILE_READ_WRITE
+ && (access_type == OS_FILE_READ_WRITE
+ || access_type == OS_FILE_READ_WRITE_CACHED)
&& os_file_lock(file, name)) {
*success = FALSE;
@@ -1468,6 +1470,31 @@ os_file_create_simple_func(
return(file);
}
+/** Disable OS I/O caching on the file if the file type and server
+configuration requires it.
+@param file handle to the file
+@param name name of the file, for diagnostics
+@param mode_str operation on the file, for diagnostics
+@param type OS_LOG_FILE or OS_DATA_FILE
+@param access_type if OS_FILE_READ_WRITE_CACHED, then caching will be disabled
+unconditionally, ignored otherwise */
+static
+void
+os_file_set_nocache_if_needed(os_file_t file, const char* name,
+ const char *mode_str, ulint type,
+ ulint access_type)
+{
+ if (srv_read_only_mode || access_type == OS_FILE_READ_WRITE_CACHED) {
+ return;
+ }
+
+ if (type == OS_DATA_FILE
+ && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
+ || (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC))) {
+ os_file_set_nocache(file, name, mode_str);
+ }
+}
+
/****************************************************************//**
NOTE! Use the corresponding macro
os_file_create_simple_no_error_handling(), not directly this function!
@@ -1523,7 +1550,8 @@ os_file_create_simple_no_error_handling_func(
access = GENERIC_READ;
} else if (srv_read_only_mode) {
access = GENERIC_READ;
- } else if (access_type == OS_FILE_READ_WRITE) {
+ } else if (access_type == OS_FILE_READ_WRITE
+ || access_type == OS_FILE_READ_WRITE_CACHED) {
access = GENERIC_READ | GENERIC_WRITE;
} else if (access_type == OS_FILE_READ_ALLOW_DELETE) {
@@ -1595,7 +1623,8 @@ os_file_create_simple_no_error_handling_func(
} else {
ut_a(access_type == OS_FILE_READ_WRITE
- || access_type == OS_FILE_READ_ALLOW_DELETE);
+ || access_type == OS_FILE_READ_ALLOW_DELETE
+ || access_type == OS_FILE_READ_WRITE_CACHED);
create_flag = O_RDWR;
}
@@ -1627,18 +1656,16 @@ os_file_create_simple_no_error_handling_func(
/* This function is always called for data files, we should disable
OS caching (O_DIRECT) here as we do in os_file_create_func(), so
we open the same file in the same mode, see man page of open(2). */
- if (!srv_read_only_mode
- && *success
- && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
- || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
-
- os_file_set_nocache(file, name, mode_str);
+ if (*success) {
+ os_file_set_nocache_if_needed(file, name, mode_str,
+ OS_DATA_FILE, access_type);
}
#ifdef USE_FILE_LOCK
if (!srv_read_only_mode
&& *success
- && access_type == OS_FILE_READ_WRITE
+ && (access_type == OS_FILE_READ_WRITE
+ || access_type == OS_FILE_READ_WRITE_CACHED)
&& os_file_lock(file, name)) {
*success = FALSE;
@@ -1677,7 +1704,7 @@ UNIV_INTERN
void
os_file_set_nocache(
/*================*/
- int fd /*!< in: file descriptor to alter */
+ os_file_t fd /*!< in: file descriptor to alter */
__attribute__((unused)),
const char* file_name /*!< in: used in the diagnostic
message */
@@ -2007,13 +2034,8 @@ os_file_create_func(
/* We disable OS caching (O_DIRECT) only on data files */
- if (!srv_read_only_mode
- && *success
- && type != OS_LOG_FILE
- && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
- || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
-
- os_file_set_nocache(file, name, mode_str);
+ if (*success) {
+ os_file_set_nocache_if_needed(file, name, mode_str, type, 0);
}
#ifdef USE_FILE_LOCK
@@ -2926,7 +2948,7 @@ try_again:
"Error in system call pread(). The operating"
" system error number is %lu.",(ulint) errno);
} else {
- /* Partial read occured */
+ /* Partial read occurred */
ib_logf(IB_LOG_LEVEL_ERROR,
"Tried to read " ULINTPF " bytes at offset "
UINT64PF ". Was only able to read %ld.",
@@ -3057,7 +3079,7 @@ try_again:
"Error in system call pread(). The operating"
" system error number is %lu.",(ulint) errno);
} else {
- /* Partial read occured */
+ /* Partial read occurred */
ib_logf(IB_LOG_LEVEL_ERROR,
"Tried to read " ULINTPF " bytes at offset "
UINT64PF ". Was only able to read %ld.",
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 94cf20b79f6..294facf9723 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -3454,7 +3454,7 @@ row_merge_file_create(
if (merge_file->fd >= 0) {
if (srv_disable_sort_file_cache) {
- os_file_set_nocache(merge_file->fd,
+ os_file_set_nocache((os_file_t)merge_file->fd,
"row0merge.cc", "sort");
}
}
diff --git a/storage/innobase/ut/crc32_power8/crc32.S b/storage/innobase/ut/crc32_power8/crc32.S
index 52046bb9002..b064ce3dc96 100644
--- a/storage/innobase/ut/crc32_power8/crc32.S
+++ b/storage/innobase/ut/crc32_power8/crc32.S
@@ -67,14 +67,13 @@
#define off96 r30
#define off112 r31
-#define const1 v25
-#define const2 v26
+#define const1 v24
+#define const2 v25
-#define byteswap v27
-#define mask_32bit v28
-#define mask_64bit v29
-#define zeroes v30
-#define ones v31
+#define byteswap v26
+#define mask_32bit v27
+#define mask_64bit v28
+#define zeroes v29
#ifdef BYTESWAP_DATA
#define VPERM(A, B, C, D) vperm A, B, C, D
@@ -101,13 +100,28 @@ FUNC_START(__crc32_vpmsum)
li off112,112
li r0,0
+ /* Enough room for saving 10 non volatile VMX registers */
+ subi r6,r1,56+10*16
+ subi r7,r1,56+2*16
+
+ stvx v20,0,r6
+ stvx v21,off16,r6
+ stvx v22,off32,r6
+ stvx v23,off48,r6
+ stvx v24,off64,r6
+ stvx v25,off80,r6
+ stvx v26,off96,r6
+ stvx v27,off112,r6
+ stvx v28,0,r7
+ stvx v29,off16,r7
+
mr r10,r3
vxor zeroes,zeroes,zeroes
- vspltisw ones,-1
+ vspltisw v0,-1
- vsldoi mask_32bit,zeroes,ones,4
- vsldoi mask_64bit,zeroes,ones,8
+ vsldoi mask_32bit,zeroes,v0,4
+ vsldoi mask_64bit,zeroes,v0,8
/* Get the initial value into v8 */
vxor v8,v8,v8
@@ -570,6 +584,21 @@ FUNC_START(__crc32_vpmsum)
vsldoi v0,v0,zeroes,4 /* shift result into top 64 bits of */
#endif
+.Lout:
+ subi r6,r1,56+10*16
+ subi r7,r1,56+2*16
+
+ lvx v20,0,r6
+ lvx v21,off16,r6
+ lvx v22,off32,r6
+ lvx v23,off48,r6
+ lvx v24,off64,r6
+ lvx v25,off80,r6
+ lvx v26,off96,r6
+ lvx v27,off112,r6
+ lvx v28,0,r7
+ lvx v29,off16,r7
+
/* Get it into r3 */
MFVRD(r3, v0)
@@ -739,6 +768,8 @@ FUNC_START(__crc32_vpmsum)
.Lzero:
mr r3,r10
blr
+ b .Lout
+
FUNC_END(__crc32_vpmsum)
#endif /* __powerpc__ */
diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c
index a541a657ed2..6a4e7ea99cf 100644
--- a/storage/maria/ma_packrec.c
+++ b/storage/maria/ma_packrec.c
@@ -1204,7 +1204,7 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff,
/* This means that the Huffman code must be longer than table_bits. */
pos=decode_tree->table+low_byte;
bits-=table_bits;
- /* NOTE: decode_bytes_test_bit() is a macro wich contains a break !!! */
+ /* NOTE: decode_bytes_test_bit() is a macro which contains a break !!! */
for (;;)
{
low_byte=(uint) (bit_buff->current_byte >> (bits-8));
diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp
index 23abecf71e5..144dbe0c530 100644
--- a/storage/mroonga/mrn_table.cpp
+++ b/storage/mroonga/mrn_table.cpp
@@ -278,7 +278,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length,
#define MRN_PARAM_STR(title_name, param_name) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info", ("mroonga "title_name" start")); \
+ DBUG_PRINT("info", ("mroonga " title_name " start")); \
if (!share->param_name) \
{ \
if ((share->param_name = mrn_get_string_between_quote( \
@@ -290,7 +290,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length,
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info", ("mroonga "title_name"=%s", share->param_name)); \
+ DBUG_PRINT("info", ("mroonga " title_name "=%s", share->param_name)); \
} \
break; \
}
@@ -298,7 +298,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length,
#define MRN_PARAM_STR_LIST(title_name, param_name, param_pos) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info", ("mroonga "title_name" start")); \
+ DBUG_PRINT("info", ("mroonga " title_name " start")); \
if (share->param_name && !share->param_name[param_pos]) \
{ \
if ((share->param_name[param_pos] = mrn_get_string_between_quote( \
@@ -311,7 +311,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length,
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info", ("mroonga "title_name"[%d]=%s", param_pos, \
+ DBUG_PRINT("info", ("mroonga " title_name "[%d]=%s", param_pos, \
share->param_name[param_pos])); \
} \
break; \
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 257dbafd695..812166ce1cc 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -2409,7 +2409,7 @@ maria_declare_plugin_end;
@return The error code. The engine_data and engine_callback will be set to 0.
@retval TRUE Success
- @retval FALSE An error occured
+ @retval FALSE An error occurred
*/
my_bool ha_myisam::register_query_cache_table(THD *thd, char *table_name,
diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c
index 3687cfc2179..fc32bb7e518 100644
--- a/storage/myisam/mi_packrec.c
+++ b/storage/myisam/mi_packrec.c
@@ -1158,7 +1158,7 @@ static void decode_bytes(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,uchar *to,
/* This means that the Huffman code must be longer than table_bits. */
pos=decode_tree->table+low_byte;
bits-=table_bits;
- /* NOTE: decode_bytes_test_bit() is a macro wich contains a break !!! */
+ /* NOTE: decode_bytes_test_bit() is a macro which contains a break !!! */
for (;;)
{
low_byte=(uint) (bit_buff->current_byte >> (bits-8));
diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c
index d549dd76037..7ce03ca9485 100644
--- a/storage/myisam/myisamlog.c
+++ b/storage/myisam/myisamlog.c
@@ -266,7 +266,7 @@ static void get_options(register int *argc, register char ***argv)
puts(" -u \"update\" -v \"verbose\" -w \"write file\"");
puts(" -D \"myisam compiled with DBUG\" -P \"processes\"");
puts("\nOne can give a second and a third '-v' for more verbose.");
- puts("Normaly one does a update (-u).");
+ puts("Normally one does a update (-u).");
puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted.");
puts("If one gives table names as arguments only these tables will be updated\n");
help=1;
diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc
index 73433fc8219..4346b94805c 100644
--- a/storage/oqgraph/graphcore.cc
+++ b/storage/oqgraph/graphcore.cc
@@ -1036,11 +1036,11 @@ int stack_cursor::fetch_row(const row &row_info, row &result,
optional<EdgeWeight> w;
optional<Vertex> v;
result= row_info;
- if ((result.seq_indicator= seq= last.sequence()))
+ if ((result.seq_indicator= static_cast<bool>(seq= last.sequence())))
result.seq= *seq;
- if ((result.link_indicator= v= last.vertex()))
+ if ((result.link_indicator= static_cast<bool>(v= last.vertex())))
result.link= get(boost::vertex_index, share->g, *v);
- if ((result.weight_indicator= w= last.weight()))
+ if ((result.weight_indicator= static_cast<bool>(w= last.weight())))
result.weight= *w;
return oqgraph::OK;
}
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index 6f142a213b7..78a0079a5ab 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -753,6 +753,10 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
int ha_oqgraph::close(void)
{
DBUG_PRINT( "oq-debug", ("close()"));
+ if (graph->get_thd() != current_thd) {
+ DBUG_PRINT( "oq-debug", ("index_next_same g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd));
+ graph->set_thd(current_thd);
+ }
oqgraph::free(graph); graph= 0;
oqgraph::free(graph_share); graph_share= 0;
@@ -1372,6 +1376,6 @@ maria_declare_plugin(oqgraph)
oqgraph_status, /* status variables */
oqgraph_sysvars, /* system variables */
"3.0",
- MariaDB_PLUGIN_MATURITY_BETA
+ MariaDB_PLUGIN_MATURITY_GAMMA
}
maria_declare_plugin_end;
diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc
index c01549f8e99..7e7845635af 100644
--- a/storage/spider/spd_copy_tables.cc
+++ b/storage/spider/spd_copy_tables.cc
@@ -81,7 +81,7 @@ int spider_udf_set_copy_tables_param_default(
#define SPIDER_PARAM_STR(title_name, param_name) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (!copy_tables->param_name) \
{ \
if ((copy_tables->param_name = spider_get_string_between_quote( \
@@ -94,14 +94,14 @@ int spider_udf_set_copy_tables_param_default(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%s", copy_tables->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%s", copy_tables->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_HINT_WITH_MAX(title_name, param_name, check_length, max_size, min_val, max_val) \
if (!strncasecmp(tmp_ptr, title_name, check_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
DBUG_PRINT("info",("spider max_size=%d", max_size)); \
int hint_num = atoi(tmp_ptr + check_length) - 1; \
DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \
@@ -131,7 +131,7 @@ int spider_udf_set_copy_tables_param_default(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"[%d]=%d", hint_num, \
+ DBUG_PRINT("info",("spider " title_name "[%d]=%d", hint_num, \
copy_tables->param_name[hint_num])); \
} else { \
error_num = ER_SPIDER_INVALID_UDF_PARAM_NUM; \
@@ -144,7 +144,7 @@ int spider_udf_set_copy_tables_param_default(
#define SPIDER_PARAM_INT_WITH_MAX(title_name, param_name, min_val, max_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (copy_tables->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -161,14 +161,14 @@ int spider_udf_set_copy_tables_param_default(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%d", copy_tables->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%d", copy_tables->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_INT(title_name, param_name, min_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (copy_tables->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -183,14 +183,14 @@ int spider_udf_set_copy_tables_param_default(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%d", copy_tables->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%d", copy_tables->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_LONGLONG(title_name, param_name, min_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (copy_tables->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -206,7 +206,7 @@ int spider_udf_set_copy_tables_param_default(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%lld", \
+ DBUG_PRINT("info",("spider " title_name "=%lld", \
copy_tables->param_name)); \
} \
break; \
diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc
index 7de31e34e94..c0eb7806bb0 100644
--- a/storage/spider/spd_direct_sql.cc
+++ b/storage/spider/spd_direct_sql.cc
@@ -896,7 +896,7 @@ error:
#define SPIDER_PARAM_STR(title_name, param_name) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (!direct_sql->param_name) \
{ \
if ((direct_sql->param_name = spider_get_string_between_quote( \
@@ -909,14 +909,14 @@ error:
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%s", direct_sql->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%s", direct_sql->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_HINT_WITH_MAX(title_name, param_name, check_length, max_size, min_val, max_val) \
if (!strncasecmp(tmp_ptr, title_name, check_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
DBUG_PRINT("info",("spider max_size=%d", max_size)); \
int hint_num = atoi(tmp_ptr + check_length) - 1; \
DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \
@@ -946,7 +946,7 @@ error:
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"[%d]=%d", hint_num, \
+ DBUG_PRINT("info",("spider " title_name "[%d]=%d", hint_num, \
direct_sql->param_name[hint_num])); \
} else { \
error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM; \
@@ -959,7 +959,7 @@ error:
#define SPIDER_PARAM_INT_WITH_MAX(title_name, param_name, min_val, max_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (direct_sql->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -976,7 +976,7 @@ error:
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%d", \
+ DBUG_PRINT("info",("spider " title_name "=%d", \
(int) direct_sql->param_name)); \
} \
break; \
@@ -984,7 +984,7 @@ error:
#define SPIDER_PARAM_INT(title_name, param_name, min_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (direct_sql->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -999,14 +999,14 @@ error:
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%d", direct_sql->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%d", direct_sql->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_LONGLONG(title_name, param_name, min_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (direct_sql->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1022,7 +1022,7 @@ error:
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%lld", \
+ DBUG_PRINT("info",("spider " title_name "=%lld", \
direct_sql->param_name)); \
} \
break; \
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 64579bcee6c..d981dc6002b 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -1499,7 +1499,7 @@ static int spider_set_ll_value(
#define SPIDER_PARAM_STR(title_name, param_name) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (!share->param_name) \
{ \
if ((share->param_name = spider_get_string_between_quote( \
@@ -1511,7 +1511,7 @@ static int spider_set_ll_value(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%s", share->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%s", share->param_name)); \
} \
break; \
}
@@ -1520,7 +1520,7 @@ static int spider_set_ll_value(
#define SPIDER_PARAM_STR_LIST(title_name, param_name) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (!share->param_name) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1546,7 +1546,7 @@ static int spider_set_ll_value(
#define SPIDER_PARAM_HINT(title_name, param_name, check_length, max_size, append_method) \
if (!strncasecmp(tmp_ptr, title_name, check_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
DBUG_PRINT("info",("spider max_size=%d", max_size)); \
int hint_num = atoi(tmp_ptr + check_length); \
DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \
@@ -1565,7 +1565,7 @@ static int spider_set_ll_value(
if ((error_num = \
append_method(&share->param_name[hint_num], hint_str))) \
goto error; \
- DBUG_PRINT("info",("spider "title_name"[%d]=%s", hint_num, \
+ DBUG_PRINT("info",("spider " title_name "[%d]=%s", hint_num, \
share->param_name[hint_num].ptr())); \
} else { \
error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM; \
@@ -1578,7 +1578,7 @@ static int spider_set_ll_value(
#define SPIDER_PARAM_NUMHINT(title_name, param_name, check_length, max_size, append_method) \
if (!strncasecmp(tmp_ptr, title_name, check_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
DBUG_PRINT("info",("spider max_size=%d", max_size)); \
int hint_num = atoi(tmp_ptr + check_length); \
DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \
@@ -1597,7 +1597,7 @@ static int spider_set_ll_value(
if ((error_num = \
append_method(&share->param_name[hint_num], hint_str))) \
goto error; \
- DBUG_PRINT("info",("spider "title_name"[%d]=%lld", hint_num, \
+ DBUG_PRINT("info",("spider " title_name "[%d]=%lld", hint_num, \
share->param_name[hint_num])); \
} else { \
error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM; \
@@ -1612,7 +1612,7 @@ static int spider_set_ll_value(
min_val, max_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (!share->param_name) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1639,7 +1639,7 @@ static int spider_set_ll_value(
min_val, max_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (!share->param_name) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1664,7 +1664,7 @@ static int spider_set_ll_value(
#define SPIDER_PARAM_INT_WITH_MAX(title_name, param_name, min_val, max_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (share->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1681,14 +1681,14 @@ static int spider_set_ll_value(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%d", share->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%d", share->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_INT(title_name, param_name, min_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (share->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1703,14 +1703,14 @@ static int spider_set_ll_value(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%d", share->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%d", share->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_DOUBLE(title_name, param_name, min_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (share->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1725,14 +1725,14 @@ static int spider_set_ll_value(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%f", share->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%f", share->param_name)); \
} \
break; \
}
#define SPIDER_PARAM_LONGLONG(title_name, param_name, min_val) \
if (!strncasecmp(tmp_ptr, title_name, title_length)) \
{ \
- DBUG_PRINT("info",("spider "title_name" start")); \
+ DBUG_PRINT("info",("spider " title_name " start")); \
if (share->param_name == -1) \
{ \
if ((tmp_ptr2 = spider_get_string_between_quote( \
@@ -1747,7 +1747,7 @@ static int spider_set_ll_value(
MYF(0), tmp_ptr); \
goto error; \
} \
- DBUG_PRINT("info",("spider "title_name"=%lld", share->param_name)); \
+ DBUG_PRINT("info",("spider " title_name "=%lld", share->param_name)); \
} \
break; \
}
diff --git a/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt b/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt
index 5da3c98ff48..6d5cbb94358 100644
--- a/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt
+++ b/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt
@@ -1,6 +1,6 @@
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "")
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/runcat.sh" "#!/bin/bash
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/runcat.sh" "#!/bin/sh
out=$1; shift
exec \"$@\" >$out")
@@ -8,7 +8,7 @@ add_executable(make_tdb make_tdb.cc)
set_property(TARGET make_tdb APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/db.h"
- COMMAND bash runcat.sh "${CMAKE_CURRENT_BINARY_DIR}/db.h" $<TARGET_FILE:make_tdb>
+ COMMAND sh runcat.sh "${CMAKE_CURRENT_BINARY_DIR}/db.h" $<TARGET_FILE:make_tdb>
DEPENDS make_tdb)
add_custom_target(install_tdb_h DEPENDS
"${CMAKE_CURRENT_BINARY_DIR}/db.h")
diff --git a/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result b/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result
index 640c7badc71..6269b8f2d71 100644
--- a/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result
+++ b/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result
@@ -182,14 +182,14 @@ a b c d e f
3 30 200 2000 20000 200000
explain select * from t1 where b > "0";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index
+1 SIMPLE t1 <type> b b NULL NULL NULL; Using where; Using index
select * from t1 where b > "0";
a b c d e f
2 20 100 1000 10000 100000
3 30 200 2000 20000 200000
explain select * from t1 where d > "0";
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index
+1 SIMPLE t1 <type> d d NULL NULL NULL; Using where; Using index
select * from t1 where d > "0";
a b c d e f
2 20 100 1000 10000 100000
diff --git a/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test b/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test
index d1be871c7d2..e9bb18a586e 100644
--- a/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test
+++ b/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test
@@ -82,11 +82,11 @@ alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes;
explain select * from t1;
select * from t1;
---replace_column 7 NULL 9 NULL;
+--replace_column 4 <type> 7 NULL 9 NULL;
explain select * from t1 where b > "0";
select * from t1 where b > "0";
---replace_column 7 NULL 9 NULL;
+--replace_column 4 <type> 7 NULL 9 NULL;
explain select * from t1 where d > "0";
select * from t1 where d > "0";
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 03020896542..ceffa950739 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
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
@@ -662,7 +662,7 @@ fil_space_encrypt(
return src_frame;
}
- ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+ ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, zip_size, dst_frame);
@@ -712,21 +712,37 @@ fil_space_decrypt(
ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE);
uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
-
+ ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET);
+ ulint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
*err = DB_SUCCESS;
if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) {
return false;
}
- ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+ if (crypt_data == NULL) {
+ if (!(space == 0 && offset == 0) && key_version != 0) {
+ /* FIL_PAGE_FILE_FLUSH_LSN field i.e.
+ FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ should be only defined for the
+ first page in a system tablespace
+ data file (ibdata*, not *.ibd), if not
+ clear it. */
+#ifdef UNIV_DEBUG
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Page on space %lu offset %lu has key_version %u"
+ " when it shoud be undefined.",
+ space, offset, key_version);
+#endif
+ mach_write_to_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0);
+ }
+ return false;
+ }
- /* read space & offset & lsn */
- ulint space = mach_read_from_4(
- src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- ulint offset = mach_read_from_4(
- src_frame + FIL_PAGE_OFFSET);
- ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN);
+ ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF);
+
+ /* read space & lsn */
ulint header_len = FIL_PAGE_DATA;
if (page_compressed) {
@@ -2506,6 +2522,7 @@ fil_space_crypt_get_status(
mutex_enter(&crypt_data->mutex);
status->keyserver_requests = crypt_data->keyserver_requests;
status->min_key_version = crypt_data->min_key_version;
+ status->key_id = crypt_data->key_id;
if (crypt_data->rotate_state.active_threads > 0 ||
crypt_data->rotate_state.flushing) {
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 5f0c52b5cc8..b60a0e9ddaf 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -3240,9 +3240,12 @@ fil_create_link_file(
link_filepath = fil_make_isl_name(tablename);
+ /* Note that OS_FILE_READ_WRITE_CACHED used here to avoid
+ unnecessary errors on O_DIRECT, link files are not really
+ a data files. */
file = os_file_create_simple_no_error_handling(
innodb_file_data_key, link_filepath,
- OS_FILE_CREATE, OS_FILE_READ_WRITE, &success, 0);
+ OS_FILE_CREATE, OS_FILE_READ_WRITE_CACHED, &success, 0);
if (!success) {
/* The following call will print an error message */
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 7a381f4ca05..712dfa264d4 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -6274,7 +6274,7 @@ fts_fake_hex_to_dec(
#ifdef _WIN32
ret = sscanf(tmp_id, "%016llu", &dec_id);
#else
- ret = sscanf(tmp_id, "%016"PRIu64, &dec_id);
+ ret = sscanf(tmp_id, "%016" PRIu64, &dec_id);
#endif /* _WIN32 */
ut_ad(ret == 1);
diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc
index e096b8bf6d6..0703b050848 100644
--- a/storage/xtradb/fts/fts0opt.cc
+++ b/storage/xtradb/fts/fts0opt.cc
@@ -598,7 +598,7 @@ fts_zip_read_word(
/* Finished decompressing block. */
if (zip->zp->avail_in == 0) {
- /* Free the block thats been decompressed. */
+ /* Free the block that's been decompressed. */
if (zip->pos > 0) {
ulint prev = zip->pos - 1;
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 29b02ee5e55..b6d259c8bda 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,11 +1,10 @@
/*****************************************************************************
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
-Copyright (c) 2013, 2015, MariaDB Corporation.
+Copyright (c) 2013, 2016, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2014 SkySQL Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -8317,8 +8316,8 @@ ha_innobase::write_row(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -8670,8 +8669,8 @@ func_exit:
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -9090,8 +9089,8 @@ ha_innobase::update_row(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -9211,8 +9210,8 @@ wsrep_error:
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -12739,8 +12738,8 @@ ha_innobase::truncate()
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -12760,8 +12759,8 @@ ha_innobase::truncate()
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -14156,8 +14155,8 @@ ha_innobase::analyze(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -14172,8 +14171,8 @@ ha_innobase::analyze(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -15387,8 +15386,8 @@ ha_innobase::transactional_table_lock(
if (share->ib_table != prebuilt->table) {
fprintf(stderr,
- "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.",
- share->ib_table, prebuilt->table, prebuilt->table->name, (int) prebuilt->table->is_corrupt);
+ "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.",
+ share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt);
}
if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt)) {
@@ -21124,7 +21123,7 @@ maria_declare_plugin(xtradb)
innodb_status_variables_export,/* status variables */
innobase_system_variables, /* system variables */
INNODB_VERSION_STR, /* string version */
- MariaDB_PLUGIN_MATURITY_BETA /* maturity */
+ MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
},
i_s_xtradb_read_view,
i_s_xtradb_internal_hash_tables,
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index e124cb98f99..a131a50458a 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyrigth (c) 2014, 2015, MariaDB Corporation
+Copyrigth (c) 2014, 2016, 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
@@ -792,7 +792,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_trx =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
@@ -1050,7 +1050,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_locks =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
@@ -1231,7 +1231,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/*******************************************************************//**
@@ -1565,7 +1565,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset =
@@ -1613,7 +1613,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/* Fields of the dynamic tables
@@ -1912,7 +1912,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset =
@@ -1961,7 +1961,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
@@ -2203,7 +2203,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset =
@@ -2251,7 +2251,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */
@@ -2774,7 +2774,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_metrics =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */
static ST_FIELD_INFO i_s_stopword_fields_info[] =
@@ -2886,7 +2886,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_default_stopword =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED
@@ -3053,7 +3053,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_deleted =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/*******************************************************************//**
@@ -3135,7 +3135,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_being_deleted =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and
@@ -3423,7 +3423,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_cache =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/*******************************************************************//**
@@ -3857,7 +3857,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_table =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */
@@ -4054,7 +4054,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_config =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */
@@ -4601,7 +4601,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */
@@ -5310,7 +5310,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] =
@@ -5855,7 +5855,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page_lru =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/*******************************************************************//**
@@ -6147,7 +6147,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** SYS_TABLESTATS ***********************************************/
@@ -6435,7 +6435,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** SYS_INDEXES **************************************************/
@@ -6685,7 +6685,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** SYS_COLUMNS **************************************************/
@@ -6920,7 +6920,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** SYS_FIELDS ***************************************************/
@@ -7128,7 +7128,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** SYS_FOREIGN ********************************************/
@@ -7351,7 +7351,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** SYS_FOREIGN_COLS ********************************************/
@@ -7566,7 +7566,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** SYS_TABLESPACES ********************************************/
@@ -7833,7 +7833,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablespaces =
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_DATAFILES ************************************************/
@@ -8020,7 +8020,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_datafiles =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
static ST_FIELD_INFO i_s_innodb_changed_pages_info[] =
@@ -8389,7 +8389,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_changed_pages =
STRUCT_FLD(version, 0x0100 /* 1.0 */),
STRUCT_FLD(status_vars, NULL),
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** TABLESPACES_ENCRYPTION ********************************************/
@@ -8468,6 +8468,15 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] =
STRUCT_FLD(old_name, ""),
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+#define TABLESPACES_ENCRYPTION_CURRENT_KEY_ID 8
+ {STRUCT_FLD(field_name, "CURRENT_KEY_ID"),
+ STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
+ STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
+ STRUCT_FLD(value, 0),
+ STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
+ STRUCT_FLD(old_name, ""),
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
+
END_OF_ST_FIELD_INFO
};
@@ -8506,6 +8515,8 @@ i_s_dict_fill_tablespaces_encryption(
status.min_key_version));
OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION]->store(
status.current_key_version));
+ OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store(
+ status.key_id));
if (status.rotating) {
fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull();
OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store(
@@ -8670,7 +8681,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption =
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
- INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA
+ INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA
};
/** TABLESPACES_SCRUBBING ********************************************/
@@ -8969,7 +8980,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA)
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA)
};
/** INNODB_MUTEXES *********************************************/
@@ -9183,7 +9194,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_mutexes =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
/** SYS_SEMAPHORE_WAITS ************************************************/
@@ -9460,7 +9471,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_semaphore_waits =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
static ST_FIELD_INFO innodb_changed_page_bitmaps_fields_info[] =
@@ -9584,6 +9595,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_changed_page_bitmaps =
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
diff --git a/storage/xtradb/handler/xtradb_i_s.cc b/storage/xtradb/handler/xtradb_i_s.cc
index 207682e3154..a0ff959013a 100644
--- a/storage/xtradb/handler/xtradb_i_s.cc
+++ b/storage/xtradb/handler/xtradb_i_s.cc
@@ -176,7 +176,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_read_view =
STRUCT_FLD(status_vars, NULL),
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
static ST_FIELD_INFO xtradb_internal_hash_tables_fields_info[] =
@@ -381,7 +381,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_internal_hash_tables =
STRUCT_FLD(status_vars, NULL),
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
@@ -514,5 +514,5 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_rseg =
STRUCT_FLD(status_vars, NULL),
STRUCT_FLD(system_vars, NULL),
STRUCT_FLD(version_info, INNODB_VERSION_STR),
- STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA),
+ STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA),
};
diff --git a/storage/xtradb/include/fil0crypt.h b/storage/xtradb/include/fil0crypt.h
index 32462661cd6..5deed1f001c 100644
--- a/storage/xtradb/include/fil0crypt.h
+++ b/storage/xtradb/include/fil0crypt.h
@@ -333,6 +333,7 @@ struct fil_space_crypt_status_t {
uint min_key_version; /*!< min key version */
uint current_key_version;/*!< current key version */
uint keyserver_requests;/*!< no of key requests to key server */
+ ulint key_id; /*!< current key_id */
bool rotating; /*!< is key rotation ongoing */
bool flushing; /*!< is flush at end of rotation ongoing */
ulint rotate_next_page_number; /*!< next page if key rotating */
diff --git a/storage/xtradb/include/fts0priv.ic b/storage/xtradb/include/fts0priv.ic
index 2d07c60f980..ec61691870b 100644
--- a/storage/xtradb/include/fts0priv.ic
+++ b/storage/xtradb/include/fts0priv.ic
@@ -53,7 +53,7 @@ fts_write_object_id(
/* Use this to construct old(5.6.14 and 5.7.3) windows
ambiguous aux table names */
DBUG_EXECUTE_IF("innodb_test_wrong_windows_fts_aux_table_name",
- return(sprintf(str, "%016"PRIu64, id)););
+ return(sprintf(str, "%016" PRIu64, id)););
DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name",
return(sprintf(str, UINT64PFx, id)););
@@ -66,7 +66,7 @@ fts_write_object_id(
// FIXME: Use ut_snprintf(), so does following one.
return(sprintf(str, "%016llu", id));
#else /* _WIN32 */
- return(sprintf(str, "%016"PRIu64, id));
+ return(sprintf(str, "%016" PRIu64, id));
#endif /* _WIN32 */
}
diff --git a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h
index b23a140aac2..8fc5daaef1d 100644
--- a/storage/xtradb/include/log0recv.h
+++ b/storage/xtradb/include/log0recv.h
@@ -43,7 +43,8 @@ UNIV_INTERN
ibool
log_block_checksum_is_ok_or_old_format(
/*===================================*/
- const byte* block); /*!< in: pointer to a log block */
+ const byte* block, /*!< in: pointer to a log block */
+ bool print_err); /*!< in print error ? */
/*******************************************************//**
Calculates the new value for lsn when more data is added to the log. */
diff --git a/storage/xtradb/log/log0crypt.cc b/storage/xtradb/log/log0crypt.cc
index e90533c2e76..852148899e9 100644
--- a/storage/xtradb/log/log0crypt.cc
+++ b/storage/xtradb/log/log0crypt.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
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
@@ -36,6 +36,8 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "my_crypt.h"
+/* Used for debugging */
+// #define DEBUG_CRYPT 1
#define UNENCRYPTED_KEY_VER 0
/* If true, enable redo log encryption. */
@@ -97,16 +99,24 @@ get_crypt_info(
{
/* so that no one is modifying array while we search */
ut_ad(mutex_own(&(log_sys->mutex)));
+ size_t items = crypt_info.size();
/* a log block only stores 4-bytes of checkpoint no */
checkpoint_no &= 0xFFFFFFFF;
- for (size_t i = 0; i < crypt_info.size(); i++) {
+ for (size_t i = 0; i < items; i++) {
struct crypt_info_t* it = &crypt_info[i];
if (it->checkpoint_no == checkpoint_no) {
return it;
}
}
+
+ /* If checkpoint contains more than one key and we did not
+ find the correct one use the first one. */
+ if (items) {
+ return (&crypt_info[0]);
+ }
+
return NULL;
}
@@ -131,7 +141,8 @@ log_blocks_crypt(
const byte* block, /*!< in: blocks before encrypt/decrypt*/
ulint size, /*!< in: size of block */
byte* dst_block, /*!< out: blocks after encrypt/decrypt */
- int what) /*!< in: encrypt or decrypt*/
+ int what, /*!< in: encrypt or decrypt*/
+ const crypt_info_t* crypt_info) /*!< in: crypt info or NULL */
{
byte *log_block = (byte*)block;
Crypt_result rc = MY_AES_OK;
@@ -146,7 +157,8 @@ log_blocks_crypt(
lsn_t log_block_start_lsn = log_block_get_start_lsn(
lsn, log_block_no);
- const crypt_info_t* info = get_crypt_info(log_block);
+ const crypt_info_t* info = crypt_info == NULL ? get_crypt_info(log_block) :
+ crypt_info;
#ifdef DEBUG_CRYPT
fprintf(stderr,
"%s %lu chkpt: %lu key: %u lsn: %lu\n",
@@ -156,12 +168,21 @@ log_blocks_crypt(
info ? info->key_version : 0,
log_block_start_lsn);
#endif
+ /* If no key is found from checkpoint assume the log_block
+ to be unencrypted. If checkpoint contains the encryption key
+ compare log_block current checksum, if checksum matches,
+ block can't be encrypted. */
if (info == NULL ||
- info->key_version == UNENCRYPTED_KEY_VER) {
+ info->key_version == UNENCRYPTED_KEY_VER ||
+ (log_block_checksum_is_ok_or_old_format(log_block, false) &&
+ what == ENCRYPTION_FLAG_DECRYPT)) {
memcpy(dst_block, log_block, OS_FILE_LOG_BLOCK_SIZE);
goto next;
}
+ ut_ad(what == ENCRYPTION_FLAG_DECRYPT ? !log_block_checksum_is_ok_or_old_format(log_block, false) :
+ log_block_checksum_is_ok_or_old_format(log_block, false));
+
// Assume log block header is not encrypted
memcpy(dst_block, log_block, LOG_BLOCK_HDR_SIZE);
@@ -292,7 +313,7 @@ log_blocks_encrypt(
const ulint size, /*!< in: size of blocks, must be multiple of a log block */
byte* dst_block) /*!< out: blocks after encryption */
{
- return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT);
+ return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT, NULL);
}
/*********************************************************************//**
@@ -355,14 +376,16 @@ log_encrypt_before_write(
return;
}
- if (info->key_version == UNENCRYPTED_KEY_VER) {
+ /* If the key is not encrypted or user has requested not to
+ encrypt, do not change log block. */
+ if (info->key_version == UNENCRYPTED_KEY_VER || !srv_encrypt_log) {
return;
}
byte* dst_frame = (byte*)malloc(size);
//encrypt log blocks content
- Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT);
+ Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL);
if (result == MY_AES_OK) {
ut_ad(block[0] == dst_frame[0]);
@@ -388,7 +411,7 @@ log_decrypt_after_read(
byte* dst_frame = (byte*)malloc(size);
// decrypt log blocks content
- Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT);
+ Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL);
if (result == MY_AES_OK) {
memcpy(frame, dst_frame, size);
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 853afe70100..36531f3c6f4 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -2,6 +2,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
+Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -33,10 +34,13 @@ Created 12/9/1995 Heikki Tuuri
#include "config.h"
#ifdef HAVE_ALLOCA_H
#include "alloca.h"
-#elif defined(HAVE_MALLOC_H)
+#elif defined(HAVE_MALLOC_H)
#include "malloc.h"
#endif
+/* Used for debugging */
+// #define DEBUG_CRYPT 1
+
#include "log0log.h"
#ifdef UNIV_NONINL
@@ -1394,7 +1398,6 @@ log_group_file_header_flush(
Stores a 4-byte checksum to the trailer checksum field of a log block
before writing it to a log file. This checksum is used in recovery to
check the consistency of a log block. */
-static
void
log_block_store_checksum(
/*=====================*/
@@ -1512,6 +1515,14 @@ loop:
log_encrypt_before_write(log_sys->next_checkpoint_no,
buf, write_len);
+#ifdef DEBUG_CRYPT
+ fprintf(stderr, "WRITE: block: %lu checkpoint: %lu %.8lx %.8lx\n",
+ log_block_get_hdr_no(buf),
+ log_block_get_checkpoint_no(buf),
+ log_block_calc_checksum(buf),
+ log_block_get_checksum(buf));
+#endif
+
fil_io(OS_FILE_WRITE | OS_FILE_LOG, true, group->space_id, 0,
(ulint) (next_offset / UNIV_PAGE_SIZE),
(ulint) (next_offset % UNIV_PAGE_SIZE), write_len, buf,
@@ -2320,7 +2331,10 @@ log_checkpoint(
* the checkpoint info has been written and THEN blocks will be encrypted
* with new key
*/
- log_crypt_set_ver_and_key(log_sys->next_checkpoint_no + 1);
+ if (srv_encrypt_log) {
+ log_crypt_set_ver_and_key(log_sys->next_checkpoint_no + 1);
+ }
+
log_groups_write_checkpoint_info();
MONITOR_INC(MONITOR_NUM_CHECKPOINT);
@@ -2585,8 +2599,24 @@ loop:
mutex_enter(&log_sys->mutex);
}
+#ifdef DEBUG_CRYPT
+ fprintf(stderr, "BEFORE DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx offset %lu\n",
+ log_block_get_hdr_no(buf),
+ log_block_get_checkpoint_no(buf),
+ log_block_calc_checksum(buf),
+ log_block_get_checksum(buf), source_offset);
+#endif
+
log_decrypt_after_read(buf, len);
+#ifdef DEBUG_CRYPT
+ fprintf(stderr, "AFTER DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx\n",
+ log_block_get_hdr_no(buf),
+ log_block_get_checkpoint_no(buf),
+ log_block_calc_checksum(buf),
+ log_block_get_checksum(buf));
+#endif
+
if (release_mutex) {
mutex_exit(&log_sys->mutex);
}
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index 92f03f0e6a9..51a9fa8f6c5 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -905,7 +905,7 @@ log_online_is_valid_log_seg(
const byte* log_block) /*!< in: read log data */
{
ibool checksum_is_ok
- = log_block_checksum_is_ok_or_old_format(log_block);
+ = log_block_checksum_is_ok_or_old_format(log_block, true);
if (!checksum_is_ok) {
diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc
index c9bf5cf3f9e..f98adbbca08 100644
--- a/storage/xtradb/log/log0recv.cc
+++ b/storage/xtradb/log/log0recv.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved.
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
@@ -43,7 +43,7 @@ Created 9/20/1997 Heikki Tuuri
#include "config.h"
#ifdef HAVE_ALLOCA_H
#include "alloca.h"
-#elif defined(HAVE_MALLOC_H)
+#elif defined(HAVE_MALLOC_H)
#include "malloc.h"
#endif
@@ -932,7 +932,8 @@ UNIV_INTERN
ibool
log_block_checksum_is_ok_or_old_format(
/*===================================*/
- const byte* block) /*!< in: pointer to a log block */
+ const byte* block, /*!< in: pointer to a log block */
+ bool print_err) /*!< in print if error found */
{
#ifdef UNIV_LOG_DEBUG
return(TRUE);
@@ -1015,11 +1016,13 @@ log_block_checksum_is_ok_or_old_format(
return(TRUE);
}
- fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n",
- log_block_get_hdr_no(block),
- log_block_get_checkpoint_no(block),
- log_block_calc_checksum(block),
- log_block_get_checksum(block));
+ if (print_err) {
+ fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n",
+ log_block_get_hdr_no(block),
+ log_block_get_checkpoint_no(block),
+ log_block_calc_checksum(block),
+ log_block_get_checksum(block));
+ }
return(FALSE);
}
@@ -2734,6 +2737,7 @@ recv_scan_log_recs(
ibool finished;
ulint data_len;
ibool more_data;
+ bool maybe_encrypted=false;
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -2748,6 +2752,8 @@ recv_scan_log_recs(
*err = DB_SUCCESS;
do {
+ log_crypt_err_t log_crypt_err;
+
no = log_block_get_hdr_no(log_block);
/*
fprintf(stderr, "Log block header no %lu\n", no);
@@ -2755,13 +2761,13 @@ recv_scan_log_recs(
fprintf(stderr, "Scanned lsn no %lu\n",
log_block_convert_lsn_to_no(scanned_lsn));
*/
+
if (no != log_block_convert_lsn_to_no(scanned_lsn)
- || !log_block_checksum_is_ok_or_old_format(log_block)) {
- log_crypt_err_t log_crypt_err;
+ || !log_block_checksum_is_ok_or_old_format(log_block, true)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn)
&& !log_block_checksum_is_ok_or_old_format(
- log_block)) {
+ log_block, true)) {
fprintf(stderr,
"InnoDB: Log block no %lu at"
" lsn " LSN_PF " has\n"
@@ -2775,12 +2781,14 @@ recv_scan_log_recs(
log_block));
}
+ maybe_encrypted = log_crypt_block_maybe_encrypted(log_block,
+ &log_crypt_err);
+
/* Garbage or an incompletely written log block */
finished = TRUE;
- if (log_crypt_block_maybe_encrypted(log_block,
- &log_crypt_err)) {
+ if (maybe_encrypted) {
/* Log block maybe encrypted finish processing*/
log_crypt_print_error(log_crypt_err);
*err = DB_ERROR;
@@ -2790,12 +2798,13 @@ recv_scan_log_recs(
/* Stop if we encounter a garbage log block */
if (!srv_force_recovery) {
fputs("InnoDB: Set innodb_force_recovery"
- " to ignore this error.\n", stderr);
+ " to ignore this error.\n", stderr);
*err = DB_ERROR;
return (TRUE);
}
break;
+
}
if (log_block_get_flush_bit(log_block)) {
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index 7f13c1656ee..b2b3e256211 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2015, MariaDB Corporation.
+Copyright (c) 2013, 2016, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -1422,7 +1422,8 @@ os_file_create_simple_func(
access = GENERIC_READ;
- } else if (access_type == OS_FILE_READ_WRITE) {
+ } else if (access_type == OS_FILE_READ_WRITE
+ || access_type == OS_FILE_READ_WRITE_CACHED) {
access = GENERIC_READ | GENERIC_WRITE;
} else {
ib_logf(IB_LOG_LEVEL_ERROR,
@@ -1526,7 +1527,8 @@ os_file_create_simple_func(
#ifdef USE_FILE_LOCK
if (!srv_read_only_mode
&& *success
- && access_type == OS_FILE_READ_WRITE
+ && (access_type == OS_FILE_READ_WRITE
+ || access_type == OS_FILE_READ_WRITE_CACHED)
&& os_file_lock(file, name)) {
*success = FALSE;
@@ -1554,15 +1556,16 @@ os_file_set_nocache_if_needed(os_file_t file, const char* name,
const char *mode_str, ulint type,
ulint access_type)
{
- if (srv_read_only_mode || access_type == OS_FILE_READ_WRITE_CACHED)
+ if (srv_read_only_mode || access_type == OS_FILE_READ_WRITE_CACHED) {
return;
+ }
if (srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT
- || (type != OS_LOG_FILE
+ || (type == OS_LOG_FILE
&& (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
- || (srv_unix_file_flush_method
- == SRV_UNIX_O_DIRECT_NO_FSYNC))))
+ || (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)))) {
os_file_set_nocache(file, name, mode_str);
+ }
}
/****************************************************************//**
@@ -2154,8 +2157,9 @@ os_file_create_func(
} while (retry);
- if (*success) {
+ /* We disable OS caching (O_DIRECT) only on data files */
+ if (*success) {
os_file_set_nocache_if_needed(file, name, mode_str, type, 0);
}
@@ -3144,7 +3148,7 @@ try_again:
"Error in system call pread(). The operating"
" system error number is %lu.",(ulint) errno);
} else {
- /* Partial read occured */
+ /* Partial read occurred */
ib_logf(IB_LOG_LEVEL_ERROR,
"Tried to read " ULINTPF " bytes at offset "
UINT64PF ". Was only able to read %ld.",
@@ -3248,7 +3252,7 @@ try_again:
"Error in system call pread(). The operating"
" system error number is %lu.",(ulint) errno);
} else {
- /* Partial read occured */
+ /* Partial read occurred */
ib_logf(IB_LOG_LEVEL_ERROR,
"Tried to read " ULINTPF " bytes at offset "
UINT64PF ". Was only able to read %ld.",
diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc
index 35719391fae..2bebfb7a0f1 100644
--- a/storage/xtradb/row/row0sel.cc
+++ b/storage/xtradb/row/row0sel.cc
@@ -3751,12 +3751,6 @@ row_search_for_mysql(
ut_error;
}
- /* init null bytes with default values as they might be
- left uninitialized in some cases and these uninited bytes
- might be copied into mysql record buffer that leads to
- valgrind warnings */
- memcpy(buf, prebuilt->default_rec, prebuilt->null_bitmap_len);
-
#if 0
/* August 19, 2005 by Heikki: temporarily disable this error
print until the cursor lock count is done correctly.
diff --git a/storage/xtradb/ut/crc32_power8/crc32.S b/storage/xtradb/ut/crc32_power8/crc32.S
index 52046bb9002..b064ce3dc96 100644
--- a/storage/xtradb/ut/crc32_power8/crc32.S
+++ b/storage/xtradb/ut/crc32_power8/crc32.S
@@ -67,14 +67,13 @@
#define off96 r30
#define off112 r31
-#define const1 v25
-#define const2 v26
+#define const1 v24
+#define const2 v25
-#define byteswap v27
-#define mask_32bit v28
-#define mask_64bit v29
-#define zeroes v30
-#define ones v31
+#define byteswap v26
+#define mask_32bit v27
+#define mask_64bit v28
+#define zeroes v29
#ifdef BYTESWAP_DATA
#define VPERM(A, B, C, D) vperm A, B, C, D
@@ -101,13 +100,28 @@ FUNC_START(__crc32_vpmsum)
li off112,112
li r0,0
+ /* Enough room for saving 10 non volatile VMX registers */
+ subi r6,r1,56+10*16
+ subi r7,r1,56+2*16
+
+ stvx v20,0,r6
+ stvx v21,off16,r6
+ stvx v22,off32,r6
+ stvx v23,off48,r6
+ stvx v24,off64,r6
+ stvx v25,off80,r6
+ stvx v26,off96,r6
+ stvx v27,off112,r6
+ stvx v28,0,r7
+ stvx v29,off16,r7
+
mr r10,r3
vxor zeroes,zeroes,zeroes
- vspltisw ones,-1
+ vspltisw v0,-1
- vsldoi mask_32bit,zeroes,ones,4
- vsldoi mask_64bit,zeroes,ones,8
+ vsldoi mask_32bit,zeroes,v0,4
+ vsldoi mask_64bit,zeroes,v0,8
/* Get the initial value into v8 */
vxor v8,v8,v8
@@ -570,6 +584,21 @@ FUNC_START(__crc32_vpmsum)
vsldoi v0,v0,zeroes,4 /* shift result into top 64 bits of */
#endif
+.Lout:
+ subi r6,r1,56+10*16
+ subi r7,r1,56+2*16
+
+ lvx v20,0,r6
+ lvx v21,off16,r6
+ lvx v22,off32,r6
+ lvx v23,off48,r6
+ lvx v24,off64,r6
+ lvx v25,off80,r6
+ lvx v26,off96,r6
+ lvx v27,off112,r6
+ lvx v28,0,r7
+ lvx v29,off16,r7
+
/* Get it into r3 */
MFVRD(r3, v0)
@@ -739,6 +768,8 @@ FUNC_START(__crc32_vpmsum)
.Lzero:
mr r3,r10
blr
+ b .Lout
+
FUNC_END(__crc32_vpmsum)
#endif /* __powerpc__ */