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

MTR cannot run with --embedded on Windows on a source build

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.0
    • Fix Version/s: 10.0.21
    • Component/s: Tests
    • Labels:
      None

      Description

      VS config: RelWithDebInfo                                                    
      vardir: c:/_Home/repo/10.1-mdev6887/mysql-test/var                           
      Checking leftover processes...                                               
      Removing old var directory...                                                
      Creating var directory 'c:/_Home/repo/10.1-mdev6887/mysql-test/var'...       
      The symlink function is unimplemented at mysql-test-run.pl line 2596.        
      

      The problem is here:

          if (IS_WINDOWS && !$opt_embedded_server)
          {
            for (<$bindir/storage/*$opt_vs_config/*.dll>,
                 <$bindir/plugin/*$opt_vs_config/*.dll>,
                 <$bindir/sql$opt_vs_config/*.dll>)
            {
              my $pname=basename($_);
              copy rel2abs($_), "$plugindir/$pname";
              set_plugin_var($pname);
            }
          }
          else
          {
            my $opt_use_copy= 1;
            if (symlink "$opt_vardir/run", "$plugindir/symlink_test")
            {
              $opt_use_copy= 0;
              unlink "$plugindir/symlink_test";
            }
      ...
      

      Simplest patch:

      diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl      
      index fe71bbe..2999490 100755                                                 
      --- a/mysql-test/mysql-test-run.pl                                            
      +++ b/mysql-test/mysql-test-run.pl                                            
      @@ -2593,7 +2593,7 @@ sub setup_vardir() {                                    
           else                                                                     
           {                                                                        
             my $opt_use_copy= 1;                                                   
      -      if (symlink "$opt_vardir/run", "$plugindir/symlink_test")              
      +      if (eval {symlink "$opt_vardir/run", "$plugindir/symlink_test"})       
             {                                                                      
               $opt_use_copy= 0;                                                    
               unlink "$plugindir/symlink_test";                                    
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            https://github.com/MariaDB/server/commit/da594da84153d50e8c893126c1d7e3e1f73b5f42

                 else
                 {
                   my $opt_use_copy= 1;
            -      if (symlink "$opt_vardir/run", "$plugindir/symlink_test")
            +      if (eval {symlink "$opt_vardir/run", "$plugindir/symlink_test"})
                   {
                     $opt_use_copy= 0;
                     unlink "$plugindir/symlink_test";
            

            Sergei Golubchik,
            It's a tiny change, staging tree looks okay ( http://buildbot.askmonty.org/buildbot/grid?branch=bb-10.0-elenst&category=main&category=experimental ). If you have any concerns, please let me know.

            Show
            elenst Elena Stepanova added a comment - https://github.com/MariaDB/server/commit/da594da84153d50e8c893126c1d7e3e1f73b5f42 else { my $opt_use_copy= 1; - if (symlink "$opt_vardir/run", "$plugindir/symlink_test") + if (eval {symlink "$opt_vardir/run", "$plugindir/symlink_test"}) { $opt_use_copy= 0; unlink "$plugindir/symlink_test"; Sergei Golubchik , It's a tiny change, staging tree looks okay ( http://buildbot.askmonty.org/buildbot/grid?branch=bb-10.0-elenst&category=main&category=experimental ). If you have any concerns, please let me know.
            Hide
            serg Sergei Golubchik added a comment -

            I would rather do

            -    if (IS_WINDOWS && !$opt_embedded_server)
            +    if (IS_WINDOWS)
            

            because with your change the execution on Windows will go into the branch with unix path names (<../storage/*/.libs/*.so>, etc). This !$opt_embedded_server was added by Vladislav Vaintroub with the comment “Avoid plugin tests on Windows/embedded, plugins do not and will not work here”. I don't quite understand why they “do not and will not”, but either way the fix is not correct. It should've been

              if (IS_WINDOWS) {
                if (!$opt_embedded_server) {
                  ...
                }
              }
            

            You can either do that or enable plugin tests and see what happens

            Show
            serg Sergei Golubchik added a comment - I would rather do - if (IS_WINDOWS && !$opt_embedded_server) + if (IS_WINDOWS) because with your change the execution on Windows will go into the branch with unix path names ( <../storage/*/.libs/*.so> , etc). This !$opt_embedded_server was added by Vladislav Vaintroub with the comment “Avoid plugin tests on Windows/embedded, plugins do not and will not work here”. I don't quite understand why they “do not and will not”, but either way the fix is not correct. It should've been if (IS_WINDOWS) { if (!$opt_embedded_server) { ... } } You can either do that or enable plugin tests and see what happens
            Hide
            elenst Elena Stepanova added a comment -

            Actually, the result would be the same. With the current check it will indeed search for the unix path names, but obviously won't find any, so no plugins would not be copied for the Windows embedded server either way. But no problem, I can do it with the extra if.

            Show
            elenst Elena Stepanova added a comment - Actually, the result would be the same. With the current check it will indeed search for the unix path names, but obviously won't find any, so no plugins would not be copied for the Windows embedded server either way. But no problem, I can do it with the extra if .
            Hide
            wlad Vladislav Vaintroub added a comment -

            Can explain why plugins would not work on Windows/embedded. This is is due to how DLL loading and symbols resolution works on Windows.

            1. Plugins use symbols exported by the server exe
            2. The loader uses library name in addition to symbol name when looking up imports when loading a DLL. Thus, server-exported symbols need to be in "mysqld.exe" at the time of plugin load . Which can happen only in case when current process is mysqld.exe.

            Since the running process in case of embedded is not mysqld.exe , plugins would not be able to load.

            Show
            wlad Vladislav Vaintroub added a comment - Can explain why plugins would not work on Windows/embedded. This is is due to how DLL loading and symbols resolution works on Windows. Plugins use symbols exported by the server exe The loader uses library name in addition to symbol name when looking up imports when loading a DLL. Thus, server-exported symbols need to be in "mysqld.exe" at the time of plugin load . Which can happen only in case when current process is mysqld.exe. Since the running process in case of embedded is not mysqld.exe , plugins would not be able to load.
            Hide
            serg Sergei Golubchik added a comment -

            Vladislav Vaintroub, thanks! Then it's clear what the fix should be.

            Elena Stepanova, yes, they're the same, but it's cleaner not to execute unix specific code on windows, even if it does nothing after we've suppressed all errors that were caused by running unix specific code on windows.

            Show
            serg Sergei Golubchik added a comment - Vladislav Vaintroub , thanks! Then it's clear what the fix should be. Elena Stepanova , yes, they're the same, but it's cleaner not to execute unix specific code on windows, even if it does nothing after we've suppressed all errors that were caused by running unix specific code on windows.
            Show
            elenst Elena Stepanova added a comment - https://github.com/MariaDB/server/commit/2ebedfa998bd9f3f2255b05607a9cb09b6def93d

              People

              • Assignee:
                elenst Elena Stepanova
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: