Merge lp:~stewart/drizzle/remove-datahome-catalog into lp:~drizzle-trunk/drizzle/development

Proposed by Stewart Smith
Status: Merged
Approved by: Mark Atwood
Approved revision: 2480
Merged at revision: 2485
Proposed branch: lp:~stewart/drizzle/remove-datahome-catalog
Merge into: lp:~drizzle-trunk/drizzle/development
Prerequisite: lp:~stewart/drizzle/key-use-catalog
Diff against target: 290 lines (+43/-27)
11 files modified
drizzled/catalog/local.cc (+9/-1)
drizzled/catalog/local.h (+4/-1)
drizzled/data_home.cc (+2/-12)
drizzled/data_home.h (+0/-2)
drizzled/drizzled.cc (+1/-1)
drizzled/function/str/load_file.cc (+3/-2)
drizzled/identifier/catalog.h (+6/-0)
drizzled/session.cc (+2/-2)
drizzled/sql_load.cc (+3/-2)
plugin/innobase/handler/ha_innodb.cc (+3/-1)
plugin/schema_engine/schema.cc (+10/-3)
To merge this branch: bzr merge lp:~stewart/drizzle/remove-datahome-catalog
Reviewer Review Type Date Requested Status
Brian Aker Approve
Review via email: mp+86922@code.launchpad.net

Description of the change

Remove getDataHomeCatalog(), which means we produce "local/" in the path in a couple of places which is kinda nice, gets us a step closer towards multiple CATALOGs.

We instead use catalog::local_identifier() around the place.

I also lay some groundwork inside the schema engine.

http://jenkins.drizzle.org/view/Drizzle-param/job/drizzle-param/912/

To post a comment you must log in.
Revision history for this message
Olaf van der Spek (olafvdspek) wrote :

- * Copyright (C) 2010 Brian Aker
+ * Copyright (C) 2010-2011 Brian Aker, Stewart Smith

What are the rules for the copyright lines?
Should one add one's name to every file one edits?

Revision history for this message
Brian Aker (brianaker) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/catalog/local.cc'
2--- drizzled/catalog/local.cc 2011-09-18 17:33:22 +0000
3+++ drizzled/catalog/local.cc 2011-12-27 06:57:24 +0000
4@@ -1,7 +1,7 @@
5 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
6 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
7 *
8- * Copyright (C) 2010 Brian Aker
9+ * Copyright (C) 2010-2011 Brian Aker, Stewart Smith
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13@@ -42,6 +42,14 @@
14 return default_catalog;
15 }
16
17+void resetPath_for_local_identifier()
18+{
19+ /* this is currently commented out to do nothing as we don't need
20+ to reset the relative path ../local to anything but that.
21+ We will need to enable this when we don't chdir into local on startup */
22+// default_catalog.resetPath();
23+}
24+
25 Instance::shared_ptr local()
26 {
27 boost::call_once(&init, run_once);
28
29=== modified file 'drizzled/catalog/local.h'
30--- drizzled/catalog/local.h 2011-03-23 23:34:24 +0000
31+++ drizzled/catalog/local.h 2011-12-27 06:57:24 +0000
32@@ -1,7 +1,7 @@
33 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
34 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
35 *
36- * Copyright (C) 2010 Brian Aker
37+ * Copyright (C) 2010-2011 Brian Aker, Stewart Smith
38 *
39 * This program is free software; you can redistribute it and/or modify
40 * it under the terms of the GNU General Public License as published by
41@@ -28,6 +28,9 @@
42 namespace drizzled {
43 namespace catalog {
44
45+/* only for use by drizzled after command line parsing (new datadir) */
46+void resetPath_for_local_identifier();
47+
48 DRIZZLED_API const identifier::Catalog& local_identifier();
49 DRIZZLED_API Instance::shared_ptr local();
50
51
52=== modified file 'drizzled/data_home.cc'
53--- drizzled/data_home.cc 2011-06-16 15:27:28 +0000
54+++ drizzled/data_home.cc 2011-12-27 06:57:24 +0000
55@@ -1,7 +1,7 @@
56 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
57 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
58 *
59- * Copyright (C) 2011 Brian Aker
60+ * Copyright (C) 2011 Brian Aker, Stewart Smith
61 *
62 * This program is free software; you can redistribute it and/or modify
63 * it under the terms of the GNU General Public License as published by
64@@ -22,12 +22,12 @@
65 #include <boost/filesystem.hpp>
66 #include <drizzled/configmake.h>
67 #include <drizzled/data_home.h>
68+#include <drizzled/catalog.h>
69
70 namespace drizzled {
71
72 static boost::filesystem::path data_home(LOCALSTATEDIR);
73 static boost::filesystem::path full_data_home(LOCALSTATEDIR);
74-static boost::filesystem::path data_home_catalog(LOCALSTATEDIR);
75
76 const boost::filesystem::path& getFullDataHome()
77 {
78@@ -39,11 +39,6 @@
79 return data_home;
80 }
81
82-const boost::filesystem::path& getDataHomeCatalog()
83-{
84- return data_home_catalog;
85-}
86-
87 boost::filesystem::path& getMutableDataHome()
88 {
89 return data_home;
90@@ -54,9 +49,4 @@
91 full_data_home= v;
92 }
93
94-void setDataHomeCatalog(const boost::filesystem::path& v)
95-{
96- data_home_catalog= v;
97-}
98-
99 } // namespace drizzled
100
101=== modified file 'drizzled/data_home.h'
102--- drizzled/data_home.h 2011-06-16 15:27:28 +0000
103+++ drizzled/data_home.h 2011-12-27 06:57:24 +0000
104@@ -26,10 +26,8 @@
105
106 DRIZZLED_API const boost::filesystem::path& getFullDataHome();
107 DRIZZLED_API const boost::filesystem::path& getDataHome();
108-DRIZZLED_API const boost::filesystem::path& getDataHomeCatalog();
109 DRIZZLED_API boost::filesystem::path& getMutableDataHome();
110 DRIZZLED_API void setFullDataHome(const boost::filesystem::path&);
111-DRIZZLED_API void setDataHomeCatalog(const boost::filesystem::path&);
112
113 } /* namespace drizzled */
114
115
116=== modified file 'drizzled/drizzled.cc'
117--- drizzled/drizzled.cc 2011-11-22 14:53:10 +0000
118+++ drizzled/drizzled.cc 2011-12-27 06:57:24 +0000
119@@ -1977,7 +1977,7 @@
120 */
121 static void get_options()
122 {
123- setDataHomeCatalog(getDataHome() / "local");
124+ catalog::resetPath_for_local_identifier();
125
126 if (vm.count("user"))
127 {
128
129=== modified file 'drizzled/function/str/load_file.cc'
130--- drizzled/function/str/load_file.cc 2011-06-22 22:23:29 +0000
131+++ drizzled/function/str/load_file.cc 2011-12-27 06:57:24 +0000
132@@ -2,6 +2,7 @@
133 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
134 *
135 * Copyright (C) 2008 Sun Microsystems, Inc.
136+ * Copyright (C) 2011 Stewart Smith
137 *
138 * This program is free software; you can redistribute it and/or modify
139 * it under the terms of the GNU General Public License as published by
140@@ -21,7 +22,7 @@
141 #include <drizzled/function/str/strfunc.h>
142 #include <drizzled/function/str/load_file.h>
143 #include <drizzled/error.h>
144-#include <drizzled/data_home.h>
145+#include <drizzled/catalog/local.h>
146 #include <drizzled/session.h>
147 #include <drizzled/internal/my_sys.h>
148 #include <drizzled/sys_var.h>
149@@ -52,7 +53,7 @@
150 return 0;
151 }
152
153- fs::path target_path(fs::system_complete(getDataHomeCatalog()));
154+ fs::path target_path(fs::system_complete(catalog::local_identifier().getPath()));
155 fs::path to_file(file_name->c_ptr());
156 if (not to_file.has_root_directory())
157 {
158
159=== modified file 'drizzled/identifier/catalog.h'
160--- drizzled/identifier/catalog.h 2011-09-18 17:33:22 +0000
161+++ drizzled/identifier/catalog.h 2011-12-27 06:57:24 +0000
162@@ -81,6 +81,12 @@
163 {
164 return boost::iequals(left.getName(), right.getName());
165 }
166+
167+ void resetPath()
168+ {
169+ init();
170+ }
171+
172 private:
173 void init();
174
175
176=== modified file 'drizzled/session.cc'
177--- drizzled/session.cc 2011-11-09 20:20:23 +0000
178+++ drizzled/session.cc 2011-12-27 06:57:24 +0000
179@@ -27,7 +27,7 @@
180 #include <boost/filesystem.hpp>
181 #include <boost/ptr_container/ptr_container.hpp>
182 #include <drizzled/copy_field.h>
183-#include <drizzled/data_home.h>
184+#include <drizzled/catalog/local.h>
185 #include <drizzled/diagnostics_area.h>
186 #include <drizzled/display.h>
187 #include <drizzled/drizzled.h>
188@@ -996,7 +996,7 @@
189
190 if (not to_file.has_root_directory())
191 {
192- target_path= fs::system_complete(getDataHomeCatalog());
193+ target_path= fs::system_complete(catalog::local_identifier().getPath());
194 util::string::ptr schema(session.schema());
195 if (not schema->empty())
196 {
197
198=== modified file 'drizzled/sql_load.cc'
199--- drizzled/sql_load.cc 2011-10-18 11:01:40 +0000
200+++ drizzled/sql_load.cc 2011-12-27 06:57:24 +0000
201@@ -1,4 +1,5 @@
202 /* Copyright (C) 2000-2006 MySQL AB
203+ Copyright (C) 2011 Stewart Smith
204
205 This program is free software; you can redistribute it and/or modify
206 it under the terms of the GNU General Public License as published by
207@@ -20,7 +21,7 @@
208
209 #include <drizzled/sql_load.h>
210 #include <drizzled/error.h>
211-#include <drizzled/data_home.h>
212+#include <drizzled/catalog/local.h>
213 #include <drizzled/session.h>
214 #include <drizzled/sql_base.h>
215 #include <drizzled/field/epoch.h>
216@@ -263,7 +264,7 @@
217 }
218
219 fs::path to_file(ex->file_name);
220- fs::path target_path(fs::system_complete(getDataHomeCatalog()));
221+ fs::path target_path(fs::system_complete(catalog::local_identifier().getPath()));
222 if (not to_file.has_root_directory())
223 {
224 int count_elements= 0;
225
226=== modified file 'plugin/innobase/handler/ha_innodb.cc'
227--- plugin/innobase/handler/ha_innodb.cc 2011-11-09 20:20:23 +0000
228+++ plugin/innobase/handler/ha_innodb.cc 2011-12-27 06:57:24 +0000
229@@ -3,6 +3,7 @@
230 Copyright (C) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
231 Copyright (C) 2008, 2009 Google Inc.
232 Copyright (C) 2009, Percona Inc.
233+Copyright (C) 2011, Stewart Smith
234
235 Portions of this file contain modifications contributed and copyrighted by
236 Google, Inc. Those modifications are gratefully acknowledged and are described
237@@ -50,6 +51,7 @@
238 #include <drizzled/plugin.h>
239 #include <drizzled/show.h>
240 #include <drizzled/data_home.h>
241+#include <drizzled/catalog/local.h>
242 #include <drizzled/error.h>
243 #include <drizzled/field.h>
244 #include <drizzled/charset.h>
245@@ -7287,7 +7289,7 @@
246
247 prebuilt->trx->op_info = "returning various info to MySQL";
248
249- fs::path get_status_path(getDataHomeCatalog());
250+ fs::path get_status_path(catalog::local_identifier().getPath());
251 get_status_path /= ib_table->name;
252 fs::change_extension(get_status_path, "dfe");
253
254
255=== modified file 'plugin/schema_engine/schema.cc'
256--- plugin/schema_engine/schema.cc 2011-10-18 13:52:19 +0000
257+++ plugin/schema_engine/schema.cc 2011-12-27 06:57:24 +0000
258@@ -26,7 +26,7 @@
259 #include <drizzled/sql_table.h>
260 #include <drizzled/charset.h>
261 #include <drizzled/cursor.h>
262-#include <drizzled/data_home.h>
263+#include <drizzled/catalog/local.h>
264
265 #include <drizzled/pthread_globals.h>
266
267@@ -71,7 +71,9 @@
268
269 void Schema::prime()
270 {
271- CachedDirectory directory(getDataHomeCatalog().file_string(), CachedDirectory::DIRECTORY);
272+ CachedDirectory directory(catalog::local_identifier().getPath(),
273+ CachedDirectory::DIRECTORY, true);
274+
275 CachedDirectory::Entries files= directory.getEntries();
276 boost::unique_lock<boost::shared_mutex> scopedLock(mutex);
277
278@@ -80,7 +82,12 @@
279 if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT))
280 continue;
281 message::Schema schema_message;
282- if (readSchemaFile(entry->filename, schema_message))
283+
284+ std::string filename= catalog::local_identifier().getPath();
285+ filename+= FN_LIBCHAR;
286+ filename+= entry->filename;
287+
288+ if (readSchemaFile(filename, schema_message))
289 {
290 identifier::Schema schema_identifier(schema_message.name());
291