Tablet metadata management tool

Background

In the latest version of the code, we introduced RocksDB in BE to store meta-information of tablet, in order to solve various functional and performance problems caused by storing meta-information through header file. Currently, each data directory (root path) has a corresponding RocksDB instance, in which all tablets on the corresponding root path are stored in the key-value manner.

To facilitate the maintenance of these metadata, we provide an online HTTP interface and an offline meta tool to complete related management operations.

The HTTP interface is only used to view tablet metadata online, and can be used when the BE process is running.

However, meta tool is only used for off-line metadata management operations. BE must be stopped before it can be used.

The meta tool tool is stored in the Lib / directory of BE.

Operation

View Tablet Meta

Viewing Tablet Meta information can be divided into online and offline methods

On-line

Access BE’s HTTP interface to obtain the corresponding Tablet Meta information:

api:

http://{host}:{port}/api/meta/header/{tablet_id}/{schema_hash}

Host: be Hostname

port: BE’s HTTP port

tablet id: tablet id

schema hash: tablet schema hash

Give an example:

http://be_host:8040/api/meta/header/14156/2458238340

If the final query is successful, the Tablet Meta will be returned as json.

Offline

Get Tablet Meta on a disk based on the meta\ tool tool.

Order:

  1. ./lib/meta_tool --root_path=/path/to/root_path --operation=get_meta --tablet_id=xxx --schema_hash=xxx

root_path: The corresponding root_path path path configured in be.conf.

The result is also a presentation of Tablet Meta in JSON format.

Load header

The function of loading header is provided to realize manual migration of tablet. This function is based on Tablet Meta in JSON format, so if changes in the shard field and version information are involved, they can be changed directly in the JSON content of Tablet Meta. Then use the following commands to load.

Order:

  1. ./lib/meta_tool --operation=load_meta --root_path=/path/to/root_path --json_header_path=path

Delete header

In order to realize the function of deleting a tablet from a disk of a be.

Order:

  1. ./lib/meta_tool --operation=delete_meta --root_path=/path/to/root_path --tablet_id=xxx --schema_hash=xxx`

TabletMeta in Pb format

This command is to view the old file-based management PB format Tablet Meta, and to display Tablet Meta in JSON format.

Order:

  1. ./lib/meta_tool --operation=show_meta --root_path=/path/to/root_path --pb_header_path=path