Merge lp:~dshrews/drizzle/bug532481 into lp:~drizzle-trunk/drizzle/development

Proposed by David Shrewsbury
Status: Merged
Approved by: Brian Aker
Approved revision: 1690
Merged at revision: 1692
Proposed branch: lp:~dshrews/drizzle/bug532481
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 73 lines (+24/-0)
4 files modified
drizzled/plugin/scheduler.cc (+7/-0)
drizzled/plugin/scheduler.h (+5/-0)
plugin/multi_thread/multi_thread.cc (+11/-0)
tests/t/subselect_notembedded-master.opt (+1/-0)
To merge this branch: bzr merge lp:~dshrews/drizzle/bug532481
Reviewer Review Type Date Requested Status
Drizzle Merge Team Pending
Review via email: mp+31989@code.launchpad.net

This proposal supersedes a proposal from 2010-08-06.

Description of the change

Modifies multi_thread plugin to use --thread_stack parameter when given. Fixes cases where we need more stack space for deeply recursive queries.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/plugin/scheduler.cc'
2--- drizzled/plugin/scheduler.cc 2010-05-15 18:23:34 +0000
3+++ drizzled/plugin/scheduler.cc 2010-08-06 19:07:46 +0000
4@@ -31,6 +31,8 @@
5 namespace drizzled
6 {
7
8+extern size_t my_thread_stack_size;
9+
10 vector<plugin::Scheduler *> all_schedulers;
11
12 /* Globals (TBK) */
13@@ -107,4 +109,9 @@
14 return scheduler;
15 }
16
17+size_t plugin::Scheduler::getThreadStackSize() const
18+{
19+ return my_thread_stack_size;
20+}
21+
22 } /* namespace drizzled */
23
24=== modified file 'drizzled/plugin/scheduler.h'
25--- drizzled/plugin/scheduler.h 2010-02-04 08:14:46 +0000
26+++ drizzled/plugin/scheduler.h 2010-08-06 19:07:46 +0000
27@@ -71,6 +71,11 @@
28 static bool setPlugin(const std::string& name);
29 static Scheduler *getScheduler();
30
31+ /**
32+ * Return the thread stack size that should be used for all threads.
33+ */
34+ size_t getThreadStackSize() const;
35+
36 };
37
38 } /* namespace plugin */
39
40=== modified file 'plugin/multi_thread/multi_thread.cc'
41--- plugin/multi_thread/multi_thread.cc 2010-07-18 06:07:19 +0000
42+++ plugin/multi_thread/multi_thread.cc 2010-08-06 19:07:46 +0000
43@@ -18,6 +18,7 @@
44 #include "drizzled/pthread_globals.h"
45 #include <boost/program_options.hpp>
46 #include <drizzled/module/option_map.h>
47+#include <drizzled/errmsg_print.h>
48
49 namespace po= boost::program_options;
50 using namespace std;
51@@ -54,6 +55,16 @@
52 if (thread_count >= max_threads)
53 return true;
54
55+ int err= pthread_attr_setstacksize(&attr, getThreadStackSize());
56+
57+ if (err != 0)
58+ {
59+ errmsg_printf(ERRMSG_LVL_ERROR,
60+ _("Unable to set thread stack size to %" PRId64 "\n"),
61+ static_cast<uint64_t>(getThreadStackSize()));
62+ return true;
63+ }
64+
65 thread_count.increment();
66
67 if (pthread_create(&session->real_id, &attr, session_thread,
68
69=== added file 'tests/t/subselect_notembedded-master.opt'
70--- tests/t/subselect_notembedded-master.opt 1970-01-01 00:00:00 +0000
71+++ tests/t/subselect_notembedded-master.opt 2010-08-06 19:07:46 +0000
72@@ -0,0 +1,1 @@
73+--thread_stack=1048576