~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/lock.cc

  • Committer: Brian Aker
  • Date: 2010-10-24 19:39:04 UTC
  • mfrom: (1874.3.4 refactor)
  • Revision ID: brian@tangent.org-20101024193904-6c5a62rtd14bx9q4
Merge for "how do we make sure concurrent, are only concurrent"

Show diffs side-by-side

added added

removed removed

Lines of Context:
680
680
    > 0  table locked, but someone is using it
681
681
*/
682
682
 
683
 
static int lock_table_name(Session *session, TableList *table_list, bool check_in_use)
 
683
static int lock_table_name(Session *session, TableList *table_list)
684
684
{
685
 
  bool  found_locked_table= false;
686
685
  TableIdentifier identifier(table_list->getSchemaName(), table_list->getTableName());
687
686
  const TableIdentifier::Key &key(identifier.getKey());
688
687
 
689
 
  if (check_in_use)
690
688
  {
691
689
    /* Only insert the table if we haven't insert it already */
692
690
    TableOpenCacheRange ppp;
699
697
      Table *table= (*iter).second;
700
698
      if (table->reginfo.lock_type < TL_WRITE)
701
699
      {
702
 
        if (table->in_use == session)
703
 
          found_locked_table= true;
704
700
        continue;
705
701
      }
706
702
 
722
718
  table_list->table= table;
723
719
 
724
720
  /* Return 1 if table is in use */
725
 
  return(test(remove_table_from_cache(session, identifier,
726
 
                                      check_in_use ? RTFC_NO_FLAG : RTFC_WAIT_OTHER_THREAD_FLAG)));
 
721
  return(test(remove_table_from_cache(session, identifier, RTFC_NO_FLAG)));
727
722
}
728
723
 
729
724
 
801
796
  for (lock_table= table_list; lock_table; lock_table= lock_table->next_local)
802
797
  {
803
798
    int got_lock;
804
 
    if ((got_lock= lock_table_name(session, lock_table, true)) < 0)
 
799
    if ((got_lock= lock_table_name(session, lock_table)) < 0)
805
800
      goto end;                                 // Fatal error
806
801
    if (got_lock)
807
802
      got_all_locks=0;                          // Someone is using table