-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-27952 Improve error log messages with descriptive text already present in the code #3058
base: 11.4
Are you sure you want to change the base?
MDEV-27952 Improve error log messages with descriptive text already present in the code #3058
Conversation
Generates:
which isn't correct because it doesn't have the tablename. |
3e2a5a8
to
80dde62
Compare
80dde62
to
c6cf3a7
Compare
…resent in the code This is explictly for the test case: CREATE TABLE t (c INT) ENGINE=InnoDB; ALTER TABLE t DISCARD TABLESPACE; ALTER TABLE t ADD INDEX (c); SELECT * FROM t; That had an error: [ERROR] Got error 194 when reading table './test/t' 194 is the code from HA_ERR_TABLESPACE_MISSING. As these code are at the handler level, based on the existing code the table name is assumed. There is a built in function my_get_err_msg that translates the number to a format with its argument that can be assumed to be a table string. The error is now: 2024-02-13 19:08:44 3 [ERROR] Tablespace is missing for table './test/t' Occasionally an index gets called with report_error so the path form is still there as opposed to changing format or doing a db.table string. A few tests ajusted for the exact error. Achive storage engine fixed for all its incorrect returning of errno instead of a HA_ERR_{code}. Reported BINLOG messages correctly to opposed to unknown error.
c6cf3a7
to
00fd647
Compare
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); | ||
call mtr.add_suppression("Table './test/t1' is marked as crashed and should be repaired"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we edit the existing suppressions instead:
call mtr.add_suppression("Table '.*t1' is marked as crashed and should be repaired");
@@ -8,6 +8,7 @@ | |||
|
|||
--disable_query_log | |||
call mtr.add_suppression("Flagged corruption of.* in table .* in .*"); | |||
call mtr.add_suppression("Index ./test/corrupt_bit_test_@1s is corrupted"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we convert the filename-safe table name to the user-specified name test.corrupt_bit_test_ā
with something like this?
static void dict_table_open_failed(const table_name_t &name)
{
my_printf_error(ER_TABLE_CORRUPT,
"Table %`.*s.%`s is corrupted."
" Please drop the table and recreate.",
MYF(ME_ERROR_LOG),
int(name.dblen()), name.m_name, name.basename());
}
Or would it require a different format variant to be implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not use &table_name_t ; Please use pointers instead.
If possible, use C syntax cast instead of C++ syntax cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that when using a table name for error messages inside InnoDB, you have to use conversion functions to change it from filename format to table name format.
You have to use innobase_convert_to_system_charset() when converting filenames to table names.
@@ -6,6 +6,7 @@ | |||
|
|||
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); | |||
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); | |||
call mtr.add_suppression("Table './test/t1' is marked as crashed and should be repaired"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please ensure that we do not use '/' in the suppression. (Will not work on windows)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the commented issues.
@@ -287,7 +287,7 @@ static int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share) | |||
if (!(azopen(&frm_stream, az_file, O_RDONLY|O_BINARY))) | |||
{ | |||
if (errno == EROFS || errno == EACCES) | |||
DBUG_RETURN(my_errno= errno); | |||
DBUG_RETURN(HA_ERR_TABLE_READONLY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You MUST set my_errno here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change errno to HA_ERR_CRASHED_ON_USAGE.
This will hide the original error !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of changing errno, you can instead change handler::print_error() to give more information about the error
@@ -990,7 +990,7 @@ int ha_archive::write_row(const uchar *buf) | |||
|
|||
if (!share->archive_write_open && share->init_archive_writer()) | |||
{ | |||
rc= errno; | |||
rc= HA_ERR_CRASHED_ON_USAGE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change errno to HA_ERR_CRASHED_ON_USAGE.
This will hide the original error !
@@ -1228,7 +1228,7 @@ int ha_archive::rnd_init(bool scan) | |||
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); | |||
|
|||
if (init_archive_reader()) | |||
DBUG_RETURN(errno); | |||
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change errno to HA_ERR_CRASHED_ON_USAGE.
This will hide the original error !
@@ -1556,7 +1556,7 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) | |||
if (init_archive_reader()) | |||
{ | |||
mysql_mutex_unlock(&share->mutex); | |||
DBUG_RETURN(errno); | |||
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change errno to HA_ERR_CRASHED_ON_USAGE.
This will hide the original error !
@@ -1771,7 +1777,7 @@ int ha_archive::info(uint flag) | |||
if (flag & HA_STATUS_AUTO) | |||
{ | |||
if (init_archive_reader()) | |||
DBUG_RETURN(errno); | |||
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change errno to HA_ERR_CRASHED_ON_USAGE.
This will hide the original error !
Description
…
This is explicitly for the test case:
CREATE TABLE t (c INT) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
ALTER TABLE t ADD INDEX (c);
SELECT * FROM t;
That had an error:
[ERROR] Got error 194 when reading table './test/t'
194 is the code from HA_ERR_TABLESPACE_MISSING.
As these code are at the handler level, based on the existing code the table name is assumed. There is a built in function my_get_err_msg that translates the number to a format with its argument that can be assumed to be a table string.
The error is now:
2024-02-13 19:08:44 3 [ERROR] Tablespace is missing for table './test/t'
Release Notes
Per title
How can this PR be tested?
Manual test per MDEV
Basing the PR against the correct MariaDB version
PR quality check