Module key

Source
Expand description

This mod defines all the keys used in the metadata store (Metasrv). Specifically, there are these kinds of keys:

  1. Datanode table key: __dn_table/{datanode_id}/{table_id}

    • The value is a DatanodeTableValue struct; it contains table_id and the regions that belong to this Datanode.
    • This key is primary used in the startup of Datanode, to let Datanode know which tables and regions it should open.
  2. Table info key: __table_info/{table_id}

    • The value is a TableInfoValue struct; it contains the whole table info (like column schemas).
    • This key is mainly used in constructing the table in Datanode and Frontend.
  3. Catalog name key: __catalog_name/{catalog_name}

    • Indices all catalog names
  4. Schema name key: __schema_name/{catalog_name}/{schema_name}

    • Indices all schema names belong to the {catalog_name}
  5. Table name key: __table_name/{catalog_name}/{schema_name}/{table_name}

    • The value is a TableNameValue struct; it contains the table id.
    • Used in the table name to table id lookup.
  6. Flow info key: __flow/info/{flow_id}

    • Stores metadata of the flow.
  7. Flow route key: __flow/route/{flow_id}/{partition_id}

    • Stores route of the flow.
  8. Flow name key: __flow/name/{catalog}/{flow_name}

    • Mapping {catalog}/{flow_name} to {flow_id}
  9. Flownode flow key: __flow/flownode/{flownode_id}/{flow_id}/{partition_id}

    • Mapping {flownode_id} to {flow_id}
  10. Table flow key: __flow/source_table/{table_id}/{flownode_id}/{flow_id}/{partition_id}

    • Mapping source table’s {table_id} to {flownode_id}
    • Used in Flownode booting.
  11. View info key: __view_info/{view_id}

    • The value is a ViewInfoValue struct; it contains the encoded logical plan.
    • This key is mainly used in constructing the view in Datanode and Frontend.
  12. Kafka topic key: __topic_name/kafka/{topic_name}

    • The key is used to track existing topics in Kafka.
    • The value is a TopicNameValue struct; it contains the pruned_entry_id which represents the highest entry id that has been pruned from the remote WAL.
    • When a region uses this topic, it should start replaying entries from pruned_entry_id + 1 (minimum available entry id).
  13. Topic name to region map key __topic_region/{topic_name}/{region_id}

    • Mapping {topic_name} to {region_id}

All keys have related managers. The managers take care of the serialization and deserialization of keys and values, and the interaction with the underlying KV store backend.

To simplify the managers used in struct fields and function parameters, we define “unify” table metadata manager: TableMetadataManager and flow metadata manager: FlowMetadataManager. It contains all the managers defined above. It’s recommended to just use this manager only.

The whole picture of flow keys will be like this:

__flow/ info/ {flow_id} route/ {flow_id}/ {partition_id}

name/ {catalog_name} {flow_name}

flownode/ {flownode_id}/ {flow_id}/ {partition_id}

source_table/ {table_id}/ {flownode_id}/ {flow_id}/ {partition_id}

Modules§

catalog_name
datanode_table
flow
maintenance
node_address
schema_metadata_manager 🔒
Schema-level metadata manager.
schema_name
table_info
table_name
table_route
test_utils
tombstone 🔒
topic_name
topic_region
txn_helper
view_info

Macros§

impl_metadata_key_get_txn_op 🔒

Structs§

BytesAdapter
CATALOG_NAME_KEY_PATTERN 🔒
CATALOG_NAME_KEY: {CATALOG_NAME_KEY_PREFIX}/{catalog_name}
DATANODE_TABLE_KEY_PATTERN 🔒
DeserializedValueWithBytes
A struct containing a deserialized value(inner) and an original bytes.
KAFKA_TOPIC_KEY_PATTERN
NAME_PATTERN_REGEX
NODE_ADDRESS_PATTERN 🔒
SCHEMA_NAME_KEY_PATTERN 🔒
SCHEMA_NAME_KEY: {SCHEMA_NAME_KEY_PREFIX}/{catalog_name}/{schema_name}
SchemaMetadataManager
TABLE_INFO_KEY_PATTERN 🔒
TABLE_NAME_KEY_PATTERN 🔒
TABLE_ROUTE_KEY_PATTERN 🔒
TOPIC_REGION_PATTERN
TableMetadataManager
VIEW_INFO_KEY_PATTERN 🔒

Constants§

CACHE_KEY_PREFIXES
The keys with these prefixes will be loaded into the cache when the leader starts.
CATALOG_NAME_KEY_PREFIX
DATANODE_TABLE_KEY_PREFIX
KAFKA_TOPIC_KEY_PREFIX
LEGACY_TOPIC_KEY_PREFIX
MAINTENANCE_KEY
NAME_PATTERN
NODE_ADDRESS_PREFIX
SCHEMA_NAME_KEY_PREFIX
TABLE_INFO_KEY_PREFIX
TABLE_NAME_KEY_PREFIX
TABLE_ROUTE_PREFIX
TOPIC_REGION_PREFIX
VIEW_INFO_KEY_PREFIX

Traits§

MetadataKey
The key of metadata.
MetadataKeyGetTxnOp 🔒
MetadataValue

Type Aliases§

FlowId
The id of flow.
FlowPartitionId
The partition of flow.
RegionDistribution
SchemaMetadataManagerRef
TableMetadataManagerRef