|
| 1 | +--- |
| 2 | +{ |
| 3 | + "title": "ADMIN COPY TABLET", |
| 4 | + "language": "en" |
| 5 | +} |
| 6 | +--- |
| 7 | + |
| 8 | +<!-- |
| 9 | +Licensed to the Apache Software Foundation (ASF) under one |
| 10 | +or more contributor license agreements. See the NOTICE file |
| 11 | +distributed with this work for additional information |
| 12 | +regarding copyright ownership. The ASF licenses this file |
| 13 | +to you under the Apache License, Version 2.0 (the |
| 14 | +"License"); you may not use this file except in compliance |
| 15 | +with the License. You may obtain a copy of the License at |
| 16 | +
|
| 17 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 18 | +
|
| 19 | +Unless required by applicable law or agreed to in writing, |
| 20 | +software distributed under the License is distributed on an |
| 21 | +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 22 | +KIND, either express or implied. See the License for the |
| 23 | +specific language governing permissions and limitations |
| 24 | +under the License. |
| 25 | +--> |
| 26 | + |
| 27 | +## Description |
| 28 | + |
| 29 | +This statement is used to make a snapshot for the specified tablet, mainly used to load the tablet locally to reproduce |
| 30 | +the problem. |
| 31 | + |
| 32 | +## Syntax |
| 33 | + |
| 34 | +```sql |
| 35 | +ADMIN COPY TABLET <tablet_id> PROPERTIES ("<key>"="<value>" [,...]). |
| 36 | +``` |
| 37 | + |
| 38 | +## Required Parameters |
| 39 | + |
| 40 | +**1. `<tablet_id>`** |
| 41 | + |
| 42 | +The ID of the tablet to be copied. |
| 43 | + |
| 44 | +## Optional Parameters |
| 45 | + |
| 46 | + ```sql |
| 47 | + [ PROPERTIES ("<key>"="<value>" [, ... ]) ] |
| 48 | + ``` |
| 49 | + |
| 50 | +The PROPERTIES clause allows specifying additional parameters: |
| 51 | + |
| 52 | +**1. `<backend_id>`** |
| 53 | + |
| 54 | +Specifies the id of the BE node where the replica is located. If not specified, a replica is randomly selected. |
| 55 | + |
| 56 | +**2. `<version>`** |
| 57 | + |
| 58 | +Specifies the version of the snapshot. The version must be less than or equal to the largest version of the replica. If |
| 59 | +not specified, the largest version is used. |
| 60 | + |
| 61 | +**3. `<expiration_minutes>`** |
| 62 | + |
| 63 | +Snapshot retention time. The default is 1 hour. It will automatically clean up after a timeout. Unit minutes. |
| 64 | + |
| 65 | +## Return Value |
| 66 | + |
| 67 | +| Column | DataType | Note | |
| 68 | +|-------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 69 | +| TabletId | string | The ID of the tablet for which the snapshot was created. | |
| 70 | +| BackendId | string | The ID of the BE node where the snapshot is stored. | |
| 71 | +| Ip | string | The IP address of the BE node storing the snapshot. | |
| 72 | +| Path | string | The storage path where the snapshot is saved on the BE node. | |
| 73 | +| ExpirationMinutes | string | The duration (in minutes) after which the snapshot will be automatically deleted. | |
| 74 | +| CreateTableStmt | string | The table creation statement for the table corresponding to the tablet. This statement is not the original table-building statement, but a simplified table-building statement for later loading the tablet locally. | |
| 75 | + |
| 76 | +## Access Control Requirements |
| 77 | + |
| 78 | +The user executing this SQL command must have at least the following privileges: |
| 79 | + |
| 80 | +| Privilege | Object | Notes | |
| 81 | +|:-----------|:---------|:---------------------------------------------------------------------------------------------------------------------------------| |
| 82 | +| Admin_priv | Database | Required to execute administrative operations on the database, including managing tables, partitions, and system-level commands. | |
| 83 | + |
| 84 | +## Examples |
| 85 | + |
| 86 | +- Take a snapshot of the replica on the specified BE node |
| 87 | + |
| 88 | + ```sql |
| 89 | + ADMIN COPY TABLET 10020 PROPERTIES("backend_id" = "10003"); |
| 90 | + ``` |
| 91 | + |
| 92 | + ```text |
| 93 | + TabletId: 10020 |
| 94 | + BackendId: 10003 |
| 95 | + Ip: 192.168.10.1 |
| 96 | + Path: /path/to/be/storage/snapshot/20220830101353.2.3600 |
| 97 | + ExpirationMinutes: 60 |
| 98 | + CreateTableStmt: CREATE TABLE `tbl1` ( |
| 99 | + `k1` int(11) NULL, |
| 100 | + `k2` int(11) NULL |
| 101 | + ) ENGINE=OLAP |
| 102 | + DUPLICATE KEY(`k1`, `k2`) |
| 103 | + DISTRIBUTED BY HASH(k1) BUCKETS 1 |
| 104 | + PROPERTIES ( |
| 105 | + "replication_num" = "1", |
| 106 | + "version_info" = "2" |
| 107 | + ); |
| 108 | + ``` |
| 109 | + |
| 110 | +- Take a snapshot of the specified version of the replica on the specified BE node |
| 111 | + |
| 112 | + ```sql |
| 113 | + ADMIN COPY TABLET 10010 PROPERTIES("backend_id" = "10003", "version" = "10"); |
| 114 | + ``` |
| 115 | + |
| 116 | + ```text |
| 117 | + TabletId: 10010 |
| 118 | + BackendId: 10003 |
| 119 | + Ip: 192.168.10.1 |
| 120 | + Path: /path/to/be/storage/snapshot/20220830101353.2.3600 |
| 121 | + ExpirationMinutes: 60 |
| 122 | + CreateTableStmt: CREATE TABLE `tbl1` ( |
| 123 | + `k1` int(11) NULL, |
| 124 | + `k2` int(11) NULL |
| 125 | + ) ENGINE=OLAP |
| 126 | + DUPLICATE KEY(`k1`, `k2`) |
| 127 | + DISTRIBUTED BY HASH(k1) BUCKETS 1 |
| 128 | + PROPERTIES ( |
| 129 | + "replication_num" = "1", |
| 130 | + "version_info" = "2" |
| 131 | + ); |
| 132 | + ``` |
0 commit comments