Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25743

Unnecessary copying of table names in InnoDB dictionary operations

    XMLWordPrintable

Details

    Description

      Many InnoDB data dictionary cache operations require that the table name be copied so that it will be NUL terminated. The table name that would be read from SYS_TABLES.NAME is not guaranteed to be NUL-terminated.

      Let us refactor the code so that such unnecessary copying can be avoided and the table name can be passed as const span<const char>& to those functions that need it.

      This will also change some error reporting, like this:

      @@ -2314,8 +2317,10 @@ fil_ibd_open(
       	First, bail out if no tablespace files were found. */
       	if (valid_tablespaces_found == 0) {
       		os_file_get_last_error(true);
      -		ib::error() << "Could not find a valid tablespace file for `"
      -			<< tablename << "`. " << TROUBLESHOOT_DATADICT_MSG;
      +		sql_print_error("InnoDB: Could not find a valid tablespace"
      +				" file for %.*s. %s",
      +				static_cast<int>(name.size()), name.data(),
      +				TROUBLESHOOT_DATADICT_MSG);
       		goto corrupted;
       	}
       	if (!validate) {
      

      The user-visible change is that instead of a string like `test`.`t1` the internal name `test/t1` will be reported.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.