summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-09-15 19:18:11 +0300
committerMonty <monty@mariadb.org>2021-09-15 19:27:34 +0300
commitf03fee06b0f4bdb1d754d987db3375cade02445e (patch)
treef2c29dd977bc5013aff31536868941d83bffa333
parent6be0ddae5edb080219226525c4423300f063081d (diff)
downloadmariadb-git-tmp-10.5-monty.tar.gz
Improve error messages from Ariatmp-10.5-monty
- Error on commit now returns HA_ERR_COMMIT_ERROR instead of HA_ERR_INTERNAL_ERROR - If checkpoint fails, it will now print out where it failed.
-rw-r--r--include/handler_ername.h1
-rw-r--r--include/my_base.h3
-rw-r--r--include/my_handler_errors.h3
-rw-r--r--sql/handler.cc3
-rw-r--r--storage/maria/ha_maria.cc9
-rw-r--r--storage/maria/ma_checkpoint.c20
6 files changed, 32 insertions, 7 deletions
diff --git a/include/handler_ername.h b/include/handler_ername.h
index fe55062e6fb..c9d09717a14 100644
--- a/include/handler_ername.h
+++ b/include/handler_ername.h
@@ -79,3 +79,4 @@
{ "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" },
{ "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" },
{ "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" },
+{ "HA_ERR_COMMIT_ERROR", HA_ERR_COMMIT_ERROR, "" },
diff --git a/include/my_base.h b/include/my_base.h
index 6a9a14fa91e..b4e7c1c7707 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -525,7 +525,8 @@ enum ha_base_keytype {
#define HA_ERR_TABLESPACE_MISSING 194 /* Missing Tablespace */
#define HA_ERR_SEQUENCE_INVALID_DATA 195
#define HA_ERR_SEQUENCE_RUN_OUT 196
-#define HA_ERR_LAST 196 /* Copy of last error nr * */
+#define HA_ERR_COMMIT_ERROR 197
+#define HA_ERR_LAST 197 /* Copy of last error nr * */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h
index faf7b9f459e..69b1566557d 100644
--- a/include/my_handler_errors.h
+++ b/include/my_handler_errors.h
@@ -107,7 +107,8 @@ static const char *handler_error_messages[]=
"Foreign key cascade delete/update exceeds max depth",
"Tablespace is missing for a table",
"Sequence has been run out",
- "Sequence values are conflicting"
+ "Sequence values are conflicting",
+ "Error during commit"
};
#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */
diff --git a/sql/handler.cc b/sql/handler.cc
index 9cf270f9cf3..d49a695f197 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -4217,6 +4217,9 @@ void handler::print_error(int error, myf errflag)
case HA_ERR_TABLE_IN_FK_CHECK:
textno= ER_TABLE_IN_FK_CHECK;
break;
+ case HA_ERR_COMMIT_ERROR:
+ textno= ER_ERROR_DURING_COMMIT;
+ break;
default:
{
/* The error was "unknown" to this function.
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index b93039190b0..79bebc90837 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -2904,7 +2904,7 @@ int ha_maria::external_lock(THD *thd, int lock_type)
if (file->autocommit)
{
if (ma_commit(trn))
- result= HA_ERR_INTERNAL_ERROR;
+ result= HA_ERR_COMMIT_ERROR;
thd_set_ha_data(thd, maria_hton, 0);
}
}
@@ -3043,7 +3043,7 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn)
error= 0;
if (unlikely(ma_commit(trn)))
- error= 1;
+ error= HA_ERR_COMMIT_ERROR;
if (!new_trn)
{
reset_thd_trn(thd, used_tables);
@@ -3480,7 +3480,7 @@ static int maria_commit(handlerton *hton __attribute__ ((unused)),
THD *thd, bool all)
{
TRN *trn= THD_TRN;
- int res;
+ int res= 0;
MARIA_HA *used_instances;
DBUG_ENTER("maria_commit");
@@ -3499,7 +3499,8 @@ static int maria_commit(handlerton *hton __attribute__ ((unused)),
trnman_reset_locked_tables(trn, 0);
trnman_set_flags(trn, trnman_get_flags(trn) & ~TRN_STATE_INFO_LOGGED);
trn->used_instances= 0;
- res= ma_commit(trn);
+ if (ma_commit(trn))
+ res= HA_ERR_COMMIT_ERROR;
reset_thd_trn(thd, used_instances);
thd_set_ha_data(thd, maria_hton, 0);
DBUG_RETURN(res);
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 3af808478e4..2741f54d7d7 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -153,8 +153,10 @@ end:
static int really_execute_checkpoint(void)
{
uint i, error= 0;
+ int error_errno= 0;
/** @brief checkpoint_start_log_horizon will be stored there */
char *ptr;
+ const char *error_place= 0;
LEX_STRING record_pieces[4]; /**< only malloc-ed pieces */
LSN min_page_rec_lsn, min_trn_rec_lsn, min_first_undo_lsn;
TRANSLOG_ADDRESS checkpoint_start_log_horizon;
@@ -191,13 +193,19 @@ static int really_execute_checkpoint(void)
&record_pieces[1],
&min_trn_rec_lsn,
&min_first_undo_lsn)))
+ {
+ error_place= "trnman_collect_transaction";
goto err;
+ }
/* STEP 3: fetch information about table files */
if (unlikely(collect_tables(&record_pieces[2],
checkpoint_start_log_horizon)))
+ {
+ error_place= "collect_tables";
goto err;
+ }
/* STEP 4: fetch information about dirty pages */
@@ -211,7 +219,10 @@ static int really_execute_checkpoint(void)
if (unlikely(pagecache_collect_changed_blocks_with_lsn(maria_pagecache,
&record_pieces[3],
&min_page_rec_lsn)))
+ {
+ error_place= "collect_pages";
goto err;
+ }
/* LAST STEP: now write the checkpoint log record */
@@ -240,7 +251,10 @@ static int really_execute_checkpoint(void)
sizeof(log_array)/sizeof(log_array[0]),
log_array, NULL, NULL) ||
translog_flush(lsn)))
+ {
+ error_place= "translog_write_record";
goto err;
+ }
translog_lock();
/*
This cannot be done as a inwrite_rec_hook of LOGREC_CHECKPOINT, because
@@ -251,6 +265,8 @@ static int really_execute_checkpoint(void)
max_trid_in_control_file,
recovery_failures)))
{
+ error_place= "ma_control_file_write";
+ error_errno= my_errno;
translog_unlock();
goto err;
}
@@ -287,7 +303,9 @@ static int really_execute_checkpoint(void)
err:
error= 1;
- ma_message_no_user(0, "checkpoint failed");
+ my_printf_error(HA_ERR_GENERIC, "Aria engine: checkpoint failed at %s with "
+ "error %d", MYF(ME_ERROR_LOG),
+ error_place, (error_errno ? error_errno : my_errno));
/* we were possibly not able to determine what pages to flush */
pages_to_flush_before_next_checkpoint= 0;