~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/main.cc

[patch 112/129] Merge patch for revision 1925 from InnoDB SVN:
revno: 1925
revision-id: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6169
parent: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6163
committer: calvin
timestamp: Thu 2009-11-12 12:40:43 +0000
message:
  branches/zip: add test case for bug#46676
  
  This crash is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
  But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
  Add test case to catch future regression.
added:
  mysql-test/innodb_bug46676.result 6169@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb_bug46676.result
  mysql-test/innodb_bug46676.test 6169@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb_bug46676.test
diff:
=== added file 'mysql-test/innodb_bug46676.result'

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#include "drizzled/gettext.h"
49
49
#include "drizzled/configmake.h"
50
50
#include "drizzled/session.h"
51
 
#include "drizzled/session/cache.h"
52
51
#include "drizzled/internal/my_sys.h"
53
52
#include "drizzled/unireg.h"
54
53
#include "drizzled/drizzled.h"
60
59
#include "drizzled/tztime.h"
61
60
#include "drizzled/signal_handler.h"
62
61
#include "drizzled/replication_services.h"
63
 
#include "drizzled/transaction_services.h"
64
 
 
65
 
#include "drizzled/util/backtrace.h"
66
62
 
67
63
using namespace drizzled;
68
64
using namespace std;
205
201
  (void)filename;
206
202
  (void)line;
207
203
  (void)message;
208
 
  std::cerr << "\n";
209
 
  drizzled::util::custom_backtrace();
210
 
  std::cerr << "\n";
211
204
  switch(level)
212
205
  {
213
206
  case google::protobuf::LOGLEVEL_INFO:
233
226
 
234
227
  module::Registry &modules= module::Registry::singleton();
235
228
  plugin::Client *client;
 
229
  Session *session;
236
230
 
237
231
  MY_INIT(argv[0]);             // init my_sys library & pthreads
238
232
  /* nothing should come before this line ^^^ */
261
255
 
262
256
  if (not opt_help)
263
257
  {
264
 
    if (chdir(getDataHome().file_string().c_str()))
 
258
    if (chdir(getDataHome().c_str()))
265
259
    {
266
260
      errmsg_printf(ERRMSG_LVL_ERROR,
267
261
                    _("Data directory %s does not exist\n"),
268
 
                    getDataHome().file_string().c_str());
 
262
                    getDataHome().c_str());
269
263
      unireg_abort(1);
270
264
    }
271
265
    if (mkdir("local", 0700))
276
270
    {
277
271
      errmsg_printf(ERRMSG_LVL_ERROR,
278
272
                    _("Local catalog %s/local does not exist\n"),
279
 
                    getDataHome().file_string().c_str());
 
273
                    getDataHome().c_str());
280
274
      unireg_abort(1);
281
275
    }
282
 
 
283
 
    full_data_home= fs::system_complete(getDataHome());
 
276
    /* TODO: This is a hack until we can properly support std::string in sys_var*/
 
277
    char **data_home_ptr= getDatadirPtr();
 
278
    fs::path full_data_home_path(fs::system_complete(fs::path(getDataHome())));
 
279
    std::string full_data_home(full_data_home_path.file_string());
 
280
    *data_home_ptr= new char[full_data_home.size()+1] ();
 
281
    memcpy(*data_home_ptr, full_data_home.c_str(), full_data_home.size());
284
282
    getDataHomeCatalog()= "./";
285
283
    getDataHome()= "../";
286
284
  }
321
319
    select_thread_in_use=0;
322
320
    (void) pthread_kill(signal_thread, SIGTERM);
323
321
 
324
 
    (void) unlink(pid_file.file_string().c_str());      // Not needed anymore
 
322
    (void) unlink(pidfile_name);        // Not needed anymore
325
323
 
326
324
    exit(1);
327
325
  }
330
328
                PANDORA_RELEASE_VERSION, COMPILATION_COMMENT);
331
329
 
332
330
 
333
 
  TransactionServices &transaction_services= TransactionServices::singleton();
334
 
 
335
 
  /* Send server startup event */
336
 
  {
337
 
    Session *session;
338
 
 
339
 
    if ((session= new Session(plugin::Listen::getNullClient())))
340
 
    {
341
 
      currentSession().release();
342
 
      currentSession().reset(session);
343
 
      transaction_services.sendStartupEvent(session);
344
 
      delete session;
345
 
    }
346
 
  }
347
 
 
348
 
 
349
331
  /* Listen for new connections and start new session for each connection
350
332
     accepted. The listen.getClient() method will return NULL when the server
351
333
     should be shutdown. */
352
334
  while ((client= plugin::Listen::getClient()) != NULL)
353
335
  {
354
 
    Session::shared_ptr session(new Session(client));
355
 
 
356
 
    if (not session)
 
336
    if (!(session= new Session(client)))
357
337
    {
358
338
      delete client;
359
339
      continue;
360
340
    }
361
341
 
362
342
    /* If we error on creation we drop the connection and delete the session. */
363
 
    if (Session::schedule(session))
 
343
    if (session->schedule())
364
344
      Session::unlink(session);
365
345
  }
366
346
 
367
 
  /* Send server shutdown event */
368
 
  {
369
 
    Session *session;
370
 
 
371
 
    if ((session= new Session(plugin::Listen::getNullClient())))
372
 
    {
373
 
      currentSession().release();
374
 
      currentSession().reset(session);
375
 
      transaction_services.sendShutdownEvent(session);
376
 
      delete session;
377
 
    }
378
 
  }
379
 
 
380
 
  {
381
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
382
 
    select_thread_in_use= false;                        // For close_connections
383
 
  }
 
347
  LOCK_thread_count.lock();
 
348
  select_thread_in_use=0;                       // For close_connections
 
349
  LOCK_thread_count.unlock();
384
350
  COND_thread_count.notify_all();
385
351
 
386
352
  /* Wait until cleanup is done */
387
353
  {
388
 
    boost::mutex::scoped_lock scopedLock(session::Cache::singleton().mutex());
389
 
    while (not ready_to_exit)
 
354
    boost::mutex::scoped_lock scopedLock(LOCK_thread_count);
 
355
    while (!ready_to_exit)
390
356
      COND_server_end.wait(scopedLock);
391
357
  }
392
358