~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/cache.cc

  • Committer: Andrew Hutchings
  • Date: 2010-11-14 14:46:36 UTC
  • mto: (1931.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1932.
  • Revision ID: andrew@linuxjedi.co.uk-20101114144636-bkttapbfpp20ccd2
Fix broken Global Status test
Fix some stats not reset
Cleanup code a little

Note: local session stats are not reset, they will be added to the global stats after flush if any query is executed on those sessions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
  entry         Table to remove
57
57
 
58
58
  NOTE
59
 
  We need to have a lock on table::Cache::singleton().mutex() when calling this
 
59
  We need to have a lock on LOCK_open when calling this
60
60
*/
61
61
 
62
62
static void free_cache_entry(table::Concurrent *table)
138
138
 
139
139
void Cache::removeSchema(const SchemaIdentifier &schema_identifier)
140
140
{
141
 
  boost::mutex::scoped_lock scopedLock(_mutex);
 
141
  //safe_mutex_assert_owner(LOCK_open.native_handle());
142
142
 
143
143
  for (table::CacheMap::const_iterator iter= table::getCache().begin();
144
144
       iter != table::getCache().end();
164
164
  close_thread_tables() is called.
165
165
 
166
166
  PREREQUISITES
167
 
  Lock on table::Cache::singleton().mutex()()
 
167
  Lock on LOCK_open()
168
168
 
169
169
  RETURN
170
170
  0  This thread now have exclusive access to this table and no other thread
211
211
        /*
212
212
          Now we must abort all tables locks used by this thread
213
213
          as the thread may be waiting to get a lock for another table.
214
 
          Note that we need to hold table::Cache::singleton().mutex() while going through the
 
214
          Note that we need to hold LOCK_open while going through the
215
215
          list. So that the other thread cannot change it. The other
216
 
          thread must also hold table::Cache::singleton().mutex() whenever changing the
 
216
          thread must also hold LOCK_open whenever changing the
217
217
          open_tables list. Aborting the MERGE lock after a child was
218
218
          closed and before the parent is closed would be fatal.
219
219
        */
249
249
        dropping_tables++;
250
250
        if (likely(signalled))
251
251
        {
252
 
          boost_unique_lock_t scoped(table::Cache::singleton().mutex(), boost::adopt_lock_t());
 
252
          boost_unique_lock_t scoped(LOCK_open, boost::adopt_lock_t());
253
253
          COND_refresh.wait(scoped);
254
254
          scoped.release();
255
255
        }
268
268
          boost::xtime xt; 
269
269
          xtime_get(&xt, boost::TIME_UTC); 
270
270
          xt.sec += 10; 
271
 
          boost_unique_lock_t scoped(table::Cache::singleton().mutex(), boost::adopt_lock_t());
 
271
          boost_unique_lock_t scoped(LOCK_open, boost::adopt_lock_t());
272
272
          COND_refresh.timed_wait(scoped, xt);
273
273
          scoped.release();
274
274
        }