You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: Add DB_METADATA to INFORMATION_SCHEMA.SCHEMATA for each database for easy query by OLM
Test Plan:
1. Test manually by inspecting SCHEMATA
Result:
https://phabricator.intern.facebook.com/P60466869
2. Update test case (TODO)
Reviewers: herman, lcai
Reviewed By: herman
Subscribers: butterflybot, webscalesql-eng@fb.com
Differential Revision: https://phabricator.intern.facebook.com/D13510326
Tasks: T37428915
Tags: bootcamp
Signature: 13510326:1546451545:62ec37297de59dde87229dfa922570fa510c45e3
alter database test3 db_metadata = "{\"shard\":\"test3_shard_altered\"}";
108
116
show create database test3;
109
117
--exec cat $MYSQLD_DATADIR/test3/db.opt
118
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
110
119
111
120
# alter database read only
112
121
alter database test4 read_only = true;
@@ -117,6 +126,7 @@ show create database test4;
117
126
alter database test4 db_metadata = "{\"shard\":\"test4_shard_altered\"}";
118
127
show create database test4;
119
128
--exec cat $MYSQLD_DATADIR/test4/db.opt
129
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
120
130
121
131
# alter database read only
122
132
alter database test4 read_only = false;
@@ -127,6 +137,7 @@ show create database test4;
127
137
alter database test5 db_metadata = "{\"shard\":\"test5_shard_altered\"}";
128
138
show create database test5;
129
139
--exec cat $MYSQLD_DATADIR/test5/db.opt
140
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
130
141
131
142
# alter database character set but keep db metadata intact
132
143
alter database test5 character set ascii;
@@ -147,11 +158,13 @@ show create database test5;
147
158
alter database test5 db_metadata "";
148
159
show create database test5;
149
160
--exec cat $MYSQLD_DATADIR/test5/db.opt
161
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
150
162
151
163
# alter database set db metadata to max length string
152
164
alter database test5 db_metadata "{\"shard\":\"Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Fin\"}";
153
165
show create database test5;
154
166
--exec cat $MYSQLD_DATADIR/test5/db.opt
167
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
alter database test5 db_metadata "{\"shard\":\"Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Really long shard name. Fin\"}";
179
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
166
180
167
181
# alter database character set and db metadata
168
182
alter database test6 character set ascii db_metadata = "{\"shard\":\"test6_shard_altered\"}";
169
183
show create database test6;
170
184
--exec cat $MYSQLD_DATADIR/test6/db.opt
185
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
171
186
172
187
# alter database read only and db metadata
173
188
alter database test7 read_only = true db_metadata = "{\"shard\":\"test7_shard_altered\"}";
174
189
show create database test7;
175
190
--exec cat $MYSQLD_DATADIR/test7/db.opt
191
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
176
192
177
193
# alter database character set and read only
178
194
alter database test8 character set ascii read_only = true;
179
195
show create database test8;
180
196
--exec cat $MYSQLD_DATADIR/test8/db.opt
197
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
181
198
182
199
# alter database character set, read only and db metadata
183
200
alter database test9 character set ascii read_only = true db_metadata = "{\"shard\":\"test9_shard_altered\"}";
184
201
show create database test9;
185
202
--exec cat $MYSQLD_DATADIR/test9/db.opt
203
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
186
204
187
205
# ensure information_schema and mysql tables are intact
188
206
show create database information_schema;
189
207
show create database mysql;
190
208
--error ER_DBACCESS_DENIED_ERROR
191
209
alter database information_schema db_metadata "{\"shard\":\"is_shard\"}";
210
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
192
211
193
212
# alter database with invalid JSON string for db_metadata
194
213
--error ER_DB_METADATA_INVALID_JSON
195
214
alter database test9 db_metadata = "invalid_json";
215
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
196
216
197
217
# create database without any options
198
218
create database test10;
@@ -208,6 +228,7 @@ show create database test10;
208
228
alter database test10 db_metadata = "{\"shard\":\"test10_shard_altered\"}";
209
229
show create database test10;
210
230
--exec cat $MYSQLD_DATADIR/test10/db.opt
231
+
select catalog_name, schema_name, db_metadata from information_schema.schemata_ext;
0 commit comments