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

op-guide, sql: add description about TSO support #492

Merged
merged 2 commits into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion op-guide/history-read.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The `tidb_snapshot` system variable is introduced to support reading history dat
- The variable is valid in the `Session` scope.
- Its value can be modified using the `Set` statement.
- The data type for the variable is text.
- The variable is to record time in the following format: 2016-10-08 16:45:26.999. Generally, the time can be set to seconds like in 2016-10-08 16:45:26”.
- The variable can store TSO (Timestamp Oracle) and time. TSO is a globally unique time service, which obtains information from PD. The time that this variable records uses the following format: "2016-10-08 16:45:26.999". Generally, the time can be set to just seconds like in "2016-10-08 16:45:26".
Copy link
Contributor

@zhexuany zhexuany Jun 11, 2018

Choose a reason for hiding this comment

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

The variable accepts TSO (Timestamp Oracle) and datetime. TSO is a globally unique time service, which is obtained from PD. The acceptable datetime format is "2016-10-08 16:45:26.999". Generally, the datetime can be set using second precision, e.g, "2016-10-08 16:45:26".

Above translation resolves the confusion. @lilin90 PTAL

- When the variable is set, TiDB creates a Snapshot using its value as the timestamp, just for the data structure and there is no any overhead. After that, all the `Select` operations will read data from this Snapshot.

> **Note:** Because the timestamp in TiDB transactions is allocated by Placement Driver (PD), the version of the stored data is also marked based on the timestamp allocated by PD. When a Snapshot is created, the version number is based on the value of the `tidb_snapshot` variable. If there is a large difference between the local time of the TiDB server and the PD server, use the time of the PD server.
Expand Down
2 changes: 1 addition & 1 deletion sql/tidb-specific.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you need to set the global variable, run:

- Scope: SESSION
- Default value: ""
- This variable is used to set the time point at which the data is read by the session. For example, when you set the variable to "2017-11-11 20:20:20", the current session reads the data of this moment.
- This variable is used to set the time point at which the data is read by the session. For example, when you set the variable to "2017-11-11 20:20:20" or a TSO number like "400036290571534337", the current session reads the data of this moment.

### tidb_import_data

Expand Down