summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2019-07-09 13:22:22 +0300
committerEugene Kosov <claprix@yandex.ru>2019-07-09 13:22:22 +0300
commit26c389b7b770a3699ec1fc81df7f379f6084c9e6 (patch)
tree7f915e858b211834deeb52928dfdf5ab12b24bfe /storage
parentb9557418ccd9f484806515fba030757274e691f2 (diff)
parentfd08f953222b854428dc259631e8fc707fe34619 (diff)
downloadmariadb-git-26c389b7b770a3699ec1fc81df7f379f6084c9e6.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/array.cpp4
-rw-r--r--storage/connect/csort.cpp22
-rw-r--r--storage/connect/ha_connect.cc4
-rw-r--r--storage/connect/odbconn.cpp2
-rw-r--r--storage/connect/valblk.cpp4
-rw-r--r--storage/connect/xindex.cpp18
-rw-r--r--storage/innobase/row/row0ins.cc7
-rw-r--r--storage/maria/ma_blockrec.c2
-rw-r--r--storage/maria/ma_checkpoint.c2
-rw-r--r--storage/maria/ma_loghandler.c17
-rw-r--r--storage/maria/ma_open.c2
-rw-r--r--storage/maria/ma_recovery.c38
-rw-r--r--storage/maria/ma_recovery_util.c12
-rw-r--r--storage/spider/spd_table.cc2
-rw-r--r--storage/xtradb/row/row0ins.cc7
15 files changed, 85 insertions, 58 deletions
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp
index cd1785b48ac..483139bc955 100644
--- a/storage/connect/array.cpp
+++ b/storage/connect/array.cpp
@@ -457,7 +457,7 @@ char *ARRAY::GetStringValue(int n)
/***********************************************************************/
bool ARRAY::Find(PVAL valp)
{
- register int n;
+ int n;
PVAL vp;
if (Type != valp->GetType()) {
@@ -1065,7 +1065,7 @@ MULAR::MULAR(PGLOBAL g, int n) : CSORT(false)
/***********************************************************************/
int MULAR::Qcompare(int *i1, int *i2)
{
- register int i, n = 0;
+ int i, n = 0;
for (i = 0; i < Narray; i++)
if ((n = Pars[i]->Qcompare(i1, i2)))
diff --git a/storage/connect/csort.cpp b/storage/connect/csort.cpp
index 670131b8fd2..1e4ba674e23 100644
--- a/storage/connect/csort.cpp
+++ b/storage/connect/csort.cpp
@@ -178,9 +178,9 @@ void CSORT::DebugSort(int ph, int n, int *base, int *mid, int *tmp)
/***********************************************************************/
int CSORT::Qsortx(void)
{
- register int c;
- register int lo, hi, min;
- register int i, j, rc = 0;
+ int c;
+ int lo, hi, min;
+ int i, j, rc = 0;
// To do: rc should be checked for being used uninitialized
int *top;
#ifdef DEBTRACE
@@ -344,7 +344,7 @@ int CSORT::Qsortx(void)
/***********************************************************************/
void CSORT::Qstx(int *base, int *max)
{
- register int *i, *j, *jj, *mid, *him, c;
+ int *i, *j, *jj, *mid, *him, c;
int *tmp;
int lo, hi, rc;
size_t zlo, zhi, cnm;
@@ -543,9 +543,9 @@ void CSORT::Qstx(int *base, int *max)
/***********************************************************************/
int CSORT::Qsortc(void)
{
- register int c;
- register int lo, hi, min;
- register int i, j, k, m, rc = 0;
+ int c;
+ int lo, hi, min;
+ int i, j, k, m, rc = 0;
// To do: rc should be checked for being used uninitialized
int *max;
#ifdef DEBTRACE
@@ -720,7 +720,7 @@ int CSORT::Qsortc(void)
/***********************************************************************/
void CSORT::Qstc(int *base, int *max)
{
- register int *i, *j, *jj, *lt, *eq, *gt, *mid;
+ int *i, *j, *jj, *lt, *eq, *gt, *mid;
int c = 0, lo, hi, rc;
size_t zlo, zhi, cnm;
@@ -907,9 +907,9 @@ void CSORT::Qstc(int *base, int *max)
/***********************************************************************/
void CSORT::Istc(int *base, int *hi, int *max)
{
- register int c = 0;
- register int *lo;
- register int *i, *j;
+ int c = 0;
+ int *lo;
+ int *i, *j;
/*********************************************************************/
/* First put smallest element, which must be in the first THRESH, */
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 6c834b6d38e..1b3e59214a0 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -3071,7 +3071,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
strncat(s, res->ptr(), res->length());
if (res->length() < 19)
- strcat(s, "1970-01-01 00:00:00" + res->length());
+ strcat(s, &"1970-01-01 00:00:00"[res->length()]);
strcat(s, "'}");
break;
@@ -3101,7 +3101,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
strncat(s, res->ptr(), res->length());
if (res->length() < 19)
- strcat(s, "1970-01-01 00:00:00" + res->length());
+ strcat(s, &"1970-01-01 00:00:00"[res->length()]);
strcat(s, "'}");
break;
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index 6687513fa6c..d08c6d1b7a5 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -2279,7 +2279,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
int i, irc;
bool b;
PCSZ fnc = "Unknown";
- UWORD n;
+ UWORD n = 0;
SWORD ncol, len, tp;
SQLULEN crow = 0;
PQRYRES qrp = cap->Qrp;
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index 73ca135691c..5179fa654cf 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -511,7 +511,7 @@ void TYPBLK<TYPE>::SetValues(PVBLK pv, int k, int n)
CheckType(pv)
TYPE *lp = ((TYPBLK*)pv)->Typp;
- for (register int i = k; i < n; i++) // TODO
+ for (int i = k; i < n; i++) // TODO
Typp[i] = lp[i];
} // end of SetValues
@@ -805,7 +805,7 @@ void CHRBLK::SetValue(const char *sp, uint len, int n)
if (Blanks) {
// Suppress eventual ending zero and right fill with blanks
- for (register int i = len; i < Long; i++)
+ for (int i = len; i < Long; i++)
p[i] = ' ';
} else if ((signed)len < Long)
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index efefc17b5f5..db4d6cbb00d 100644
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -272,8 +272,8 @@ void XINDEX::Close(void)
/***********************************************************************/
int XINDEX::Qcompare(int *i1, int *i2)
{
- register int k;
- register PXCOL kcp;
+ int k;
+ PXCOL kcp;
for (kcp = To_KeyCol, k = 0; kcp; kcp = kcp->Next)
if ((k = kcp->Compare(*i1, *i2)))
@@ -745,7 +745,7 @@ int XINDEX::ColMaxSame(PXCOL kp)
/***********************************************************************/
bool XINDEX::Reorder(PGLOBAL g __attribute__((unused)))
{
- register int i, j, k, n;
+ int i, j, k, n;
bool sorted = true;
PXCOL kcp;
#if 0
@@ -1870,8 +1870,8 @@ int XINDEX::Fetch(PGLOBAL g)
/***********************************************************************/
int XINDEX::FastFind(void)
{
- register int curk, sup, inf, i= 0, k, n = 2;
- register PXCOL kp, kcp;
+ int curk, sup, inf, i= 0, k, n = 2;
+ PXCOL kp, kcp;
//assert((int)nv == Nval);
@@ -2209,8 +2209,8 @@ int XINDXS::Fetch(PGLOBAL g)
/***********************************************************************/
int XINDXS::FastFind(void)
{
- register int sup, inf, i= 0, n = 2;
- register PXCOL kcp = To_KeyCol;
+ int sup, inf, i= 0, n = 2;
+ PXCOL kcp = To_KeyCol;
if (Nblk && Op == OP_EQ) {
// Look in block values to find in which block to search
@@ -3235,7 +3235,7 @@ void KXYCOL::FillValue(PVAL valp)
int KXYCOL::Compare(int i1, int i2)
{
// Do the actual comparison between values.
- register int k = Kblp->CompVal(i1, i2);
+ int k = Kblp->CompVal(i1, i2);
if (trace(4))
htrc("Compare done result=%d\n", k);
@@ -3250,7 +3250,7 @@ int KXYCOL::CompVal(int i)
{
// Do the actual comparison between numerical values.
if (trace(4)) {
- register int k = (int)Kblp->CompVal(Valp, (int)i);
+ int k = (int)Kblp->CompVal(Valp, (int)i);
htrc("Compare done result=%d\n", k);
return k;
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index b081f15b279..ce394390679 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1418,7 +1418,7 @@ row_ins_foreign_check_on_constraint(
cascade->state = UPD_NODE_UPDATE_CLUSTERED;
#ifdef WITH_WSREP
- err = wsrep_append_foreign_key(trx, foreign, clust_rec, clust_index,
+ err = wsrep_append_foreign_key(trx, foreign, cascade->pcur->old_rec, clust_index,
FALSE, WSREP_KEY_EXCLUSIVE);
if (err != DB_SUCCESS) {
fprintf(stderr,
@@ -1785,6 +1785,11 @@ row_ins_check_foreign_constraint(
check_index,
check_ref,
key_type);
+
+ if (err != DB_SUCCESS) {
+ fprintf(stderr,
+ "WSREP: foreign key append failed: %d\n", err);
+ }
#endif /* WITH_WSREP */
goto end_scan;
} else if (foreign->type != 0) {
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 13323dcae55..acf108f8886 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -7549,7 +7549,7 @@ void _ma_print_block_info(MARIA_SHARE *share, uchar *buff)
{
LSN lsn= lsn_korr(buff);
- printf("LSN:" LSN_FMT " type: %u dir_entries: %u dir_free: %u empty_space: %u\n",
+ printf("LSN: " LSN_FMT " type: %u dir_entries: %u dir_free: %u empty_space: %u\n",
LSN_IN_PARTS(lsn),
(uint)buff[PAGE_TYPE_OFFSET],
(uint)buff[DIR_COUNT_OFFSET],
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 726f87c0ab7..c2f3fe6dbd0 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -170,7 +170,7 @@ static int really_execute_checkpoint(void)
"Horizon" is a lower bound of the LSN of the next log record.
*/
checkpoint_start_log_horizon= translog_get_horizon();
- DBUG_PRINT("info",("checkpoint_start_log_horizon " LSN_FMT,
+ DBUG_PRINT("info",("checkpoint_start_log_horizon " LSN_FMT "",
LSN_IN_PARTS(checkpoint_start_log_horizon)));
lsn_store(checkpoint_start_log_horizon_char, checkpoint_start_log_horizon);
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index ec3cf26661f..1d5bfba182d 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -3856,7 +3856,14 @@ my_bool translog_init_with_table(const char *directory,
my_bool pageok;
DBUG_PRINT("info", ("The log is really present"));
- DBUG_ASSERT(sure_page <= last_page);
+ if (sure_page > last_page)
+ {
+ my_printf_error(HA_ERR_GENERIC, "Aria engine: log data error\n"
+ "last_log_page: " LSN_FMT " is less than\n"
+ "checkpoint page: " LSN_FMT, MYF(0),
+ LSN_IN_PARTS(last_page), LSN_IN_PARTS(sure_page));
+ goto err;
+ }
/* TODO: check page size */
@@ -4004,7 +4011,7 @@ my_bool translog_init_with_table(const char *directory,
if (!logs_found)
{
TRANSLOG_FILE *file= (TRANSLOG_FILE*)my_malloc(sizeof(TRANSLOG_FILE),
- MYF(0));
+ MYF(MY_WME));
DBUG_PRINT("info", ("The log is not found => we will create new log"));
if (file == NULL)
goto err;
@@ -5326,7 +5333,7 @@ static uchar *translog_put_LSN_diff(LSN base_lsn, LSN lsn, uchar *dst)
{
uint64 diff;
DBUG_ENTER("translog_put_LSN_diff");
- DBUG_PRINT("enter", ("Base: " LSN_FMT " val: " LSN_FMT " dst:%p",
+ DBUG_PRINT("enter", ("Base: " LSN_FMT " val: " LSN_FMT " dst: %p",
LSN_IN_PARTS(base_lsn), LSN_IN_PARTS(lsn),
dst));
DBUG_ASSERT(base_lsn > lsn);
@@ -5372,7 +5379,7 @@ static uchar *translog_put_LSN_diff(LSN base_lsn, LSN lsn, uchar *dst)
dst[1]= 1;
lsn_store(dst + 2, lsn);
}
- DBUG_PRINT("info", ("new dst:%p", dst));
+ DBUG_PRINT("info", ("new dst: %p", dst));
DBUG_RETURN(dst);
}
@@ -7990,7 +7997,7 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn,
{
struct st_translog_buffer *buffer= log_descriptor.buffers + i;
translog_buffer_lock(buffer);
- DBUG_PRINT("info", ("Check buffer:%p #: %u "
+ DBUG_PRINT("info", ("Check buffer: %p #: %u "
"prev last LSN: " LSN_FMT " "
"last LSN: " LSN_FMT " status: %s",
buffer,
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 52b94162a6b..87bded7ed50 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -1372,7 +1372,7 @@ uint _ma_state_info_write(MARIA_SHARE *share, uint pWrite)
is too new). Recovery does it by itself.
*/
share->state.is_of_horizon= translog_get_horizon();
- DBUG_PRINT("info", ("is_of_horizon set to LSN " LSN_FMT,
+ DBUG_PRINT("info", ("is_of_horizon set to LSN " LSN_FMT "",
LSN_IN_PARTS(share->state.is_of_horizon)));
}
res= _ma_state_info_write_sub(share->kfile.file, &share->state, pWrite);
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 249121340fd..c8031030361 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -531,8 +531,6 @@ end:
if (error && !abort_message_printed)
{
- if (!trace_file)
- fputc('\n', stderr);
my_message(HA_ERR_INITIALIZATION,
"Aria recovery failed. Please run aria_chk -r on all Aria "
"tables and delete all aria_log.######## files", MYF(0));
@@ -667,13 +665,16 @@ prototype_redo_exec_hook(INCOMPLETE_LOG)
{
MARIA_HA *info;
+ /* We try to get table first, so that we get the table in in the trace log */
+ info= get_MARIA_HA_from_REDO_record(rec);
+
if (skip_DDLs)
{
tprint(tracef, "we skip DDLs\n");
return 0;
}
- if ((info= get_MARIA_HA_from_REDO_record(rec)) == NULL)
+ if (!info)
{
/* no such table, don't need to warn */
return 0;
@@ -1144,6 +1145,9 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
my_bool quick_repair;
DBUG_ENTER("exec_REDO_LOGREC_REDO_REPAIR_TABLE");
+ /* We try to get table first, so that we get the table in in the trace log */
+ info= get_MARIA_HA_from_REDO_record(rec);
+
if (skip_DDLs)
{
/*
@@ -1153,8 +1157,13 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
tprint(tracef, "we skip DDLs\n");
DBUG_RETURN(0);
}
- if ((info= get_MARIA_HA_from_REDO_record(rec)) == NULL)
- DBUG_RETURN(0);
+
+ if (!info)
+ {
+ /* no such table, don't need to warn */
+ return 0;
+ }
+
if (maria_is_crashed(info))
{
tprint(tracef, "we skip repairing crashed table\n");
@@ -1448,17 +1457,21 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
}
if (share->state.state.data_file_length != dfile_len)
{
- tprint(tracef, ", has wrong state.data_file_length (fixing it)");
+ tprint(tracef, ", has wrong state.data_file_length "
+ "(fixing it from %llu to %llu)",
+ (ulonglong) share->state.state.data_file_length, (ulonglong) dfile_len);
share->state.state.data_file_length= dfile_len;
}
if (share->state.state.key_file_length != kfile_len)
{
- tprint(tracef, ", has wrong state.key_file_length (fixing it)");
+ tprint(tracef, ", has wrong state.key_file_length "
+ "(fixing it from %llu to %llu)",
+ (ulonglong) share->state.state.key_file_length, (ulonglong) kfile_len);
share->state.state.key_file_length= kfile_len;
}
if ((dfile_len % share->block_size) || (kfile_len % share->block_size))
{
- tprint(tracef, ", has too short last page\n");
+ tprint(tracef, ", has too short last page");
/* Recovery will fix this, no error */
ALERT_USER();
}
@@ -2769,7 +2782,7 @@ static int run_redo_phase(LSN lsn, LSN lsn_end, enum maria_apply_log_way apply)
{
fprintf(stderr, " 100%%");
fflush(stderr);
- procent_printed= 1;
+ procent_printed= 1; /* Will be follwed by time */
}
DBUG_RETURN(0);
@@ -2919,7 +2932,6 @@ static int run_undo_phase(uint uncommitted)
recovery_message_printed= REC_MSG_UNDO;
}
tprint(tracef, "%u transactions will be rolled back\n", uncommitted);
- procent_printed= 1;
for( ; ; )
{
char llbuf[22];
@@ -2972,7 +2984,6 @@ static int run_undo_phase(uint uncommitted)
/* In the future, we want to have this phase *online* */
}
}
- procent_printed= 0;
DBUG_RETURN(0);
}
@@ -3472,6 +3483,11 @@ static int close_all_tables(void)
}
}
end:
+ if (recovery_message_printed == REC_MSG_FLUSH)
+ {
+ fputc('\n', stderr);
+ fflush(stderr);
+ }
mysql_mutex_unlock(&THR_LOCK_maria);
DBUG_RETURN(error);
}
diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c
index 54d7420c96e..3b617f625f0 100644
--- a/storage/maria/ma_recovery_util.c
+++ b/storage/maria/ma_recovery_util.c
@@ -70,14 +70,7 @@ void tprint(FILE *trace_file __attribute__ ((unused)),
#endif
va_start(args, format);
if (trace_file != NULL)
- {
- if (procent_printed)
- {
- procent_printed= 0;
- fputc('\n', trace_file);
- }
vfprintf(trace_file, format, args);
- }
va_end(args);
}
@@ -93,9 +86,10 @@ void eprint(FILE *trace_file __attribute__ ((unused)),
if (procent_printed)
{
- /* In silent mode, print on another line than the 0% 10% 20% line */
procent_printed= 0;
- fputc('\n', trace_file);
+ /* In silent mode, print on another line than the 0% 10% 20% line */
+ fputc('\n', stderr);
+ fflush(stderr);
}
vfprintf(trace_file , format, args);
fputc('\n', trace_file);
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 7aedf05b4fc..7c591cf691d 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -6308,7 +6308,7 @@ int spider_panic(
int spider_db_init(
void *p
) {
- int error_num, roop_count;
+ int error_num = 0, roop_count;
uint dbton_id = 0;
handlerton *spider_hton = (handlerton *)p;
DBUG_ENTER("spider_db_init");
diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc
index 0eefdb17f39..50da7fb40ad 100644
--- a/storage/xtradb/row/row0ins.cc
+++ b/storage/xtradb/row/row0ins.cc
@@ -1299,7 +1299,7 @@ row_ins_foreign_check_on_constraint(
err = wsrep_append_foreign_key(
thr_get_trx(thr),
foreign,
- clust_rec,
+ cascade->pcur->old_rec,
clust_index,
FALSE, WSREP_KEY_EXCLUSIVE);
if (err != DB_SUCCESS) {
@@ -1676,6 +1676,11 @@ run_again:
check_index,
check_ref,
key_type);
+
+ if (err != DB_SUCCESS) {
+ fprintf(stderr,
+ "WSREP: foreign key append failed: %d\n", err);
+ }
#endif /* WITH_WSREP */
goto end_scan;
} else if (foreign->type != 0) {