• Sergey Vojtovich's avatar
    BUG#32047 - 'Spurious' errors while opening MERGE tables · 97bd7635
    Sergey Vojtovich authored
    Accessing well defined MERGE table may return an error
    stating that the merge table is incorrectly defined. This
    happens if MERGE child tables were accessed before and we
    failed to open another incorrectly defined MERGE table in
    this connection.
    
    myrg_open() internally used my_errno as a variable for determining
    failure, and thus could be tricked into a wrong decision by other
    uses of my_errno.
    
    With this fix we use function local boolean flag instead of my_errno
    to determine failure.
    
    myisammrg/myrg_open.c:
      There are two requirement for accessing/setting my_errno variable,
      which were not followed by myrg_open():
      - it must be checked immediately after a function returned an error. There
        must be no calls to other functions that may change it's value between.
      - my_errno value must be set right before a function is going to return an
        error. There must be no calls to other functions that may change it's
        value between (that's why we have these tricks with save_errno at the
        bottom of myrg_open()).
      
      myrg_open() internally used my_errno as a variable for determining
      failure, and thus could be tricked into a wrong decision by other
      uses of my_errno.
    mysql-test/r/merge.result:
      A test case for BUG#32047.
    mysql-test/t/merge.test:
      A test case for BUG#32047.
    97bd7635
merge.result 22.7 KB