[MDEV-8532] MTR cannot run with --embedded on Windows on a source build Created: 2015-07-23  Updated: 2015-07-25  Resolved: 2015-07-25

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 10.0, 10.1
Fix Version/s: 10.0.21

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Elena Stepanova
Resolution: Fixed Votes: 0
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";                                    



 Comments   
Comment by Elena Stepanova [ 2015-07-24 ]

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";

serg,
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.

Comment by Sergei Golubchik [ 2015-07-24 ]

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 wlad 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

Comment by Elena Stepanova [ 2015-07-24 ]

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.

Comment by Vladislav Vaintroub [ 2015-07-24 ]

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.

Comment by Sergei Golubchik [ 2015-07-24 ]

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

elenst, 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.

Comment by Elena Stepanova [ 2015-07-25 ]

https://github.com/MariaDB/server/commit/2ebedfa998bd9f3f2255b05607a9cb09b6def93d

Generated at Thu Feb 08 07:27:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.