~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Lee Bieber
  • Date: 2011-04-14 16:20:43 UTC
  • mfrom: (2277.1.3 build)
  • Revision ID: kalebral@gmail.com-20110414162043-2khq8mql7gvodnzn
Merge Olaf - Refactor Session Cache and Remove table::Cache::singleton()
Merge Olaf - Refactor Thread
Merge Olaf - remove unused functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
394
394
    return;
395
395
 
396
396
  setAbort(true);
397
 
  boost_unique_lock_t scopedLock(mysys_var->mutex);
 
397
  boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
398
398
  if (mysys_var->current_cond)
399
399
  {
400
400
    mysys_var->current_mutex->lock();
512
512
 
513
513
  if (mysys_var)
514
514
  {
515
 
    boost_unique_lock_t scopedLock(mysys_var->mutex);
 
515
    boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
516
516
    /*
517
517
      "
518
518
      This broadcast could be up in the air if the victim thread
686
686
    does a Session::awake() on you).
687
687
  */
688
688
  mysys_var->current_mutex->unlock();
689
 
  boost_unique_lock_t scopedLock(mysys_var->mutex);
 
689
  boost::mutex::scoped_lock scopedLock(mysys_var->mutex);
690
690
  mysys_var->current_mutex = 0;
691
691
  mysys_var->current_cond = 0;
692
692
  this->set_proc_info(old_msg);
923
923
                                     bool allocate_lex_string)
924
924
{
925
925
  if (allocate_lex_string)
926
 
    if (!(lex_str= (LEX_STRING *)getMemRoot()->allocate(sizeof(LEX_STRING))))
927
 
      return 0;
928
 
  if (!(lex_str->str= mem_root->strmake_root(str, length)))
929
 
    return 0;
 
926
    lex_str= (LEX_STRING *)getMemRoot()->allocate(sizeof(LEX_STRING));
 
927
  lex_str->str= mem_root->strmake_root(str, length);
930
928
  lex_str->length= length;
931
929
  return lex_str;
932
930
}
1632
1630
    my_message(err, ER(err), MYF(0));
1633
1631
}
1634
1632
 
1635
 
void Session::set_status_var_init()
1636
 
{
1637
 
  memset(&status_var, 0, sizeof(status_var));
1638
 
}
1639
 
 
1640
 
 
1641
1633
void Session::set_db(const std::string& new_db)
1642
1634
{
1643
1635
  impl_->schema = boost::make_shared<std::string>(new_db);
1845
1837
  }
1846
1838
}
1847
1839
 
1848
 
void Session::mark_used_tables_as_free_for_reuse(Table *table)
1849
 
{
1850
 
  for (; table ; table= table->getNext())
1851
 
  {
1852
 
    if (table->query_id == getQueryId())
1853
 
    {
1854
 
      table->query_id= 0;
1855
 
      table->cursor->ha_reset();
1856
 
    }
1857
 
  }
1858
 
}
1859
 
 
1860
1840
/*
1861
1841
  Unlocks tables and frees derived tables.
1862
1842
  Put all normal tables used by thread in free list.
1905
1885
    open_tables.lock= 0;
1906
1886
  }
1907
1887
  /*
1908
 
    Note that we need to hold table::Cache::singleton().mutex() while changing the
 
1888
    Note that we need to hold table::Cache::mutex() while changing the
1909
1889
    open_tables list. Another thread may work on it.
1910
 
    (See: table::Cache::singleton().removeTable(), wait_completed_table())
 
1890
    (See: table::Cache::removeTable(), wait_completed_table())
1911
1891
    Closing a MERGE child before the parent would be fatal if the
1912
1892
    other thread tries to abort the MERGE lock in between.
1913
1893
  */
2023
2003
}
2024
2004
 
2025
2005
/**
2026
 
  Mark the current error as fatal. Warning: this does not
2027
 
  set any error, it sets a property of the error, so must be
2028
 
  followed or prefixed with my_error().
2029
 
*/
2030
 
void Session::fatal_error()
2031
 
{
2032
 
  assert(main_da().is_error());
2033
 
  is_fatal_error= true;
2034
 
}
2035
 
 
2036
 
/**
2037
2006
  true if there is an error in the error stack.
2038
2007
 
2039
2008
  Please use this method instead of direct access to
2098
2067
    impl_->schema_event_observers[db_name] = observers;
2099
2068
        return observers;
2100
2069
}
2101
 
my_xid Session::getTransactionId()
2102
 
{
2103
 
  return transaction.xid_state.xid.quick_get_my_xid();
2104
 
}
2105
2070
 
2106
2071
util::string::ptr Session::schema() const
2107
2072
{