kimmking commented on a change in pull request #5166: Optimize MetaData Center #MetaDataCenter-phase-3-4 URL: https://github.com/apache/incubator-shardingsphere/pull/5166#discussion_r407440689
########## File path: docs/document/content/features/orchestration/metadata-center.en.md ########## @@ -0,0 +1,103 @@ ++++ +pre = "<b>3.3.3. </b>" +toc = true +title = "Metadata Center" +weight = 3 ++++ + +## Motivation + +- Metadata is the core data of the data source used by Sharding-JDBC / Sharding-Proxy, which contains tables, columns, and indexes, etc. Metadata ensures that each component of ShardingSphere can run correctly. + +- The metadata center organizes and manages the metadata in a unified manner to realize the unified loading of metadata, change notifications and data synchronization. + +## Data Structure in Metadata Center + +The metadata center stores metadata in YAML under the metadata node of the defined namespace, and each logical data source is stored independently. + +``` +metadata + ├──schema1 + ├ ├── [YAML text contents] + ├──schema2 + ├ ├── [YAML text contents] + ├──.... +``` + +## YAML text contents + +In the metadata center, metadata is divided into two parts: `configuredSchemaMetaData` and` unconfiguredSchemaMetaDataMap`. + +Dynamic modification of metadata content is not supported currently. + +``` +configuredSchemaMetaData: + tables: # Tables + t_order: # table_name + columns: # Columns + id: # column_name + caseSensitive: false + dataType: 0 + generated: false + name: id + primaryKey: trues + order_id: + caseSensitive: false + dataType: 0 + generated: false + name: order_id + primaryKey: false + indexs: # Indexes + t_user_order_id_index: # index_name + name: t_user_order_id_index + t_order_item: + columns: + order_id: + caseSensitive: false + dataType: 0 + generated: false + name: order_id + primaryKey: false +unconfiguredSchemaMetaDataMap: + ds_0: # DataSources + tables: # Tables + t_user: # table_name + columns: # Columns + user_id: # column_name + caseSensitive: false + dataType: 0 + generated: false + name: user_id + primaryKey: false + id: + caseSensitive: false + dataType: 0 + generated: false + name: id + primaryKey: true + order_id: + caseSensitive: false + dataType: 0 + generated: false + name: order_id + primaryKey: false + indexes: # Indexes + t_user_order_id_index: # index_name + name: t_user_order_id_index + t_user_user_id_index: + name: t_user_user_id_index + primary: + name: PRIMARY +``` + +### configuredSchemaMetaData + +Store metadata for all data sources configured with sharding rules. + +### unconfiguredSchemaMetaDataMap + +Store metadata for data sources that no sharding rules configured. + +## Change Notifications + +After DDL is executed through a certain Proxy instance, the metadata center notifies other Proxy instances to reload metadata through an event mechanism to ensure metadata consistency. Review comment: as the above ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
