Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB8-120: Added db_metadata options to create database command #972

Closed
wants to merge 1 commit into from

Conversation

dutow
Copy link
Contributor

@dutow dutow commented Feb 27, 2019

JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: 2f08e3a
Reference commit: a21e84f
Reference commit: 5983ba3181a
Reference commit: 414870abeee

-------- 2f08e3a --------

Added new option db_metadata to the create database
CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
SHOW CREATE DATABASE db_name

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{'shard_name':'myshard_for_test2'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2 | CREATE DATABASE test2 /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */ |
+----------+--------------------------------------------------------------------------------------------------------------------------+

@dutow dutow changed the title FB8-120: Added db_metadata options to create database command WIP FB8-120: Added db_metadata options to create database command Feb 27, 2019
Copy link
Contributor

@percona-ysorokin percona-ysorokin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly stylistic comments + one potential buffer overflow problem.

Please, also extend commit message with some info that in 8.0 database metadata is stored in Data Dictionary rather than in an .opt file.

return true;
}

String_type const &Schema_impl::get_db_metadata() const { return m_metadata; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String_type const &Schema_impl::get_db_metadata() const { return m_metadata; }
String_type const &Schema_impl::get_db_metadata() const noexcept { return m_metadata; }

@@ -127,6 +128,9 @@ class Schema_impl : public Entity_object_impl, public Schema {

virtual bool set_options_raw(const String_type &options_raw);

virtual bool set_db_metadata(const String_type &metadata) override;
virtual String_type const &get_db_metadata() const override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
virtual String_type const &get_db_metadata() const override;
virtual String_type const &get_db_metadata() const noexcept override;

id(), name().c_str(), m_default_collation_id, m_created,
m_last_altered);
m_last_altered, m_metadata.c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential buffer overflow here with very long metadata.
Consider snprintf().

@@ -110,6 +110,9 @@ class Schema : virtual public Entity_object {

virtual bool set_options_raw(const String_type &options_raw) = 0;

virtual bool set_db_metadata(const String_type &metadata) = 0;
virtual String_type const &get_db_metadata() const = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
virtual String_type const &get_db_metadata() const = 0;
virtual String_type const &get_db_metadata() const noexcept = 0;

sql/sql_yacc.yy Outdated
boost::property_tree::json_parser::read_json(is,
db_metadata_root);
}
catch (std::exception)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
catch (std::exception)
catch (const std::exception&)

@@ -66,7 +66,8 @@ class Schema_impl : public Entity_object_impl, public Schema {
: m_created(0),
m_last_altered(0),
m_default_collation_id(INVALID_OBJECT_ID),
m_options(new Properties_impl()) {}
m_options(new Properties_impl()),
m_metadata("") {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
m_metadata("") {}
m_metadata() {}

// Create dd::Schema object.
std::unique_ptr<dd::Schema> schema(dd::create_object<dd::Schema>());

// Set schema name and collation id.
schema->set_name(schema_name);
DBUG_ASSERT(charset_info);
schema->set_default_collation_id(charset_info->number);
schema->set_db_metadata(db_metadata ? db_metadata : "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no implicit conversions

Suggested change
schema->set_db_metadata(db_metadata ? db_metadata : "");
schema->set_db_metadata(db_metadata != nullptr ? db_metadata : "");

@@ -0,0 +1,163 @@
# Test per-database database-metadata attribute

--disable_query_log
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is need to disable query log here, please check



# cleanup
--disable_warnings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the warning disable required here? What are the warnings?

@@ -1236,6 +1239,7 @@ void warn_about_deprecated_national(THD *thd)
%token<keyword> GTID_SYM
%token<keyword> GTID_EXECUTED /* MYSQL */
%token<keyword> SUPER_READ_ONLY_SYM /* MYSQL */
%token DB_METADATA_SYM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8.0 has some attempts to have parser token ID (and resulting query digest) stability, please check: might be a good idea to skip 100 IDs and start a FB-specific section

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 3 tokens above this are also added by facebook - I simply added this one to the end of the existing list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? All three look like MySQL ones

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a comment at line 1236: "Tokens from FB MySQL"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, sorry. And there is no provision to skip IDs, thus everything already is as good as it could be

@dutow
Copy link
Contributor Author

dutow commented Mar 1, 2019

updated

Copy link
Contributor

@percona-ysorokin percona-ysorokin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lth
Copy link
Contributor

lth commented Mar 7, 2019

You might want to follow how the DB read only feature was done, because I believe by changing the schema, you need to bump some data dictionary version or something. The FIELD_OPTIONS column is meant to be a generic place to add key/values, and I'm wondering if that's a better place for this.

b9ec08a

@dutow
Copy link
Contributor Author

dutow commented Apr 3, 2019

Updated: I removed the additional columns from the dd, and used the options field. Tests pass now.

@dutow dutow changed the title WIP FB8-120: Added db_metadata options to create database command FB8-120: Added db_metadata options to create database command Apr 8, 2019
Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@hermanlee hermanlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good overall. Just some small minor comments.

@@ -18728,6 +18728,15 @@ ER_RPL_FAILED_IN_RLI_INIT_INFO
ER_SEMISYNC_FORCE_SHUTDOWN
eng "Force shutdown: Semi-sync master is being switched off while there are active un-acked transactions"

ER_DB_METADATA_TOO_LONG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should replace ER_PLACEHOLDER_50063.

ER_DB_METADATA_TOO_LONG
eng "Metadata for the database is too long. Max length is %d bytes"

ER_DB_METADATA_INVALID_JSON
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace ER_PLACEHOLDER_50064

ER_DB_METADATA_INVALID_JSON
eng "Invalid JSON for DB_METADATA attribute: %s."

ER_DB_METADATA_READ_ERROR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace ER_PLACEHOLDER_50065

@@ -127,6 +128,9 @@ class Schema_impl : public Entity_object_impl, public Schema {

virtual bool set_options_raw(const String_type &options_raw);

virtual bool set_db_metadata(const String_type &metadata) override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also compile with -Winconsistent-missing-override, so adding this override cause the compiler to warn about the rest of the object:

In file included from ../../sql/dd/impl/bootstrapper.cc:58:
../../sql/dd/impl/types/schema_impl.h:75:31: error: 'object_table' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  virtual const Object_table &object_table() const;
../../sql/dd/impl/types/weak_object_impl.h:50:31: note: overridden virtual function is here
  virtual const Object_table &object_table() const = 0;
                              ^
In file included from ../../sql/dd/impl/bootstrapper.cc:58:
../../sql/dd/impl/types/schema_impl.h:77:16: error: 'validate' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  virtual bool validate() const;
               ^
../../sql/dd/impl/types/weak_object_impl.h:52:16: note: overridden virtual function is here
  virtual bool validate() const = 0;
               ^

sql/sql_const.h Outdated
@@ -286,6 +286,9 @@ static const ulong EVENT_DEF_CACHE_MIN = 256;
*/
#define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1)

#define DB_METADATA_MAX_LENGTH 1024 /* Max length for the db-metadata option \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like "*/" should also fit onto this line too?

@@ -155,7 +155,7 @@ bool migrate_schema_to_dd(THD *thd, const char *dbname) {
// Disable autocommit option
Disable_autocommit_guard autocommit_guard(thd);

if (dd::create_schema(thd, schema_name, schema_charset)) {
if (dd::create_schema(thd, schema_name, schema_charset, nullptr)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 5.6, we store the db_metadata information in the db_opt file using the keyword db-metadata. Since there are in-place upgrade paths planned to 8.0, it should be fine to have nullptr here.

@@ -106,6 +106,25 @@ bool Schema_impl::set_options_raw(const String_type &options_raw) {
return false;
}

bool Schema_impl::set_db_metadata(const String_type &metadata) {
if (metadata.empty()) {
if (options().exists("db_metadata")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can "db_metadata" be made into a constant string, similar to read_only_options_key?

Copy link
Contributor

@hermanlee hermanlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for the db_metadata key.

JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: 2f08e3a
Reference commit: a21e84f
Reference commit: 5983ba3181a
Reference commit: 414870abeee

In 8.0, db_metadata is stored in the data dictionary instead of opt files.

-------- 2f08e3a --------

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+
@facebook-github-bot
Copy link

@dutow has updated the pull request. Re-import the pull request

@dutow
Copy link
Contributor Author

dutow commented Apr 30, 2019

Updated.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request May 14, 2019
Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: 2f08e3a
Reference commit: a21e84f
Reference commit: 5983ba3181a
Reference commit: 414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: #972

Reviewed By: yizhang82

Differential Revision: D14883632

Pulled By: yizhang82

fbshipit-source-id: 3af0fc8
@hermanlee hermanlee closed this Jun 10, 2019
facebook-github-bot pushed a commit that referenced this pull request Nov 18, 2019
Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: 2f08e3a
Reference commit: a21e84f
Reference commit: 5983ba3181a
Reference commit: 414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: #972

Reviewed By: yizhang82

Differential Revision: D14883632

Pulled By: yizhang82

fbshipit-source-id: 84fda3f
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 16, 2020
…ok#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Reviewed By: yizhang82

Differential Revision: D14883632

Pulled By: yizhang82

fbshipit-source-id: 84fda3f
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 17, 2020
…ok#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Reviewed By: yizhang82

Differential Revision: D14883632

Pulled By: yizhang82

fbshipit-source-id: 84fda3f
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 28, 2020
…ok#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Reviewed By: yizhang82

Differential Revision: D14883632

Pulled By: yizhang82

fbshipit-source-id: 84fda3f
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 29, 2020
…ok#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Reviewed By: yizhang82

Differential Revision: D14883632

Pulled By: yizhang82

fbshipit-source-id: 84fda3f
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 10, 2020
…ok#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Reviewed By: yizhang82

Differential Revision: D14883632

Pulled By: yizhang82

fbshipit-source-id: 84fda3f
hermanlee pushed a commit to hermanlee/mysql-5.6 that referenced this pull request Oct 18, 2023
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 15, 2024
…a#972) (percona#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook/mysql-5.6@2f08e3a
Reference commit: facebook/mysql-5.6@a21e84f
Reference commit: facebook/mysql-5.6@5983ba3181a
Reference commit: facebook/mysql-5.6@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook/mysql-5.6#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 16, 2024
…a#972) (percona#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook/mysql-5.6@2f08e3a
Reference commit: facebook/mysql-5.6@a21e84f
Reference commit: facebook/mysql-5.6@5983ba3181a
Reference commit: facebook/mysql-5.6@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook/mysql-5.6#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 17, 2024
…a#972) (percona#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook/mysql-5.6@2f08e3a
Reference commit: facebook/mysql-5.6@a21e84f
Reference commit: facebook/mysql-5.6@5983ba3181a
Reference commit: facebook/mysql-5.6@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook/mysql-5.6#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Apr 23, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Apr 25, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 7, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 8, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 9, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 10, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 13, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 15, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 16, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 17, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 21, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 21, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 30, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 12, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 13, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 14, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 19, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 20, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 21, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 25, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 2, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 19, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 19, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jul 31, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 2, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 6, 2024
…ok#972) (facebook#972)

Summary:
JIRA ticket: https://jira.percona.com/browse/FB8-120

Reference commit: facebook@2f08e3a
Reference commit: facebook@a21e84f
Reference commit: facebook@5983ba3181a
Reference commit: facebook@414870abeee

Added new option db_metadata to the create database
`CREATE DATABASE [IF NOT EXISTS] db_name DB_METADATA [=] metadata`

The new option is stored in the db.opt file along with other database options like charset and read_only.
The options accepts any string value. If not specified, it writes empty string as the default value in the db.opt file.
To retrieve the option value for a particular database, the show command can be used as follows:
`SHOW CREATE DATABASE db_name`

Example Usage:

create database test2 charset utf8 read_only = true db_metadata '{\'shard_name\':\'myshard_for_test2\'}';
show create database test2;

Output:

+----------+--------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                          |
+----------+--------------------------------------------------------------------------------------------------------------------------+
| test2    | CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET utf8 READ_ONLY DB_METADATA {'shard_name':'myshard_for_test2'} */  |
+----------+--------------------------------------------------------------------------------------------------------------------------+

Pull Request resolved: facebook#972

Differential Revision: D14883632

Pulled By: yizhang82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants