Skip to content
  • Praveenkumar Hulakund's avatar
    72f823de
    Bug#13418638 - CREATE TABLE IF NOT EXISTS METADATA LOCK IS · 72f823de
    Praveenkumar Hulakund authored
                   TOO RESTRICTIVE 
    
    Analysis:
    ---------
    Creating table using "CREATE TABLE [IF NOT EXISTS]" hangs
    if table with same name already exists and if any other MDL
    lock is taken on the lock object of the table.
    
    While creating the table, we try to acquire "X" MDL lock on 
    the lock object of the table. Lock will be acquired on table,
    before even checking the existence of the table. Since "X"
    is not compatible with any other MDL locks, if some other
    lock is granted on the lock object of table then "X' lock
    will not be granted and it will hang for lock timeout
    period. 
    
    Fix:
    ----
    Acquiring "X" MDL lock before even checking for the existence
    of table is resulting in the issue mentioned above. So, as 
    a fix for this bug, modified a logic to acquire "S" lock and
    check for the existence of the table. If the table does not
    exists then upgrade lock to "X" and continue. If table exists
    then,
          for "CREATE TABLE" - report an error.
          for "CREATE TABLE IF NOT EXISTS" - Push a warning.
    and return.
    72f823de
    Bug#13418638 - CREATE TABLE IF NOT EXISTS METADATA LOCK IS
    Praveenkumar Hulakund authored
                   TOO RESTRICTIVE 
    
    Analysis:
    ---------
    Creating table using "CREATE TABLE [IF NOT EXISTS]" hangs
    if table with same name already exists and if any other MDL
    lock is taken on the lock object of the table.
    
    While creating the table, we try to acquire "X" MDL lock on 
    the lock object of the table. Lock will be acquired on table,
    before even checking the existence of the table. Since "X"
    is not compatible with any other MDL locks, if some other
    lock is granted on the lock object of table then "X' lock
    will not be granted and it will hang for lock timeout
    period. 
    
    Fix:
    ----
    Acquiring "X" MDL lock before even checking for the existence
    of table is resulting in the issue mentioned above. So, as 
    a fix for this bug, modified a logic to acquire "S" lock and
    check for the existence of the table. If the table does not
    exists then upgrade lock to "X" and continue. If table exists
    then,
          for "CREATE TABLE" - report an error.
          for "CREATE TABLE IF NOT EXISTS" - Push a warning.
    and return.
Loading