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
=== modified file 'drizzled/catalog/local.cc'
--- drizzled/catalog/local.cc 2011-09-18 17:33:22 +0000
+++ drizzled/catalog/local.cc 2011-12-27 06:57:24 +0000
@@ -1,7 +1,7 @@
1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *3 *
4 * Copyright (C) 2010 Brian Aker4 * Copyright (C) 2010-2011 Brian Aker, Stewart Smith
5 *5 *
6 * This program is free software; you can redistribute it and/or modify6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by7 * it under the terms of the GNU General Public License as published by
@@ -42,6 +42,14 @@
42 return default_catalog;42 return default_catalog;
43}43}
4444
45void resetPath_for_local_identifier()
46{
47 /* this is currently commented out to do nothing as we don't need
48 to reset the relative path ../local to anything but that.
49 We will need to enable this when we don't chdir into local on startup */
50// default_catalog.resetPath();
51}
52
45Instance::shared_ptr local()53Instance::shared_ptr local()
46{54{
47 boost::call_once(&init, run_once);55 boost::call_once(&init, run_once);
4856
=== modified file 'drizzled/catalog/local.h'
--- drizzled/catalog/local.h 2011-03-23 23:34:24 +0000
+++ drizzled/catalog/local.h 2011-12-27 06:57:24 +0000
@@ -1,7 +1,7 @@
1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *3 *
4 * Copyright (C) 2010 Brian Aker4 * Copyright (C) 2010-2011 Brian Aker, Stewart Smith
5 *5 *
6 * This program is free software; you can redistribute it and/or modify6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by7 * it under the terms of the GNU General Public License as published by
@@ -28,6 +28,9 @@
28namespace drizzled {28namespace drizzled {
29namespace catalog {29namespace catalog {
3030
31/* only for use by drizzled after command line parsing (new datadir) */
32void resetPath_for_local_identifier();
33
31DRIZZLED_API const identifier::Catalog& local_identifier();34DRIZZLED_API const identifier::Catalog& local_identifier();
32DRIZZLED_API Instance::shared_ptr local();35DRIZZLED_API Instance::shared_ptr local();
3336
3437
=== modified file 'drizzled/data_home.cc'
--- drizzled/data_home.cc 2011-06-16 15:27:28 +0000
+++ drizzled/data_home.cc 2011-12-27 06:57:24 +0000
@@ -1,7 +1,7 @@
1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *3 *
4 * Copyright (C) 2011 Brian Aker4 * Copyright (C) 2011 Brian Aker, Stewart Smith
5 *5 *
6 * This program is free software; you can redistribute it and/or modify6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by7 * it under the terms of the GNU General Public License as published by
@@ -22,12 +22,12 @@
22#include <boost/filesystem.hpp>22#include <boost/filesystem.hpp>
23#include <drizzled/configmake.h>23#include <drizzled/configmake.h>
24#include <drizzled/data_home.h>24#include <drizzled/data_home.h>
25#include <drizzled/catalog.h>
2526
26namespace drizzled {27namespace drizzled {
2728
28static boost::filesystem::path data_home(LOCALSTATEDIR);29static boost::filesystem::path data_home(LOCALSTATEDIR);
29static boost::filesystem::path full_data_home(LOCALSTATEDIR);30static boost::filesystem::path full_data_home(LOCALSTATEDIR);
30static boost::filesystem::path data_home_catalog(LOCALSTATEDIR);
3131
32const boost::filesystem::path& getFullDataHome()32const boost::filesystem::path& getFullDataHome()
33{33{
@@ -39,11 +39,6 @@
39 return data_home;39 return data_home;
40}40}
4141
42const boost::filesystem::path& getDataHomeCatalog()
43{
44 return data_home_catalog;
45}
46
47boost::filesystem::path& getMutableDataHome()42boost::filesystem::path& getMutableDataHome()
48{43{
49 return data_home;44 return data_home;
@@ -54,9 +49,4 @@
54 full_data_home= v;49 full_data_home= v;
55}50}
5651
57void setDataHomeCatalog(const boost::filesystem::path& v)
58{
59 data_home_catalog= v;
60}
61
62} // namespace drizzled52} // namespace drizzled
6353
=== modified file 'drizzled/data_home.h'
--- drizzled/data_home.h 2011-06-16 15:27:28 +0000
+++ drizzled/data_home.h 2011-12-27 06:57:24 +0000
@@ -26,10 +26,8 @@
2626
27DRIZZLED_API const boost::filesystem::path& getFullDataHome();27DRIZZLED_API const boost::filesystem::path& getFullDataHome();
28DRIZZLED_API const boost::filesystem::path& getDataHome();28DRIZZLED_API const boost::filesystem::path& getDataHome();
29DRIZZLED_API const boost::filesystem::path& getDataHomeCatalog();
30DRIZZLED_API boost::filesystem::path& getMutableDataHome();29DRIZZLED_API boost::filesystem::path& getMutableDataHome();
31DRIZZLED_API void setFullDataHome(const boost::filesystem::path&);30DRIZZLED_API void setFullDataHome(const boost::filesystem::path&);
32DRIZZLED_API void setDataHomeCatalog(const boost::filesystem::path&);
3331
34} /* namespace drizzled */32} /* namespace drizzled */
3533
3634
=== modified file 'drizzled/drizzled.cc'
--- drizzled/drizzled.cc 2011-11-22 14:53:10 +0000
+++ drizzled/drizzled.cc 2011-12-27 06:57:24 +0000
@@ -1977,7 +1977,7 @@
1977*/1977*/
1978static void get_options()1978static void get_options()
1979{1979{
1980 setDataHomeCatalog(getDataHome() / "local");1980 catalog::resetPath_for_local_identifier();
19811981
1982 if (vm.count("user"))1982 if (vm.count("user"))
1983 {1983 {
19841984
=== modified file 'drizzled/function/str/load_file.cc'
--- drizzled/function/str/load_file.cc 2011-06-22 22:23:29 +0000
+++ drizzled/function/str/load_file.cc 2011-12-27 06:57:24 +0000
@@ -2,6 +2,7 @@
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *3 *
4 * Copyright (C) 2008 Sun Microsystems, Inc.4 * Copyright (C) 2008 Sun Microsystems, Inc.
5 * Copyright (C) 2011 Stewart Smith
5 *6 *
6 * This program is free software; you can redistribute it and/or modify7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by8 * it under the terms of the GNU General Public License as published by
@@ -21,7 +22,7 @@
21#include <drizzled/function/str/strfunc.h>22#include <drizzled/function/str/strfunc.h>
22#include <drizzled/function/str/load_file.h>23#include <drizzled/function/str/load_file.h>
23#include <drizzled/error.h>24#include <drizzled/error.h>
24#include <drizzled/data_home.h>25#include <drizzled/catalog/local.h>
25#include <drizzled/session.h>26#include <drizzled/session.h>
26#include <drizzled/internal/my_sys.h>27#include <drizzled/internal/my_sys.h>
27#include <drizzled/sys_var.h>28#include <drizzled/sys_var.h>
@@ -52,7 +53,7 @@
52 return 0;53 return 0;
53 }54 }
5455
55 fs::path target_path(fs::system_complete(getDataHomeCatalog()));56 fs::path target_path(fs::system_complete(catalog::local_identifier().getPath()));
56 fs::path to_file(file_name->c_ptr());57 fs::path to_file(file_name->c_ptr());
57 if (not to_file.has_root_directory())58 if (not to_file.has_root_directory())
58 {59 {
5960
=== modified file 'drizzled/identifier/catalog.h'
--- drizzled/identifier/catalog.h 2011-09-18 17:33:22 +0000
+++ drizzled/identifier/catalog.h 2011-12-27 06:57:24 +0000
@@ -81,6 +81,12 @@
81 {81 {
82 return boost::iequals(left.getName(), right.getName());82 return boost::iequals(left.getName(), right.getName());
83 }83 }
84
85 void resetPath()
86 {
87 init();
88 }
89
84private:90private:
85 void init();91 void init();
8692
8793
=== modified file 'drizzled/session.cc'
--- drizzled/session.cc 2011-11-09 20:20:23 +0000
+++ drizzled/session.cc 2011-12-27 06:57:24 +0000
@@ -27,7 +27,7 @@
27#include <boost/filesystem.hpp>27#include <boost/filesystem.hpp>
28#include <boost/ptr_container/ptr_container.hpp>28#include <boost/ptr_container/ptr_container.hpp>
29#include <drizzled/copy_field.h>29#include <drizzled/copy_field.h>
30#include <drizzled/data_home.h>30#include <drizzled/catalog/local.h>
31#include <drizzled/diagnostics_area.h>31#include <drizzled/diagnostics_area.h>
32#include <drizzled/display.h>32#include <drizzled/display.h>
33#include <drizzled/drizzled.h>33#include <drizzled/drizzled.h>
@@ -996,7 +996,7 @@
996996
997 if (not to_file.has_root_directory())997 if (not to_file.has_root_directory())
998 {998 {
999 target_path= fs::system_complete(getDataHomeCatalog());999 target_path= fs::system_complete(catalog::local_identifier().getPath());
1000 util::string::ptr schema(session.schema());1000 util::string::ptr schema(session.schema());
1001 if (not schema->empty())1001 if (not schema->empty())
1002 {1002 {
10031003
=== modified file 'drizzled/sql_load.cc'
--- drizzled/sql_load.cc 2011-10-18 11:01:40 +0000
+++ drizzled/sql_load.cc 2011-12-27 06:57:24 +0000
@@ -1,4 +1,5 @@
1/* Copyright (C) 2000-2006 MySQL AB1/* Copyright (C) 2000-2006 MySQL AB
2 Copyright (C) 2011 Stewart Smith
23
3 This program is free software; you can redistribute it and/or modify4 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by5 it under the terms of the GNU General Public License as published by
@@ -20,7 +21,7 @@
2021
21#include <drizzled/sql_load.h>22#include <drizzled/sql_load.h>
22#include <drizzled/error.h>23#include <drizzled/error.h>
23#include <drizzled/data_home.h>24#include <drizzled/catalog/local.h>
24#include <drizzled/session.h>25#include <drizzled/session.h>
25#include <drizzled/sql_base.h>26#include <drizzled/sql_base.h>
26#include <drizzled/field/epoch.h>27#include <drizzled/field/epoch.h>
@@ -263,7 +264,7 @@
263 }264 }
264265
265 fs::path to_file(ex->file_name);266 fs::path to_file(ex->file_name);
266 fs::path target_path(fs::system_complete(getDataHomeCatalog()));267 fs::path target_path(fs::system_complete(catalog::local_identifier().getPath()));
267 if (not to_file.has_root_directory())268 if (not to_file.has_root_directory())
268 {269 {
269 int count_elements= 0;270 int count_elements= 0;
270271
=== modified file 'plugin/innobase/handler/ha_innodb.cc'
--- plugin/innobase/handler/ha_innodb.cc 2011-11-09 20:20:23 +0000
+++ plugin/innobase/handler/ha_innodb.cc 2011-12-27 06:57:24 +0000
@@ -3,6 +3,7 @@
3Copyright (C) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.3Copyright (C) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
4Copyright (C) 2008, 2009 Google Inc.4Copyright (C) 2008, 2009 Google Inc.
5Copyright (C) 2009, Percona Inc.5Copyright (C) 2009, Percona Inc.
6Copyright (C) 2011, Stewart Smith
67
7Portions of this file contain modifications contributed and copyrighted by8Portions of this file contain modifications contributed and copyrighted by
8Google, Inc. Those modifications are gratefully acknowledged and are described9Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -50,6 +51,7 @@
50#include <drizzled/plugin.h>51#include <drizzled/plugin.h>
51#include <drizzled/show.h>52#include <drizzled/show.h>
52#include <drizzled/data_home.h>53#include <drizzled/data_home.h>
54#include <drizzled/catalog/local.h>
53#include <drizzled/error.h>55#include <drizzled/error.h>
54#include <drizzled/field.h>56#include <drizzled/field.h>
55#include <drizzled/charset.h>57#include <drizzled/charset.h>
@@ -7287,7 +7289,7 @@
72877289
7288 prebuilt->trx->op_info = "returning various info to MySQL";7290 prebuilt->trx->op_info = "returning various info to MySQL";
72897291
7290 fs::path get_status_path(getDataHomeCatalog());7292 fs::path get_status_path(catalog::local_identifier().getPath());
7291 get_status_path /= ib_table->name;7293 get_status_path /= ib_table->name;
7292 fs::change_extension(get_status_path, "dfe");7294 fs::change_extension(get_status_path, "dfe");
72937295
72947296
=== modified file 'plugin/schema_engine/schema.cc'
--- plugin/schema_engine/schema.cc 2011-10-18 13:52:19 +0000
+++ plugin/schema_engine/schema.cc 2011-12-27 06:57:24 +0000
@@ -26,7 +26,7 @@
26#include <drizzled/sql_table.h>26#include <drizzled/sql_table.h>
27#include <drizzled/charset.h>27#include <drizzled/charset.h>
28#include <drizzled/cursor.h>28#include <drizzled/cursor.h>
29#include <drizzled/data_home.h>29#include <drizzled/catalog/local.h>
3030
31#include <drizzled/pthread_globals.h>31#include <drizzled/pthread_globals.h>
3232
@@ -71,7 +71,9 @@
7171
72void Schema::prime()72void Schema::prime()
73{73{
74 CachedDirectory directory(getDataHomeCatalog().file_string(), CachedDirectory::DIRECTORY);74 CachedDirectory directory(catalog::local_identifier().getPath(),
75 CachedDirectory::DIRECTORY, true);
76
75 CachedDirectory::Entries files= directory.getEntries();77 CachedDirectory::Entries files= directory.getEntries();
76 boost::unique_lock<boost::shared_mutex> scopedLock(mutex);78 boost::unique_lock<boost::shared_mutex> scopedLock(mutex);
7779
@@ -80,7 +82,12 @@
80 if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT))82 if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT))
81 continue;83 continue;
82 message::Schema schema_message;84 message::Schema schema_message;
83 if (readSchemaFile(entry->filename, schema_message))85
86 std::string filename= catalog::local_identifier().getPath();
87 filename+= FN_LIBCHAR;
88 filename+= entry->filename;
89
90 if (readSchemaFile(filename, schema_message))
84 {91 {
85 identifier::Schema schema_identifier(schema_message.name());92 identifier::Schema schema_identifier(schema_message.name());
8693