Skip to content

Conversation

@TomShawn
Copy link
Contributor

@TomShawn TomShawn commented Apr 8, 2020

What is changed, added or deleted? (Required)

Add the cluster_load, cluster_systeminfo and cluster_log system tables.

Which TiDB version(s) do your changes apply to? (Required)

  • master (the latest development version)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

If you select two or more versions from above, to trigger the bot to cherry-pick this PR to your desired release version branch(es), you must add corresponding labels such as needs-cherry-pick-4.0, needs-cherry-pick-3.1, needs-cherry-pick-3.0, and needs-cherry-pick-2.1.

What is the related PR or file link(s)?

@TomShawn TomShawn added translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. v4.0 This PR/issue applies to TiDB v4.0. size/large Changes of a large size. needs-cherry-pick-4.0 labels Apr 8, 2020
@TomShawn TomShawn requested review from lilin90 and reafans April 8, 2020 13:35
Field description:

* `TYPE`: Corresponds to the `TYPE` field in the [`information_schema.cluster_info`](/reference/system-databases/cluster-info.md) table. The optional values are `tidb`, `pd`, and `tikv`.
* `INSTANCE`: Corresponds to the `STATUS_ADDRESS` field in the [`information_schema.cluster_info`](/reference/system-databases/cluster-info.md) cluster information table.
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Member

@lilin90 lilin90 Apr 9, 2020

Choose a reason for hiding this comment

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

@reafans I see that the Chinese version still uses STATUS_ADDRESS in cluster-load.md. Would you please check and update all necessary places for docs-cn?

Copy link
Contributor

Choose a reason for hiding this comment

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

We have tested some place in sql-diagnosis and fixed some unreasonable detail recently. And i will check and update the Chinese version recently。


# CLUSTER_LOAD

The `CLUSTER_LOAD` cluster load table provides the current load information of the server where each node of the TiDB cluster is located.
Copy link
Member

Choose a reason for hiding this comment

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

@reafans Please help confirm whether it's instance or node here.

Suggested change
The `CLUSTER_LOAD` cluster load table provides the current load information of the server where each node of the TiDB cluster is located.
The `CLUSTER_LOAD` cluster load table provides the current load information of the server where each instance of the TiDB cluster is located.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is instance here.


> **Note:**
>
> + All fields of the cluster log table are pushed down to the corresponding node for execution. So to reduce the overhead of using the cluster log table, specify as many conditions as possible. For example, the `select * from cluter_log where instance='tikv-1'` statement only executes the log search on the `tikv-1` node.
Copy link
Member

Choose a reason for hiding this comment

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

ditto. @reafans PTAL It seems that it should be instance. @TomShawn Please pay attention to all nodes in this PR after @reafans confirms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

Copy link
Contributor

@reafans reafans Apr 10, 2020

Choose a reason for hiding this comment

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

  1. The format of instance is ip:port, which represent a TiDB or TiKV instance.
  2. The node is not accurate, maybe host is better, it represents a physical node, which contains some instance, and its format like ip.
  3. A host only contains one instance in produciton environment mostly , and there are also some situations in which a host contains several instance. So use instance may be more accurate. All the node in this pr need be changed to instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All node is replaced in the recently added system table documents.

@TomShawn
Copy link
Contributor Author

@reafans @lilin90 Comments addressed, PTAL again, thanks!

@yikeke yikeke added the status/PTAL This PR is ready for reviewing. label Apr 14, 2020
Copy link
Member

@lilin90 lilin90 left a comment

Choose a reason for hiding this comment

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

LGTM

@sre-bot
Copy link
Contributor

sre-bot commented Apr 16, 2020

@reafans, @lilin90, PTAL.

1 similar comment
@sre-bot
Copy link
Contributor

sre-bot commented Apr 18, 2020

@reafans, @lilin90, PTAL.

desc cluster_load;
```

```
Copy link
Member

Choose a reason for hiding this comment

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

Adding sql to the results can also make it looks better with colors at the website.

Suggested change
```
```sql

select * from cluster_load where device_type='cpu' and device_name='cpu';
```

```
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```
```sql


You can query cluster logs on the `CLUSTER_LOG` cluster log table. By pushing down query conditions to each instance, the impact of the query on cluster performance is less than that of the `grep` command.

To get the logs of the TiDB cluster before v4.0, you need to log in to each instance to summarize logs. This cluster log table in 4.0 provides the global and time-ordered log search result, which makes it easier to track full-link events. For example, by searching logs according to the `region id`, you can query all logs in the life cycle of this Region; similarly, by searching the full link log through the slow log's `txn id`, you can query the flow and the number of keys scanned by this transaction at each instance.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
To get the logs of the TiDB cluster before v4.0, you need to log in to each instance to summarize logs. This cluster log table in 4.0 provides the global and time-ordered log search result, which makes it easier to track full-link events. For example, by searching logs according to the `region id`, you can query all logs in the life cycle of this Region; similarly, by searching the full link log through the slow log's `txn id`, you can query the flow and the number of keys scanned by this transaction at each instance.
To get the logs of the TiDB cluster before v4.0, you need to log in to each instance to summarize logs. This cluster log table in 4.0 provides the global and time-ordered log search result, which makes it easier to track full-link events. For example, by searching logs according to the `region id`, you can query all logs in the life cycle of this Region. Similarly, by searching the full link log through the slow log's `txn id`, you can query the flow and the number of keys scanned by this transaction at each instance.

desc cluster_log;
```

```
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```
```sql

select * from `CLUSTER_LOG` where message like '%ddl%' and message like '%job%58%' and type='tidb' and time > '2020-03-27 15:39:00';
```

```
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```
```sql

desc cluster_systeminfo;
```

```
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```
```sql

select * from CLUSTER_SYSTEMINFO where name like '%kernel.osrelease%'
```

```
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```
```sql

Copy link
Contributor

@reafans reafans left a comment

Choose a reason for hiding this comment

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

LGTM

@lilin90 lilin90 merged commit 425e111 into pingcap:master Apr 21, 2020
sre-bot pushed a commit to sre-bot/docs that referenced this pull request Apr 21, 2020
* reference/system-databases: add 3 cluster tables (2)

* replace node with instance and address comments

* change field name

* add `sql` to results

Co-authored-by: Lilian Lee <lilin@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Apr 21, 2020

cherry pick to release-4.0 in PR #2359

lilin90 added a commit that referenced this pull request Apr 21, 2020
* reference/system-databases: add 3 cluster tables (2)

* replace node with instance and address comments

* change field name

* add `sql` to results

Co-authored-by: Lilian Lee <lilin@pingcap.com>

Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: Lilian Lee <lilin@pingcap.com>
@TomShawn TomShawn deleted the cluster-table2 branch April 21, 2020 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/large Changes of a large size. status/PTAL This PR is ready for reviewing. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. v4.0 This PR/issue applies to TiDB v4.0.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants