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

mysqltest: errors in source in a loop

Details

    Description

      mysqltest only executes the source command on the first iteration of a loop, after that the sourced file is already in the q_lines cache, so there is no need to read it again. Alas, when ignoring source command, we cannot know what file caused the error.

      a.test

      let $a=0;
      while($a) {
        source $MYSQL_TMP_DIR/b.inc;
        inc $a;
      }
      

      b.inc

      if ($a) {
        sleep 1 2;
      }
      

      Attachments

        Issue Links

          Activity

            I've attached the fix, but it don't work because of MDEV-12138. May be the whole caching logic needs to be rewritten, and then this fix will be very different of completely unnecessary.

            serg Sergei Golubchik added a comment - I've attached the fix, but it don't work because of MDEV-12138 . May be the whole caching logic needs to be rewritten, and then this fix will be very different of completely unnecessary.
            amolholani Amol Holani added a comment - - edited

            Hi Sergei,
            You have removed the if statement in your patch and performing else part every time, I think the checking for existence of file won't be issue.

            /*If this file has already been sourced, don't source it again.
            -    It's already available in the q_lines cache.
            -  */
            -  if (parser.current_line < (parser.read_lines - 1))
            -    ; /* Do nothing */
            -  else
            -  {
            -    DBUG_PRINT("info", ("sourcing file: %s", ds_filename.str));
            -    open_file(ds_filename.str);
            -  }
            

            Also regarding the MDEV-12138, I found this :- A sourced file can use source to read other files,but the maximum nesting level is 16.

            Sorry for late response, I had mid term exams last week!!

            amolholani Amol Holani added a comment - - edited Hi Sergei, You have removed the if statement in your patch and performing else part every time, I think the checking for existence of file won't be issue. /*If this file has already been sourced, don't source it again. - It's already available in the q_lines cache. - */ - if (parser.current_line < (parser.read_lines - 1)) - ; /* Do nothing */ - else - { - DBUG_PRINT("info", ("sourcing file: %s", ds_filename.str)); - open_file(ds_filename.str); - } Also regarding the MDEV-12138 , I found this :- A sourced file can use source to read other files,but the maximum nesting level is 16. Sorry for late response, I had mid term exams last week!!

            People

              Unassigned Unassigned
              serg Sergei Golubchik
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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