Merge lp:~stewart/drizzle/embedded-innodb-configuration-file-format into lp:~drizzle-trunk/drizzle/development

Proposed by Stewart Smith
Status: Merged
Merged at revision: 1536
Proposed branch: lp:~stewart/drizzle/embedded-innodb-configuration-file-format
Merge into: lp:~drizzle-trunk/drizzle/development
Prerequisite: lp:~stewart/drizzle/embedded-innodb-configuration-file-per-table
Diff against target: 154 lines (+100/-1)
4 files modified
plugin/embedded_innodb/embedded_innodb_engine.cc (+58/-1)
plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/r/config_file_format.result (+28/-0)
plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format-master.opt (+1/-0)
plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format.test (+13/-0)
To merge this branch: bzr merge lp:~stewart/drizzle/embedded-innodb-configuration-file-format
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Brian Aker Pending
Review via email: mp+24805@code.launchpad.net

Description of the change

support innodb_file_format option

To post a comment you must log in.
1438. By Stewart Smith

remove mem leak as well as properly show the default innodb_file_format.

Revision history for this message
Jay Pipes (jaypipes) wrote :

++broccolini

review: Approve
1439. By Stewart Smith

Merged embedded-innodb-configuration-file-per-table into embedded-innodb-configuration-file-format.

1440. By Stewart Smith

Merged embedded-innodb-configuration-file-per-table into embedded-innodb-configuration-file-format.

1441. By Stewart Smith

merge trunk

1442. By Stewart Smith

Merged embedded-innodb-configuration-file-per-table into embedded-innodb-configuration-file-format.

1443. By Stewart Smith

Merged embedded-innodb-configuration-file-per-table into embedded-innodb-configuration-file-format.

1444. By Stewart Smith

Merged embedded-innodb-configuration-file-per-table into embedded-innodb-configuration-file-format.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugin/embedded_innodb/embedded_innodb_engine.cc'
2--- plugin/embedded_innodb/embedded_innodb_engine.cc 2010-05-17 13:07:35 +0000
3+++ plugin/embedded_innodb/embedded_innodb_engine.cc 2010-05-17 13:07:36 +0000
4@@ -2179,6 +2179,7 @@
5 static unsigned long srv_io_capacity= 200;
6 static unsigned long innobase_fast_shutdown= 1;
7 static bool srv_file_per_table= false;
8+static char* innobase_file_format_name = NULL;
9 static char default_innodb_data_file_path[]= "ibdata1:10M:autoextend";
10 static char* innodb_data_file_path= NULL;
11
12@@ -2239,7 +2240,7 @@
13 if (err != DB_SUCCESS)
14 goto innodb_error;
15
16- err= ib_startup("barracuda");
17+ err= ib_startup(innobase_file_format_name);
18 if (err != DB_SUCCESS)
19 goto innodb_error;
20
21@@ -2279,6 +2280,55 @@
22 }
23 }
24
25+static char innodb_file_format_name_storage[100];
26+
27+static int innodb_file_format_name_validate(Session*, drizzle_sys_var*,
28+ void *save,
29+ drizzle_value *value)
30+{
31+ ib_err_t err;
32+ char buff[100];
33+ int len= sizeof(buff);
34+ const char *format= value->val_str(value, buff, &len);
35+
36+ *static_cast<const char**>(save)= NULL;
37+
38+ if (format == NULL)
39+ return 1;
40+
41+ err= ib_cfg_set_text("file_format", format);
42+
43+ if (err == DB_SUCCESS)
44+ {
45+ strncpy(innodb_file_format_name_storage, format, sizeof(innodb_file_format_name_storage));;
46+ innodb_file_format_name_storage[sizeof(innodb_file_format_name_storage)-1]= 0;
47+
48+ *static_cast<const char**>(save)= innodb_file_format_name_storage;
49+ return 0;
50+ }
51+ else
52+ return 1;
53+}
54+
55+static void innodb_file_format_name_update(Session*, drizzle_sys_var*,
56+ void *var_ptr,
57+ const void *save)
58+
59+{
60+ const char* format;
61+
62+ assert(var_ptr != NULL);
63+ assert(save != NULL);
64+
65+ format= *static_cast<const char*const*>(save);
66+
67+ /* Format is already set in validate */
68+ strncpy(innodb_file_format_name_storage, format, sizeof(innodb_file_format_name_storage));;
69+ innodb_file_format_name_storage[sizeof(innodb_file_format_name_storage)-1]= 0;
70+
71+ *static_cast<const char**>(var_ptr)= innodb_file_format_name_storage;
72+}
73+
74 static DRIZZLE_SYSVAR_BOOL(checksums, innobase_use_checksums,
75 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
76 "Enable InnoDB checksums validation (enabled by default). "
77@@ -2314,6 +2364,12 @@
78 "Stores each InnoDB table to an .ibd file in the database dir.",
79 NULL, NULL, false);
80
81+static DRIZZLE_SYSVAR_STR(file_format, innobase_file_format_name,
82+ PLUGIN_VAR_RQCMDARG,
83+ "File format to use for new tables in .ibd files.",
84+ innodb_file_format_name_validate,
85+ innodb_file_format_name_update, "Barracuda");
86+
87 static DRIZZLE_SYSVAR_STR(data_file_path, innodb_data_file_path,
88 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
89 "Path to individual files and their sizes.",
90@@ -2341,6 +2397,7 @@
91 DRIZZLE_SYSVAR(io_capacity),
92 DRIZZLE_SYSVAR(fast_shutdown),
93 DRIZZLE_SYSVAR(file_per_table),
94+ DRIZZLE_SYSVAR(file_format),
95 DRIZZLE_SYSVAR(data_file_path),
96 DRIZZLE_SYSVAR(lock_wait_timeout),
97 DRIZZLE_SYSVAR(log_file_size),
98
99=== added file 'plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/r/config_file_format.result'
100--- plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/r/config_file_format.result 1970-01-01 00:00:00 +0000
101+++ plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/r/config_file_format.result 2010-05-17 13:07:36 +0000
102@@ -0,0 +1,28 @@
103+SHOW VARIABLES LIKE 'innodb_file_format';
104+Variable_name Value
105+innodb_file_format Barracuda
106+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
107+NAME TYPE VALUE
108+file_format TEXT Barracuda
109+SET GLOBAL innodb_file_format='antelope';
110+SHOW VARIABLES LIKE 'innodb_file_format';
111+Variable_name Value
112+innodb_file_format antelope
113+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
114+NAME TYPE VALUE
115+file_format TEXT Antelope
116+SET GLOBAL innodb_file_format='barracuda';
117+SHOW VARIABLES LIKE 'innodb_file_format';
118+Variable_name Value
119+innodb_file_format barracuda
120+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
121+NAME TYPE VALUE
122+file_format TEXT Barracuda
123+SET GLOBAL innodb_file_format='broccolini';
124+ERROR HY000: Incorrect arguments to SET
125+SHOW VARIABLES LIKE 'innodb_file_format';
126+Variable_name Value
127+innodb_file_format barracuda
128+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
129+NAME TYPE VALUE
130+file_format TEXT Barracuda
131
132=== added file 'plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format-master.opt'
133--- plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format-master.opt 1970-01-01 00:00:00 +0000
134+++ plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format-master.opt 2010-05-17 13:07:36 +0000
135@@ -0,0 +1,1 @@
136+--plugin_add=embedded_innodb --plugin_remove=innobase
137
138=== added file 'plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format.test'
139--- plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format.test 1970-01-01 00:00:00 +0000
140+++ plugin/embedded_innodb/test-suite-dir/embedded_innodb/tests/t/config_file_format.test 2010-05-17 13:07:36 +0000
141@@ -0,0 +1,13 @@
142+SHOW VARIABLES LIKE 'innodb_file_format';
143+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
144+SET GLOBAL innodb_file_format='antelope';
145+SHOW VARIABLES LIKE 'innodb_file_format';
146+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
147+SET GLOBAL innodb_file_format='barracuda';
148+SHOW VARIABLES LIKE 'innodb_file_format';
149+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
150+--error 1210
151+SET GLOBAL innodb_file_format='broccolini';
152+SHOW VARIABLES LIKE 'innodb_file_format';
153+SELECT * FROM DATA_DICTIONARY.INNODB_CONFIGURATION WHERE NAME='file_format';
154+